Closed petsuter closed 1 year ago
We could probably avoid this check. Without knowing much about MINC, I'd say the simplest thing would be to make it a flag so the user can say "I know what I'm doing and things might break if I try to use this like other spatial images".
Do you know much about MINC? Looking at what you've got there, it seems like spacing == 'xspace'
rather than regular__
, but describes a regular spacing. Is that standard or non-standard?
I heard of MINC the first time today. 😅
Right, that was my impression also.
The comment in the code points to https://en.wikibooks.org/wiki/MINC/SoftwareDevelopment/MINC2.0_File_Format_Reference#Dimension_variable_attributes which claims:
spacing
- String having the valueregular__
to indicate a regularly spaced grid orirregular
to indicate irregular spacing of samples. If the value of this attribute is irregular, then the dimension variable must be a vector varying with the dimension of the same name. If this attribute is absent, a value ofregular__
should be assumed. Can be used for both dimension and dimension width variables.
So maybe xspace
is non-conforming, but maybe any value other than irregular
should de-facto be treated as regular__
?
So maybe
xspace
is non-conforming, but maybe any value other thanirregular
should de-facto be treated asregular__
?
That seems reasonable to me. I think I would follow the logic:
if irregular:
raise ValueError
if not missing and not regular:
warn(f"Invalid spacing declaration; assuming regular")
Would you be interested in submitting a pull request?
Sounds good. Please feel free to edit or redo the PR if I misunderstood or missed something. 👍
Trying to load the file
D4600.mnc
from https://www.facebase.org/chaise/record/#1/isa:imaging_data/RID=5-4T44In https://github.com/nipy/nibabel/issues/448 it was suggested to comment out that line. Then it works:
Are those files all invalid? Should the check be removed or ignorable somehow? Thanks.