Back to Glossary

What is NIfTI ?

NIfTI (Neuroimaging Informatics Technology Initiative) is a widely used medical imaging file format for storing 3D and 4D volumes such as MRI, CT, and PET. Evolving from the Mayo Clinic’s ANALYZE 7.5 format of the 1990s, NIfTI was formalized in the early 2000s to standardize research-grade storage with a single-volume design and a rich header, and it has since become a de facto standard in neuroimaging and AI imaging workflows.
A NIfTI file typically appears as .nii or a compressed .nii.gz. Legacy pairs .hdr/.img are also seen.

Unlike DICOM, which stores images as many per-slice files bundled with extensive clinical metadata, NIfTI consolidates a study or series into a single volume with a compact header. The header contains voxel dimensions, data type, spatial orientation, and an affine transform (qform/sform) that maps voxel indices to real-world coordinates. This makes NIfTI ideal for tasks like registration, segmentation, and model training where consistent orientation and fast I/O matter.

Two main versions exist: NIfTI-1, the original, and NIfTI-2, which expands certain fields to support very large datasets. Both handle static 3D volumes and time-series (4D) data, so you can store, for example, a functional MRI run with hundreds of timepoints. The format is extensible, allowing optional metadata “extensions” without breaking compatibility.

For AI data pipelines, NIfTI is convenient because it:

  1. plays nicely with annotation masks and label maps (e.g., *_mask.nii.gz),
  2. preserves geometry for multi-modal fusion (T1, T2, FLAIR, CT, PET),
  3. compresses well, and is readable in libraries like NiBabel and tools such as FSLeyes, ITK-SNAP, 3D Slicer, SPM, and AFNI. Converters like dcm2niix are commonly used to go from DICOM to NIfTI.

Example

Scenario: You have a MRI scan of a patient’s brain. The scanner exports hundreds of DICOM slice files. You convert them into one NIfTI file, say, 'patient01_T1.nii.gz.'

What the NIfTI holds: The entire 3D volume plus a small header that records voxel size (e.g., 1 mm), image orientation, and a transform that tells software where the brain sits in real-world space. In plain terms: it’s one compact file that knows the image’s “shape” and “which way is up.”

Why this helps: A radiologist (or your medical image labeling tool) draws a tumor region and saves it as 'patient01_T1_mask.nii.gz.' Because both files share the same grid and orientation, the mask snaps perfectly onto the MRI without manual alignment. Now you can:

- measure tumor volume,
- train a segmentation model,
-register the scan to a standard atlas, or
-combine multiple modalities (e.g., T1, T2, FLAIR) with consistent geometry.