BF: allow for BrainModels or Parcels to contain a single vertex#739
Merged
effigies merged 2 commits intonipy:masterfrom Mar 13, 2019
MichielCottaar:bug_single_vertex
Merged
BF: allow for BrainModels or Parcels to contain a single vertex#739effigies merged 2 commits intonipy:masterfrom MichielCottaar:bug_single_vertex
effigies merged 2 commits intonipy:masterfrom
MichielCottaar:bug_single_vertex
Conversation
…ertex Fixes an edge case in the reading of CIFTI files. Tests for this edge case have been added for both the BrainModel and Parcel axes.
2 similar comments
effigies
reviewed
Mar 12, 2019
Member
effigies
left a comment
There was a problem hiding this comment.
I believe this is equivalent to using np.loadtxt's ndmin parameter. Could you check that before we call another function?
nibabel/cifti2/parse_cifti2.py
Outdated
| c = BytesIO(data.strip().encode('utf-8')) | ||
| vertices = self.struct_state[-1] | ||
| vertices.extend(np.loadtxt(c, dtype=np.int)) | ||
| vertices.extend(np.atleast_1d(np.loadtxt(c, dtype=np.int))) |
Member
There was a problem hiding this comment.
Suggested change
| vertices.extend(np.atleast_1d(np.loadtxt(c, dtype=np.int))) | |
| vertices.extend(np.loadtxt(c, dtype=np.int, ndmin=1)) |
nibabel/cifti2/parse_cifti2.py
Outdated
| c = BytesIO(data.strip().encode('utf-8')) | ||
| index = self.struct_state[-1] | ||
| index.extend(np.loadtxt(c, dtype=np.int)) | ||
| index.extend(np.atleast_1d(np.loadtxt(c, dtype=np.int))) |
Member
There was a problem hiding this comment.
Suggested change
| index.extend(np.atleast_1d(np.loadtxt(c, dtype=np.int))) | |
| index.extend(np.loadtxt(c, dtype=np.int, ndmin=1)) |
Codecov Report
@@ Coverage Diff @@
## master #739 +/- ##
=======================================
Coverage 89.39% 89.39%
=======================================
Files 93 93
Lines 11476 11476
Branches 1992 1992
=======================================
Hits 10259 10259
Misses 881 881
Partials 336 336
Continue to review full report at Codecov.
|
Contributor
Author
|
Well spotted, that indeed has the same effect (sorry, I only noticed that I could simply have accepted your suggested changes after pushing a commit based on your update) |
Member
|
LGTM. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes an edge case in the reading of CIFTI files.
Tests for this edge case have been added for both the BrainModel and Parcel axes.