We have a pretty one-size-fits-all error when we can't determine the file type:
$ head -c 1000 /dev/zero > test.nii.gz
$ python -c "import nibabel as nb; nb.load('test.nii.gz')"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File ".../nibabel/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 "test.nii.gz"
A relatively common situation is an uncompressed NIfTI that got renamed x.nii.gz. It's fairly straightforward to identify data that isn't gzip or bzip2 by magic number, so we could help people out with a message like File "test.nii.gz" is not a gzip file.
We have a pretty one-size-fits-all error when we can't determine the file type:
A relatively common situation is an uncompressed NIfTI that got renamed
x.nii.gz. It's fairly straightforward to identify data that isn't gzip or bzip2 by magic number, so we could help people out with a message likeFile "test.nii.gz" is not a gzip file.