<div dir="ltr">Hi Chris,<div><br></div><div>Yes, that was the problem. Thanks!</div><div><br></div><div>Paul</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 28, 2021 at 11:12 AM Christopher Markiewicz <<a href="mailto:markiewicz@stanford.edu">markiewicz@stanford.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Paul,<br>
<br>
Is it possible that the file is not actually gzipped? This is the most common cause of this error that I've seen.<br>
<br>
Best,<br>
Chris<br>
<br>
________________________________________<br>
From: Neuroimaging <neuroimaging-bounces+markiewicz=<a href="mailto:stanford.edu@python.org" target="_blank">stanford.edu@python.org</a>> on behalf of Paul Reiners via Neuroimaging <<a href="mailto:neuroimaging@python.org" target="_blank">neuroimaging@python.org</a>><br>
Sent: Tuesday, September 28, 2021 10:07<br>
To: <a href="mailto:neuroimaging@python.org" target="_blank">neuroimaging@python.org</a><br>
Cc: Paul Reiners<br>
Subject: [Neuroimaging] nibabel.filebasedimages.ImageFileError for large label files<br>
<br>
I am getting the following error when loading a large labeled NIFTI file of size 14.4 MB.<br>
<br>
Traceback (most recent call last):<br>
File "/home/miran045/reine097/projects2/lab2im/lab2im/dcan/reproduce_load_error.py", line 7, in <module><br>
img = nib.load(file_path)<br>
File "/home/miran045/reine097/.local/lib/python3.7/site-packages/nibabel/loadsave.py", line 55, in load<br>
raise ImageFileError(f'Cannot work out file type of "{filename}"')<br>
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"<br>
<br>
Here is the code:<br>
<br>
import nibabel as nib<br>
<br>
print(nib.__version__)<br>
<br>
file_path = '/home/feczk001/shared/data/nnUNet/nnUNet_raw_data_base/nnUNet_raw_data/Task509_Paper/labelsTr1/1mo_sub' \<br>
'-375518.nii.gz'<br>
img = nib.load(file_path)<br>
print(img.shape)<br>
<br>
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.<br>
<br>
_______________________________________________<br>
Neuroimaging mailing list<br>
<a href="mailto:Neuroimaging@python.org" target="_blank">Neuroimaging@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/neuroimaging</a><br>
</blockquote></div>