im trying to load my image with nibabel, but I keep getting an "ImageFileError". kindly note that my image is in .gz format. I get the error "file is not a gzip file":
I had the same issue for a subject from the ADNI (Alzheimer's Disease Neuroimaging Initiative) dataset.
What worked for me was to load it with SimpleITK and saving it again (overwriting) still with SimpleITK. Here's the code:
import SimpleITK as sitk
path_corrupted_nifti = "path/to/img.nii.gz"
sitk_img = sitk.ReadImage(path_corrupted_nifti) # load with sitk
sitk.WriteImage(sitk_img, path_corrupted_nifti) # overwrite
after doing this, I was able to load the volume also with nibabel