NIFTI utilities for MATLAB
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This is an extension to Tools for NIfTI and ANALYZE image and contains additional utilities that I found useful when dealing with NIFTIs in MATLAB.

Utilities in this package allow for data processing to occur WRT storage orientation while also taking data scaling into account, saving NIFTIs after they have been modified/processed in the same orientation, getting the volume in "voxel RAS" orientation which is useful for plotting results without resampling or reslicing the data, and more...

There's more info and a tutorial here for working with NIFTI files in MATLAB with this library.

Installation instructions:

  1. (optional - only if you want to use radiological storage orientation check) Install FSL
  2. Download repo:
git clone
  1. In MATLAB:
>> addpath(genpath('nifti_utils'));

You can try out some of the utilties like so:

# Load volume
test_vol = nifti_utils.load_untouch_nii_vol_scaled('test.nii.gz','double');

# Get "voxel RAS" transform
xform_RAS = nifti_utils.get_voxel_RAS_xform('test.nii.gz');

# Apply transform to volume
test_vol_RAS = nifti_utils.vol_apply_xform(test_vol,xform_RAS);

# View the 4D volume slice-wise

The viewer should look something like: