Skip to content.

Neuroimaging Informatics Technology Initiative

Personal tools
You are here: Home » NIfTI-1 Data Format » Support » PLSgui and NIfTI-1

PLSgui and NIfTI-1

Document Actions
The status of NIfTI-1 support in PLSgui.

PLSgui provides limited NIFTI-1 support from early 2005 with tools for NIFTI image in MATLAB, to load, save, make and view NIFTI images. Thanks to all the feedback, these tools have been modified several times. Please check  to get the latest update and download the MATLAB source code.

More Details on the level of support:

1. File extension

It supports .nii, .img and .hdr file extension.

It does not support .gz file extension, but you can always use "gunzip" on Unix (Linux) or "WinZip" on Windows to unzip a file with .gz extension.

2. Data type

It supports the following data types:

    • Binary (NIFTI_TYPE_BINARY)
    • unsigned char (NIFTI_TYPE_UINT8)
    • signed short (NIFTI_TYPE_INT16)
    • signed int (NIFTI_TYPE_INT32)
    • float (NIFTI_TYPE_FLOAT32)
    • double (NIFTI_TYPE_FLOAT64)
    • signed char (NIFTI_TYPE_INT8)
    • unsigned short (NIFTI_TYPE_UINT16)
    • unsigned int (NIFTI_TYPE_UINT32)
    • signed long int (NIFTI_TYPE_INT64)
    • unsigned long int (NIFTI_TYPE_UINT64)

Basically, it includes all datatypes except long double (FLOAT128).

3. Data of more than 3D

It supports up to 4th dimension of NIFTI data. It does not support 5th dimension of NIFTI data.

For 4D NIFTI file, it will by default load all the time frames into data structure. You can also specify which frame(s) to be loaded. In addition, you can break a 4D NIFTI file into several 3D NIFTI files.

4. Affine transform

It supports all 3 methods indicated on NIFTI web site:

  • sform_code/qform_code are both 0 (old way)
  • sform_code > 0 (will not check qform_code value)
  • sform_code is 0 and qform_code > 0

For sform/qform affine transform, it only provides a subset of support including "Translation", "Flipping", and a few "Rotation (N*90 degree)". Other transforms like "any degree rotation", "shears", etc. are not supported, because in those transforms, each voxel has to be repositioned, interpolated, and whole image(s) will have to be reconstructed. If an input image can not be handled, the program will exit with an error message "Transform of this NIFTI data is not supported by the program". After the transform, image will be in RAS orientation, i.e. X axis from Left to Right, Y axis from Posterior to Anterior, and Z axis from Inferior to Superior. The RAS orientation system sometimes is also referred as right-hand coordinate system, or Neurologist preferred system.

It also supports images whose cardinal planes are slightly off Cartesian coordinates. However, this approximation is based on the following assumption: In affine matrix, any value (absolute) below a tenth of the third largest value (absolute) can be ignored and replaced with 0. In this case, fields 'old_affine' & 'new_affine' will be added into hdr.hist.

Please see detail computation from "xform_nii.m" file.

5. Scaled voxel value (for nonzero scl_slope)

Since scalar "scl_slope" is usually a single or double floating value while
image data can be char or int, I have to convert image data to double for
scaled voxel value then apply:

       img = scl_slope * img + scl_inter

6. NIFTI-1 statistical codes

It does not support NIFTI-1 statistical codes.

Please check  to get the
latest update and download the MATLAB source code.

Created by Data Format Working Group
Last modified 2006-03-30 16:57

Powered by Plone

This site conforms to the following standards: