ANALYZE to NIFTI_GZ -> result too small


Hi All!

I’d appreciate it if anyone could help me with this: I’m converting some files that are in ANALYZE format (traditional .hdr and .img file pair) to NIFTI, and the result seems to be very small. I was wondering if that’s reasonable.The size of my .hdr and .img files are 348 B and 2 MB respectively, while the NIFTI output that I get is only 2 KB. This is how I did the conversion:

fslchfiletype NIFTI_GZ input output


It may simply be that the gzip compression is reducing the image size. You can check the values in nibabel (a Python library):

import numpy as np
import nibabel as nb
img1 = nb.load('analyze.hdr')
img2 = nb.load('nifti.nii.gz')
np.allclose(img1.get_data(), img2.get_data())  # Will return True or False

Another way to check is to run gzip -k analyze.img and see how large analyze.img.gz is. It should be very close to the same size as your gzipped NIfTI image.