THE FILE FIELD GUIDE
.nii

NIfTI Image Data

Data & Science

NII is NIfTI’s single-file form, often used for neuroimaging research; .nii.gz is commonly its compressed form. Inspect dimensions, voxel sizes and spatial transforms, including affine/qform/sform, rather than appearance alone.

Main use
Store image arrays with spatial-coordinate information
Data type
Binary data
All sections, questions and sources

Content reviewed: · Editor:Kai

Opening steps

Choose your environment or purpose to see its steps.

NIfTI viewer / NiBabel

Preserve the original and inspect a working copy in a compatible application.

  1. Open a copy in a NIfTI-capable viewer.
  2. Inspect dimensions, voxel sizes and orientation.
  3. If a reference is available, inspect alignment without overwriting the original.
Inspect the received file and its requirements

Establish dependencies and settings before proceeding.

  1. Identify NIfTI version and compression.
  2. Establish 3D/4D structure and axis meaning with the producer.
  3. Inspect qform/sform and processed-data spatial conditions.

Menu labels and support vary by app, OS and version. Preserve the original before making changes.

Troubleshooting by symptom

  • Left/right appears different: inspect viewer conventions and spatial metadata.
  • Misalignment: inspect affine, qform/sform and reference space.
  • Time axis absent: inspect 4D shape and selected volume.
  • Compressed file rejected: check .nii.gz support or decompression requirements.

NII → research data / display image

  1. Select required volumes/slices in compatible software and export separately.
  2. Verify array shape, coordinates, units and de-identification/sharing conditions.

Slice images such as PNG do not preserve full 3D/4D arrays, values and spatial coordinates.

Header-only changes can change meaning

Changing a spatial matrix changes relationships even when voxel values remain unchanged. Do not edit headers merely to make images look aligned; establish the intended reference space and processing.

Source for these steps:NIMH · NIfTI-1 Data Format / NiBabel project · Working with NIfTI images

Worked example: checks before handoff

Example: compare source/result shape and affine and provide the reference image and processing conditions when sharing an analysis.

Source for these steps:NIMH · NIfTI-1 Data Format / NiBabel project · Working with NIfTI images

Related-format differences

Related-format differences
Format / methodPurpose and preserved information
.niiStore image arrays with spatial-coordinate information
DCM / PNGDCM is DICOM and PNG display imagery, with different spatial/metadata structures.
NII → research data / display imageSlice images such as PNG do not preserve full 3D/4D arrays, values and spatial coordinates.

Handling and security

Headers may retain participant/medical information; follow agreed sharing and de-identification checks.

Questions and answers

Is NII.GZ a different image format?

It is commonly gzip-compressed NIfTI; supporting tools may read it directly.

Can JPEG recreate the original?

Dimensions, precision and spatial metadata are not preserved equivalently.

Should I flip the array if orientation looks wrong?

Check display conventions versus coordinates first; visual-only flipping can break spatial relationships.

Format facts: name, steward and MIME type
Formal name
NIfTI Image Data
Steward / specification
NIMH
MIME type
Consult the producer or delivery system. The extension alone does not establish a MIME type.

Primary and official sources

  • StandardNIfTI-1 Data Format

    NIfTI single-file structure and specification.

    NIMH · Link checked:
  • Software documentationWorking with NIfTI images

    Shape, affine transforms, qform/sform and scaling.

    NiBabel project · Link checked: