[Neuroimaging] nibabel.filebasedimages.ImageFileError for large label files
Paul Reiners
reine097 at umn.edu
Tue Sep 28 10:07:37 EDT 2021
I am getting the following error when loading a large labeled NIFTI file of
size 14.4 MB.
Traceback (most recent call last):
File
"/home/miran045/reine097/projects2/lab2im/lab2im/dcan/reproduce_load_error.py",
line 7, in <module>
img = nib.load(file_path)
File
"/home/miran045/reine097/.local/lib/python3.7/site-packages/nibabel/loadsave.py",
line 55, in load
raise ImageFileError(f'Cannot work out file type of "{filename}"')
nibabel.filebasedimages.ImageFileError: Cannot work out file type of
"/home/feczk001/shared/data/nnUNet/nnUNet_raw_data_base/nnUNet_raw_data/Task509_Paper/labelsTr1/1mo_sub-375518.nii.gz"
Here is the code:
import nibabel as nib
print(nib.__version__)
file_path =
'/home/feczk001/shared/data/nnUNet/nnUNet_raw_data_base/nnUNet_raw_data/Task509_Paper/labelsTr1/1mo_sub'
\
'-375518.nii.gz'
img = nib.load(file_path)
print(img.shape)
This does not happen when I try to open such files of smaller size (on the
order of KB). I can open this file in FreeSurfer FreeView without error
and it looks fine. This is happening with version 3.2.1 of NiBabel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/neuroimaging/attachments/20210928/51a7983f/attachment.html>
More information about the Neuroimaging
mailing list