Scroll to navigation



dicomtonifti - vtk-dicom CLI



dicomtonifti -o file.nii file1.dcm [file2.dcm ...]
dicomtonifti -o directory --batch file1.dcm [file2.dcm ...]


The output file (or directory, if --batch).
Compress output files.
Recurse into subdirectories.
Do multiple series at once.
Do not echo output filenames.
Verbose error reporting.
Follow symbolic links when recursing.
Format axial image for use in FSL.
Reformat the image into axial orientation.
Never reorder the slices.
Never reorder the rows.
Never reorder the columns.
Never reorder slices, rows, or columns.
Don't include a qform in the NIFTI file.
Don't include an sform in the NIFTI file.
Set the tag to use for time coordinate.
Set the tag to use for time spacing.
Force the time spacing to be the given value.
Set which volume to output (starts at 0).
Print the version and exit.
Print source and build version.
Documentation for dicomtonifti.

This program will convert a DICOM series into a NIfTI file.

It reads the DICOM Position and Orientation metadata, and uses this information to generate qform and sform entries for the NIfTI header, after doing a conversion from the DICOM coordinate system to the NIfTI coordinate system.

By default, it will also reorder the columns of the image so that columns with higher indices are further to the patient's right (or in the case of sagittal images, further anterior). Likewise, rows will be rearranged so that rows with higher indices are superior (or anterior for axial images). Finally, it will reorder the slices so that the column direction, row direction, and slice direction follow the right-hand rule.

It is also possible to reformat the images into the axial orientation via the --reformat-to-axial option This option is mutually exclusive with the no-reordering options. The resulting orientation matrix will be the identity matrix.

If the output NIFTI files are to be used with the FMRIB FSL package, then use the --fsl option to reformat the images to match the standard FSL orientation: axial images with the slices arranged from inferior to superior, column number increasing from right to left, and row number increasing from posterior to anterior. This will also convert the data type from unsigned 16-bit to signed 16-bit if necessary.

The --time-tag, --time-delta-tag, and --time-delta options can be used to tweak the time information. By default, tags such as TriggerTime, TemporalPositionIdentifier, or TriggerTime are used to perform temporal sorting, but --time-tag can be used to explicitly name a tag. The --time-delta-tag option can be used to set which tag gives temporal spacing, if there is no tag that gives the temporal coordinate. The --time-delta option will force the temporal spacing to be a specific value, e.g. 500ms, 2s, or 2600us.

If batch mode is selected, the output file given with "-o" can be constructed from DICOM attributes, by providing the attribute names within curly braces. For example, consider the following: "{PatientID}-{StudyDate}/{SeriesDescription}-{SeriesNumber}.nii" or something similar to produce a hierarchichal directory structure. The attributes used in the path should be from the following list:

PatientID, PatientName, PatientBirthDate, PatientSex, StudyID, StudyDescription, StudyDate, StudyTime, StudyInstanceUID, SeriesNumber, SeriesDescription, SeriesInstanceUID, Modality, AccessionNumber.

Here is an example of batch mode that recurses into subdirectories and compresses the output files, putting the results in the current directory:

./obj-x86_64-linux-gnu/bin/dicomtonifti -brz -o {SeriesDescription}-{SeriesNumber}.nii /path/to/dicom/files


This manual page was written by Mathieu Malaterre <> for the Debian GNU/Linux system, but may be used by others.

June 2022 dicomtonifti 0.8.13