-
Notifications
You must be signed in to change notification settings - Fork 261
BF: allow for BrainModels or Parcels to contain a single vertex #739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -517,7 +517,7 @@ def flush_chardata(self): | |||
# conversion to numpy array | |||
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))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -531,7 +531,7 @@ def flush_chardata(self): | |||
# conversion to numpy array | |||
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))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
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) |
LGTM. Thanks. |
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.