-
Notifications
You must be signed in to change notification settings - Fork 261
Support ushort for the mgh/mgz reader #1415
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1415 +/- ##
=======================================
Coverage 95.34% 95.34%
=======================================
Files 209 209
Lines 29777 29777
Branches 3357 3357
=======================================
Hits 28390 28390
Misses 948 948
Partials 439 439 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks! I agree, if FreeSurfer creates it, we should be able to read it. Do you have a link to FreeSurfer source that we can cross-reference? If we add it in a comment, it will make it easier to look up in the future, if they add more dtypes (however unlikely that may be). |
Looks like:
I guess I would follow the load_mgh.m fields, since others don't seem to be used. |
Thanks for the quick reply and fixing my botched commit. Indeed, it seems that FreeSurfer introduced the USHORT into mgz only in 2021, in freesurfer/freesurfer@b82c3a8, which may explain why it is not consistently mentionned everywhere. |
Co-authored-by: Chris Markiewicz <[email protected]>
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.
Adding a comment so we can find these links again easily. Can you remove the now-failing test, or select another unsupported datatype (like float16
)?
Thanks a lot. I updated the comment in the code. |
Hi,
nibabel currently crashes when loading an mgh/mgz file of type unsigned short.
As an consequence, recent FreeSurfer 7.4/8 clinical pipelines (that uses nibabel) now crashes on uint16 input MRIs (of any format, e.g nifti1) with an unfriendly python traceback, because it can't read back the mgz it just converted its input to.
I noted a bit of conflicting opinion on whether ushort should be supported for the MGH/MGZ file format.
Therefore, officially supported or not, i suggest there is little drawback in nibabel not crashing when loading such ushort mgz.
The attached one-liner do that.