Skip to content.

Neuroimaging Informatics Technology Initiative

Personal tools
You are here: Home » NIfTI-1 Data Format » Support » How Caret Supports NIfTI-1

How Caret Supports NIfTI-1

Document Actions
From the van Essen lab at Washington University, St Louis.

Caret is able to read and write NIFTI volumes.  NIFTI is the recommended volume file format for use with Caret.



  • Caret will read NIFTI files that are stored in an “.hdr”/”.img” file pair, a “.nii” file, or a “.nii.gz” file.
  • Caret will not read NIFTI volumes that contain two or fewer dimensions nor those containing 5 or more dimensions.
  • A four-dimensional volume is assumed to be multiple volumes, such as a time-series, stored within a single file.
  • Caret will read these NIFTI data types: 8-bit unsigned byte (DT_UINT8), 8-bit signed byte (DT_INT8), 16-bit unsigned short (DT_UINT16), 16-bit signed short (DT_INT16), 32-bit unsigned int (DT_UINT32), 32-bit signed int (DT_INT32), 64-bit unsigned integer (DT_UINT64), 64-bit signed integer (DT_INT64), 32-bit float (DT_FLOAT32), 64-bit double (DT_FLOAT64), and RGB24 (DT_RGB24).  Caret is unable to read 128-bit float (DT_FLOAT128) and all complex data types. 
  • Regardless of the input data type, the data is stored in memory as 32-bit floating-point numbers and any data value offset and scale factors are applied.  The offset and scale factors are not retained by Caret.
  • If the volume contains orthogonal coordinates, Caret re-orients the volume, if necessary, to an LPI orientation (negative-X is left, negative-Y is posterior, and negative-Z is inferior).  Caret is designed to show both volumes and surfaces in an LPI orientation.
  • Caret will read, but not properly display, volumes with oblique (non-orthogonal) coordinates.



  • If Caret is able to load a file as a volume file, Caret can write the volume as a NIFTI volume file.  When writing a volume file, the type of volume file is determined by the volume file’s extension.  Volume file names ending in “.nii” are written as an uncompressed NIFTI file.  Volume file names ending in “.nii.gz” are written as a compressed (gzipped) volume file.  Caret is unable to write NIFTI volume files as a hdr/img file pair.  If the volume file name ends with “.hdr”, the volume is written as an Analyze volume file.
  • Since Caret re-orients volumes to an LPI orientation internally, NIFTI volumes are always written in an LPI orientation.
  • The data types Caret writes are the same as the data types Caret reads.
  • Caret does not use data-value offset and scale factors when writing a volume so the user needs to use the appropriate data type when writing a volume file.  For example, if the user chooses 8-bit unsigned byte for writing and the true voxel data values exceed 255, the volume will be written incorrectly. 
Created by Data Format Working Group
Last modified 2007-10-25 11:36

Powered by Plone

This site conforms to the following standards: