How to convert .nii to .nii.gz file?

14,072

As far as I know, there is nothing special about zipping NIfTI files. In MATLAB, you could simply do:

gzip('niftifilename.nii') % this will return niftifilename.nii.gz
gzip('*.nii') % for multiple nii files to create one .nii.gz

To work with the file again, you can unzip it, using gunzip. I've tried this on my Mac (don't know if this will work on Windows).

Typically, they are volume data, and hence take up a fair bit of disk space. Zipping it is purely for reducing the size of the file, and should not modify data.

Share:
14,072
Angelababy
Author by

Angelababy

Updated on June 28, 2022

Comments

  • Angelababy
    Angelababy almost 2 years

    I have lots of .nii file. I want to know how to convert .nii file to .nii.gz file?

    Thanks