-
Notifications
You must be signed in to change notification settings - Fork 262
Cannot work out file type of ".nii" #620
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
Comments
This happens because path_maybe_image() does not recognize
and in turn that's because splitext_addext() fails and outputs:
instead of:
|
And finally that's because os.path.splitext() does not work as expected:
while you expect:
|
os.path.splitext() does not provide the behavior we need to properly recognize edge cases such as '.nii' as image files. Fixes nipy#620.
As a point of information, you can always load such a file with
This is what I would expect. Initial dots are considered part of the filename, not an extension. |
Happens with output of |
I know about the behavior of os.path.splitext() but I claim this is not the behavior we need in this context. |
On the other hand I can understand why you wouldn't want to deviate from the standard os.path.splitext() behavior. However while I almost always agree with choices made in Python libraries, I find the choices made in os.path.splitext() arbitrary - an optional argument would be welcome to switch behavior in edge cases depending on the context. |
Hello, I'm using nib.Nifti1Image.from_filename(file_path) to read the .nii.gz file. Referring another issue post, I renamed the file without .gz and the file_path without .gz. However, it's now rasing |
While this is a corner case, nibabel should properly load
.nii.
instead of raising an exception.The text was updated successfully, but these errors were encountered: