What is NIfTI?

Medical imaging data, such as MRI, CT, and PET scans, may be saved in a special file format called NIfTI (Neuroimaging Informatics Technology Initiative). The discipline of medical imaging, as well as brain research and other image-based medical specialties including radiation oncology and psychiatry, make extensive use of it.

  • The NIfTI format was created to improve upon the shortcomings of the previous standard for storing medical imaging data, the Analyze format.

Along with the actual picture data, NIfTI files also include metadata such as the image’s measurements, voxel size, and direction, as well as the results of any pre-processing that may have been performed on the raw data.

For example, ITK-Snap, FSL, SPM, and AFNI are all capable of reading NIfTI files (which end in.nii or.nii.gz).

Many imaging programs are now able to read and write NIfTI files since this format has become widely accepted in the field. NIfTI data can be easily manipulated in a wide range of programs since it is supported by a wide range of computer languages and libraries.

NIfTI file format

There are two components to a NIfTI file:

  • the actual image data 
  • header information 

Both the picture data and the header information are kept as binary and text files, respectively.

Some of the fields that make up a NIfTI header format are as follows:

  • Dimensions– The number of slices in the z-dimension is an example of a dimension. Dimensions are the total number of voxels in the picture.
  • Resolution– Millimeter values for x, y, and z dimensions define the spatial resolution of a 3D model.
  • Data- The image’s data type, which might be an unsigned 8-bit integer or a 32-bit floating point number.
  • Orientation– Picture orientation refers to the overall orientation of an image, including the x, y, and z axes.
  • Intensity– If the data has been scaled in any manner, this is the scale factor for the intensity values.
  • Time– If the picture is a time series, the time step is the interval between frames.
  • History– An account of the data’s past processing, including any smoothing or normalization that may have occurred.
  • Data offset– indicates the position in bytes from which the picture data begins to be read.
  • Extra fields– These are fields used to store data unique to particular picture formats, such as those used in diffusion-weighted images, or to record data that is unique to certain applications.

The file contains both text data (the file’s header) and binary data (the picture data), but only the former can be read by most software programs. A single file contains both the picture data and the header information, with the header data located at the file’s beginning. This enables applications to read the file’s header information and comprehend the picture data’s structure.


File formats for medical imaging data such as DICOM and NIfTI are similar yet serve distinct functions. NIfTI is mostly employed in the fields of medical imaging and neuroscience research, whereas DICOM is the standard file format for storing and distributing medical pictures.

There are numerous medical imaging software programs and analytic tools that only work with NIfTI files, therefore converting DICOM files is a regular chore. It is possible to transform DICOM to NIfTI using a number of tools and packages, such as:

  • dcm2nii– Included in the MRIcron suite of programs is a command-line utility called dcm2nii
  • dcm2niix- An improved variant of dcm2nii, dcm2niix can process more intricate DICOM data and produce JSON sidecar files.
  • pydicom– Python’s pydicom package may be used to read and write DICOM files and convert them to NIfTI.
  • SPM– Statistical Parametric Mapping is a program that may be used to analyze images
  • ITK-Snap is an image analysis toolkit that may be used to segment images

There are a variety of options available, and picking the one that works best for you depends on your specific circumstances. While some, like SPM and ITK-Snap, are more complex and need training to operate, others, like dcm2nii and dcm2niix, are command-line based and straightforward. It’s also important to note that the majority of these applications want the picture to be in a certain format and organization, such as a particular folder structure, before converting.