Format conversion

DICOM to NIfTI conversion

Export a DICOM series as a NIfTI-1 volume for neuroimaging and research pipelines.

Neuroimaging tools such as FSL, SPM and AFNI, and most AI training pipelines, read volumes as NIfTI rather than as a folder of DICOM slices. dcmage exports the active DICOM series to one gzip-compressed NIfTI-1 file (.nii.gz).

Conversion is one way. dcmage does not open NIfTI files or convert them back to DICOM.

What the file contains

  • Voxel order. Slices are sorted by their position along the slice normal, not by file name or Instance Number. For a multi-frame file, each frame is placed by its own position from the Per-frame Functional Groups.
  • Voxel values. Values are in modality units, with Rescale Slope and Rescale Intercept already applied, so a CT volume holds Hounsfield units. The data type is signed 16-bit when every value fits, unsigned 16-bit when values are too high for signed, and 32-bit float when values have fractions or fit neither. The scaling fields in the header are left empty, so readers apply no further scaling.
  • Orientation. The header carries both a qform and an sform, each with code 1 (scanner anatomical). They describe the same voxel-to-world mapping in RAS space, converted from DICOM’s LPS patient coordinates. The slice step comes from the first and last slice positions, so the affine keeps the real slice spacing.

Steps

  1. Open the DICOM series (⌘O).
  2. Select any image of the series you want to export.
  3. Open Export in the top bar and choose Export Series to NIfTI-1 (.nii.gz). The command palette also has Export series to NIfTI….
  4. Save the file. The browser downloads it, and the Mac app shows a save panel. The file is named after the Series Description.

Checks before export

dcmage refuses the export and says why when the series cannot give a correct affine:

  • a slice has no Image Position (Patient) or Image Orientation (Patient)
  • the slices do not share one orientation
  • two slices sit at the same position
  • the gap between slices varies by more than about 20%, for example when a slice is missing
  • a multi-frame file has no per-frame positions
  • a slice is a color image, or its matrix size differs from the first slice

A single-slice series skips the geometry checks.

Check the result

Open the file in the tool you will use it with and compare it with the DICOM series. In FSL, fslhd prints the dimensions, voxel sizes, data type and both affines. The dimensions should equal columns × rows × slices, and the voxel sizes should match Pixel Spacing and the slice spacing.

Limits

  • One series per export. There is no batch conversion of a study or a folder.
  • Output is a 3D volume. Time series and other 4D data are not written as a fourth dimension.
  • Grayscale only. Color images are refused.
  • No sidecar file is written. BIDS JSON metadata such as echo time or slice timing is not exported.

Result

A .nii.gz file with the series’ dimensions, voxel values in modality units, and matching qform and sform that place each voxel in scanner space.