
The JNIfTI toolbox includes a stand-alone NIfTI-1/2 parser that works on both MATLAB and GNU Octave without needing additional components. To just reading and writing the un-compressed NIfTI and Analyze7.5 files (.nii, .hdr/.img), one only needs to run addpath('/path/to/jnifti'). For MATLAB, JNIfTI toolbox utilizes memmapfile-based disk-reading, making it very fast. For Octave, memmapfile is currently not implemented, so, a full reading is required.
The JNIfTI toolbox is also capable of reading/writing gzip-compressed NIfTI and Analyze7.5 files (.nii.gz, .hdr.gz, .img.gz). This feature is supported in MATLAB directly without needing another toolbox (MATLAB must be in the JVM-enabled mode).
To process gzip-compressed NIfTI/Analyze files in Octave and MATLAB with -nojvm, one need to install the open-source JSONLab and ZMat toolboxes