# The NIfTI-1 Data Format

NIfTI-1 FAQ

NIfTI-1 overview chart

Data dimensionality

The NIfTI-1 header

Extending a NIfTI-1 file

NIfTI-1 Statistical parametric data

Other data intentions in NIfTI-1

Data transformations

#### Introduction

NIfTI-1 is a somewhat new data format, proposed by the NIfTI DFWG as a short-term measure to facilitate inter-operation of functional MRI data analysis software packages. It is adapted from the widely used ANALYZETM 7.5 file format. The hope is that older non-NIfTI-aware software that uses the ANALYZE 7.5 format will still be compatible with NIfTI-1. NIfTI-1 uses the "empty space" in the ANALYZE 7.5 header to add several new features. These features are described in the current document.

#### NIfTI-1 flag (magic strings)

To flag such a struct as being conformant to the NIFTI-1 spec, the last 4 bytes of the header must be either the C String ”ni1” or ”n+1”; in hexadecimal, the

4 bytes 6E 69 31 00 or 6E 2B 31 00 (in any future version of this format, the ’1’ will be upgraded to ’2’, etc.). Normally, such a ”magic number” or flag goes

at the start of the file, but trying to avoid clobbering widely-used ANALYZE 7.5 fields led to putting this marker last. However, recall that ”the last shall be

first” (Matthew 20:16).

If a NIFTI-aware program reads a header file that is NOT marked with a NIFTI magic string, then it should treat the header as an ANALYZE 7.5 structure.

#### NIfTI-1 file storage

”ni1” means that the image data is stored in the ”.img” file corresponding to the header file (starting at file offset 0).

”n+1” means that the image data is stored in the same file as the header information.

We recommend that the combined header+data filename should be ”.nii”. When the dataset is stored in one file, the first byte of image data is

stored at byte location (int)vox_offset in this combined file.

#### Grace under fire

Most NIFTI-aware programs will only be able to handle a subset of the full range of datasets possible with this format. All NIFTI-aware programs should

take care to check if an input dataset conforms to the program’s needs and expectations (e.g., check datatype, intent_code, etc.). If the input dataset can’t

be handled by the program, the program should fail gracefully (e.g., print a useful warning; not crash).

This information is provided in the nifti-1.h code by Robert W. Cox (NIH)

.