Home

Awesome

Build status

About

dcm2niix is designed to convert neuroimaging data from the DICOM format to the NIfTI format. This web page hosts the developmental source code - a compiled version for Linux, MacOS, and Windows of the most recent stable release is included with MRIcroGL. A full manual for this software is available in the form of a NITRC wiki.

The DICOM format is the standard image format generated by modern medical imaging devices. However, DICOM is very complicated and has been interpreted differently by different vendors. The NIfTI format is popular with scientists, it is very simple and explicit. However, this simplicity also imposes limitations (e.g. it demands equidistant slices). dcm2niix is also able to generate a BIDS JSON format sidecar which includes relevant information for brain scientists in a vendor agnostic and human readable form. The Neuroimaging DICOM and NIfTI Primer provides details.

License

This software is open source. The bulk of the code is covered by the BSD license. Some units are either public domain (nifti*.*, miniz.c) or use the MIT license (ujpeg.cpp). See the license.txt file for more details.

Dependencies

This software should run on macOS, Linux and Windows typically without requiring any other software. However, if you use dcm2niix to create gz-compressed images it will be faster if you have pigz installed. You can get a version of both dcm2niix and pigz compiled for your operating system by downloading MRIcroGL.

Image Conversion and Compression

DICOM provides many ways to store/compress image data, known as transfer syntaxes. The COMPILE.md file describes details on how to enable different options to provide support for more formats.

Versions

See releases for recent release notes. See the VERSIONS.md file for details on earlier releases.

Contribute

dcm2niix is developed by the community for the community and everybody can become a part of the community.

Running

Command line usage is described in the NITRC wiki. The minimal command line call would be dcm2niix /path/to/dicom/folder. However, you may want to invoke additional options, for example the call dcm2niix -z y -f %p_%t_%s -o /path/output /path/to/dicom/folder will save data as gzip compressed, with the filename based on the protocol name (%p) acquisition time (%t) and DICOM series number (%s), with all files saved to the folder "output". For more help see help: dcm2niix -h.

See the BATCH.md file for instructions on using the batch processing version.

Install

There are a couple ways to install dcm2niix

Build from source

It is often easier to download and install a precompiled version. However, you can also build from source.

Build command line version with cmake (Linux, MacOS, Windows)

cmake and pkg-config (optional) can be installed as follows:

Ubuntu: sudo apt-get install cmake pkg-config

MacOS: brew install cmake pkg-config or sudo port install cmake pkgconfig

Once these tools are available, you can compile with cmake:

git clone https://github.com/rordenlab/dcm2niix.git
cd dcm2niix
mkdir build && cd build
cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON ..
make

dcm2niix will be created in the bin subfolder. To install on the system run make install instead of make - this will copy the executable to your path so you do not have to provide the full path to the executable.

In rare case if cmake fails with the message like "Generator: execution of make failed", it could be fixed by sudo ln -s `which make` /usr/bin/gmake.

Building the command line version without cmake

This is the simplest way to compile dcm2niix on a Linux or MacOS computer. Be warned that this minimal version will not be able to extract DICOM images compressed with the (rarely used) JPEG2000 or JPEG-LS formats.

git clone https://github.com/rordenlab/dcm2niix.git
cd dcm2niix/console
make
./dcm2niix

Referencing

Alternatives

Links

The following tools exploit dcm2niix