dcm2nii DICOM to NIfTI converter: compiled versions available from NITRC
See the codedcm2niix 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.
To view the WASM specific README, please click here. The rest of this README is for the dcm2niix CLI program.
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.
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.
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.
-z s) is optional, and can be enabled with -DUSE_ZSTD=ON (CMake) or ZSTD=1 make (Makefile). Zstandard offers a favorable compression/speed tradeoff compared to gzip._recording-<label>_physio.tsv.gz files with companion .json sidecars (cardiac/respiratory/ecg/external_trigger streams), rather than skipped as non-image. For CMRR streams that carry firmware-detected R-wave / respiratory peaks, the TSV is 3 columns — [<signal>, trigger, <signal>_trigger] — where column 2 is BIDS-canonical scanner volume triggers (byte-compatible with bidsphysio) and column 3 carries the per-stream physiological events. The EXT stream is the one exception: its peak column is named external_trigger_peak rather than external_trigger_trigger. The sibling regression set dcm_qa_physio documents the column layout, the VALUE=2048 trigger-sentinel encoding, and the deliberate divergence from bidsphysio (which remains the canonical post-processor for richer cases)..json sidecars (including _mrsi suffix and a 4×4 VOI matrix emitted when sufficient source VOI metadata is present). Multi-DICOM classic Siemens CSI/MRSI is not supported. Non-square UIH MRSI grids produce correct dim/payload alignment matching spec2nii (dcm2niix deliberately mirrors spec2nii's transposed affine/data-shape coupling for byte parity). Philips classic 2× payloads emit a paired <stem>_mrsref.nii.gz water-reference companion; standalone water-reference acquisitions (wrsoff / no_Water_Suppression series-naming) are relabeled _mrsref with WaterSuppressed: false. Vendor-sequence-state-specific reshapes / splits (CMRR sLASER DKD reference-scan ordering, Philips MEGA-PRESS edit ON/OFF interpretation) are intentionally NOT done in C — dcm2niix ships raw bundled NIfTIs. The sibling Python tool tools/mrs_post.py (pydicom + numpy) consumes those outputs to produce spec2nii-equivalent split / reshaped files when desired. Ported from spec2nii (BSD-3-Clause, William Clarke, U. Oxford). MRS regression / validation corpus lives in the sibling dcm_qa_mrs repo — current parity: 23/40 PASS bare, 30/40 PASS via --with-mrs-post, 10 SKIP bounded by spec2nii reference availability.-f %H)dcm2niix can emit ReproIn/heudiconv-style BIDS filenames in a single pass via the -f %H format specifier, with the optional -bi (subject), -bv (session), and -br (project subdirectory) flags. A companion script tools/reproinx.py handles cross-series concerns (fmap pairing, _scans.tsv, B0FieldIdentifier/B0FieldSource, session backfill, root scaffolding, plus cross-series reclassification such as short reverse-PE EPIs to fmap/_epi and rescue of session-first/suffix-last protocols that the one-pass parser cannot name) and accepts --anonymize, --strict, --keep-derivatives, --no-convert, --min-volumes/-N, and --shift-dates (BIDS-recommended date de-identification: per-subject shift to 1925 preserving relative timing) flags. The anonymisation flag -ba has three modes: y (default; strip dates and patient PII), n (keep both), o (omit patient PII only — keep acquisition timestamps so reproinx's _scans.tsv and fmap closest-time pairing still work). See REPROIN.md for the full grammar, defaults, privacy considerations, and known limitations.
See releases for recent release notes. See the VERSIONS.md file for details on earlier releases.
dcm2niix is developed by the community for the community and everybody can become a part of the community. Pull requests should target the development branch — master is reserved for tagged stable releases.
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.
There are a couple ways to install dcm2niix
curl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zipcurl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/macos_dcm2niix.pkgcurl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_win.zipbrew install dcm2niix or sudo port install dcm2niix, respectively.conda install -c conda-forge dcm2niix on Linux, MacOS or Windows.python -m pip install dcm2niix on Linux, MacOS or Windows.sudo apt-get install dcm2niix.It is often easier to download and install a precompiled version. However, you can also build from source.
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=zlib-ng -DUSE_JPEGLS=ON -DUSE_OPENJPEG=GitHub ..
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.
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
dcm2niix is a core dependency of BIDS converters:
The following tools exploit dcm2niix
Overall
Maintained
Code review
PyPI
Latest release
Releases this year
151 followers · starred Jun 2024
261 followers · starred Jun 2024
19 followers · starred Aug 2024
10 followers · starred Sep 2024
dcm2nii DICOM to NIfTI converter: compiled versions available from NITRC
See the codedcm2niix 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.
To view the WASM specific README, please click here. The rest of this README is for the dcm2niix CLI program.
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.
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.
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.
-z s) is optional, and can be enabled with -DUSE_ZSTD=ON (CMake) or ZSTD=1 make (Makefile). Zstandard offers a favorable compression/speed tradeoff compared to gzip._recording-<label>_physio.tsv.gz files with companion .json sidecars (cardiac/respiratory/ecg/external_trigger streams), rather than skipped as non-image. For CMRR streams that carry firmware-detected R-wave / respiratory peaks, the TSV is 3 columns — [<signal>, trigger, <signal>_trigger] — where column 2 is BIDS-canonical scanner volume triggers (byte-compatible with bidsphysio) and column 3 carries the per-stream physiological events. The EXT stream is the one exception: its peak column is named external_trigger_peak rather than external_trigger_trigger. The sibling regression set dcm_qa_physio documents the column layout, the VALUE=2048 trigger-sentinel encoding, and the deliberate divergence from bidsphysio (which remains the canonical post-processor for richer cases)..json sidecars (including _mrsi suffix and a 4×4 VOI matrix emitted when sufficient source VOI metadata is present). Multi-DICOM classic Siemens CSI/MRSI is not supported. Non-square UIH MRSI grids produce correct dim/payload alignment matching spec2nii (dcm2niix deliberately mirrors spec2nii's transposed affine/data-shape coupling for byte parity). Philips classic 2× payloads emit a paired <stem>_mrsref.nii.gz water-reference companion; standalone water-reference acquisitions (wrsoff / no_Water_Suppression series-naming) are relabeled _mrsref with WaterSuppressed: false. Vendor-sequence-state-specific reshapes / splits (CMRR sLASER DKD reference-scan ordering, Philips MEGA-PRESS edit ON/OFF interpretation) are intentionally NOT done in C — dcm2niix ships raw bundled NIfTIs. The sibling Python tool tools/mrs_post.py (pydicom + numpy) consumes those outputs to produce spec2nii-equivalent split / reshaped files when desired. Ported from spec2nii (BSD-3-Clause, William Clarke, U. Oxford). MRS regression / validation corpus lives in the sibling dcm_qa_mrs repo — current parity: 23/40 PASS bare, 30/40 PASS via --with-mrs-post, 10 SKIP bounded by spec2nii reference availability.-f %H)dcm2niix can emit ReproIn/heudiconv-style BIDS filenames in a single pass via the -f %H format specifier, with the optional -bi (subject), -bv (session), and -br (project subdirectory) flags. A companion script tools/reproinx.py handles cross-series concerns (fmap pairing, _scans.tsv, B0FieldIdentifier/B0FieldSource, session backfill, root scaffolding, plus cross-series reclassification such as short reverse-PE EPIs to fmap/_epi and rescue of session-first/suffix-last protocols that the one-pass parser cannot name) and accepts --anonymize, --strict, --keep-derivatives, --no-convert, --min-volumes/-N, and --shift-dates (BIDS-recommended date de-identification: per-subject shift to 1925 preserving relative timing) flags. The anonymisation flag -ba has three modes: y (default; strip dates and patient PII), n (keep both), o (omit patient PII only — keep acquisition timestamps so reproinx's _scans.tsv and fmap closest-time pairing still work). See REPROIN.md for the full grammar, defaults, privacy considerations, and known limitations.
See releases for recent release notes. See the VERSIONS.md file for details on earlier releases.
dcm2niix is developed by the community for the community and everybody can become a part of the community. Pull requests should target the development branch — master is reserved for tagged stable releases.
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.
There are a couple ways to install dcm2niix
curl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zipcurl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/macos_dcm2niix.pkgcurl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_win.zipbrew install dcm2niix or sudo port install dcm2niix, respectively.conda install -c conda-forge dcm2niix on Linux, MacOS or Windows.python -m pip install dcm2niix on Linux, MacOS or Windows.sudo apt-get install dcm2niix.It is often easier to download and install a precompiled version. However, you can also build from source.
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=zlib-ng -DUSE_JPEGLS=ON -DUSE_OPENJPEG=GitHub ..
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.
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
dcm2niix is a core dependency of BIDS converters:
The following tools exploit dcm2niix
Overall
Maintained
Code review
PyPI
Latest release
Releases this year
151 followers · starred Jun 2024
261 followers · starred Jun 2024
19 followers · starred Aug 2024
10 followers · starred Sep 2024