Package: pydcm2niix
Aboutdcm2niix 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 withMRIcroGL. A full manual for this software is available in the form of aNITRC wiki.The DICOM format is the standard image format generated by modern medical imaging devices. However, DICOM is verycomplicatedand 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 aBIDS JSON formatsidecarwhich includes relevant information for brain scientists in a vendor agnostic and human readable form.
The [Neuroimaging DICOM and NIfTI Primer]https://github.com/DataCurationNetwork/data-primers/blob/master/Neuroimaging%20DICOM%20and%20NIfTI%20Data%20Curation%20Primer/neuroimaging-dicom-and-nifti-data-curation-primer.md) provides details.LicenseThis 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.DependenciesThis 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 havepigzinstalled. You can get a version of both dcm2niix and pigz compiled for your operating system by downloadingMRIcroGL.Image Conversion and CompressionDICOM provides many ways to store/compress image data, known astransfer syntaxes. TheCOMPILE.md file describes detailson how to enable different options to provide support for more formats.The base code includes support for raw, run-length encoded, and classic JPEG lossless decoding.Lossy JPEG is handled by the includedNanoJPEG. This support is modular: you can compile forlibjpeg-turboor disable it altogether.JPEG-LS lossless support is optional, and can be provided by usingCharLS.JPEG2000 lossy and lossless support is optional, and can be provided usingOpenJPEGorJasper.GZ compression (e.g. creating .nii.gz images) is optional, and can be provided using either the includedminizor the popular zlib. Of particular note, theCloudflare zlibexploits modern hardware (available since 2008) for very rapid compression. Alternatively, you can compile dcm2niix without a gzip compressor. Regardless of how you compile dcm2niix, it can use the external programpigzfor parallel compression.VersionsSee releasesfor recent release notes.See the VERSIONS.md file for details on earlier releases.Contributedcm2niix is developed by the community for the community and everybody can become a part of thecommunity.RunningCommand line usage is described in theNITRC wiki. The minimal command line call would bedcm2niix /path/to/dicom/folder. However, you may want to invoke additional options, for example the calldcm2niix -z y -f %p_%t_%s -o /path/output /path/to/dicom/folderwill 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.InstallThere are a couple ways to install dcm2niixGithub Releasesprovides the latest compiled executables. This is an excellent option for MacOS and Windows users. However, the provided Linux executable requires a recent version of Linux (e.g. Ubuntu 14.04 or later), so the provided Unix executable is not suitable for very old distributions. Specifically, it requires Glibc 2.19 (from 2014) or later. Users of older systems can compile their own copy of dcm2niix or download the compiled version included with MRIcroGL Glibc 2.12 (from 2011, see below).Run the following command to get the latest version for Linux, Macintosh or Windows:curl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zipcurl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_mac.zipcurl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_mac_arm.pkgcurl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_win.zipMRIcroGL (NITRC)orMRIcroGL (GitHub)includes dcm2niix that can be run from the command line or from the graphical user interface (select the Import menu item). The Linux version of dcm2niix is compiled on aholy build box, so it should run on any Linux distribution.If you have a MacOS computer with Homebrew or MacPorts you can runbrew install dcm2niixorsudo port install dcm2niix, respectively.If you have Conda,conda install -c conda-forge dcm2niixon Linux, MacOS or Windows.If you have pip,python -m pip install pydcm2niixon Linux, MacOS or Windows.On Debian Linux computers you can runsudo apt-get install dcm2niix.Build from sourceIt 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)cmakeandpkg-config(optional) can be installed as follows:Ubuntu:sudo apt-get install cmake pkg-configMacOS:brew install cmake pkg-configorsudo port install cmake pkgconfigBasic build:gitclonehttps://github.com/rordenlab/dcm2niix.gitcddcm2niix
mkdirbuild&&cdbuild
cmake..
makedcm2niixwill be created in thebinsubfolder. To install on the system runmake installinstead ofmake- 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 bysudo ln -s `which make` /usr/bin/gmake.Advanced build:As noted in theImage Conversion and Compression Supportsection, the software provides many optional modules with enhanced features. A common choice might be to include support for JPEG2000,JPEG-LS(this option requires a  c++14 compiler), as well as using the high performance Cloudflare zlib library (this option requires a CPU built after 2008). To build with these options simply request them when configuring cmake:gitclonehttps://github.com/rordenlab/dcm2niix.gitcddcm2niix
mkdirbuild&&cdbuild
cmake-DZLIB_IMPLEMENTATION=Cloudflare-DUSE_JPEGLS=ON-DUSE_OPENJPEG=ON..
makeoptional batch processing version:The batch processing binarydcm2niibatchis optional. To builddcm2niibatchas well change the cmake command tocmake -DBATCH_VERSION=ON ... This requires a compiler that supports c++11.Building the command line version without cmakeIf you have any problems with the cmake build script described above or want to customize the software see theCOMPILE.md file for details on manual compilation.ReferencingLi X, Morgan PS, Ashburner J, Smith J, Rorden C (2016) The first step for neuroimaging data analysis: DICOM to NIfTI conversion. J Neurosci Methods. 264:47-56. doi: 10.1016/j.jneumeth.2016.03.001.PMID: 26945974AlternativesBIDS-converterhosts Matlab and Python scripts for PET images, supporting DICOM and ECAT (ecat2nii) formats.dcm2niiis the predecessor of dcm2niix. It is deprecated for modern images, but does handle image formats that predate DICOM (proprietary Elscint, GE and Siemens formats).PythondcmstackDICOM to Nifti conversion with meta data preservation.dicm2niiis written in Matlab. The Matlab language makes this very scriptable.dicom2niftiuses the scriptable Python wrapper utilizes thehigh performance  GDCMCONVexecutables.dicomtoniftileveragesVTK.diniftiis focused on conversion of Siemens data.DWIConvertconverts DICOM images to NRRD and NIfTI formats.mcverterhas great support for various vendors.mri_convertis part of the popular FreeSurfer package. In my limited experience this tool works well for GE and Siemens data, but fails with Philips 4D datasets.MRtrix mrconvertis a useful general purpose image converter and handles DTI data well. It is an outstanding tool for modern Philips enhanced images.nanconvertuses the ITK library to convert DICOM from GE and proprietary Bruker to standard formats like DICOM.PET CT viewerforFijican load DICOM images and export as NIfTI.Plastimatchis a Swiss Army knife - it computes registration, image processing, statistics and it has a basic image format converter that can convert some DICOM images to NIfTI or NRRD.Simple Dicom Reader 2 (Sdr2)usesdcmtkto read DICOM images and convert them to the NIfTI format.SlicerHeart extensionis specifically designed to help 3D Slicer support ultra sound (US) images stored as DICOM.spec2niiconverts MR spectroscopy to NIFTI.SPM12is one of the most popular tools in the field. It includes DICOM to NIfTI conversion. Being based on Matlab it is easy to script.LinksThe following tools exploit dcm2niixabcd-dicom2bidsselectively downloads high quality ABCD datasets.autobidsautomates dcm2bids which uses dcm2niix.BiDirect_BIDS_Converterfor conversion from DICOM to the BIDS standard.BIDScoinis a DICOM to BIDS converter with a GUI and thoroughdocumentation.BIDS Toolboxis a web service for the creation and manipulation of BIDS datasets, using dcm2niix for importing DICOM data.birc-bidsprovides a Docker/Singularity container with various BIDS conversion utilities.BOLD5000_autoencoderuses dcm2niix to pipe imaging data into an unsupervised machine learning algorithm.brainnetome DiffusionKituses dcm2niix to convert images.Brain imAgiNg Analysis iN Arcana (Banana)is a collection of brain imaging analysis workflows, it uses dcm2niix for format conversions.BraTS-Preprocessoruses dcm2niix to import files forBrain Tumor Segmentation.bidsifyis a Python project that uses dcm2niix to convert DICOM and Philips PAR/REC images to the BIDS standard.bidskituses dcm2niix to createBIDSdatasets.BioImage Suite Web Projectis a JavaScript project that uses dcm2niix for its DICOM conversion module.boutiques-dcm2niixis a dockerfile for installing and validating dcm2niix.clinicais a software platform for clinical neuroimaging studies that uses dcm2niix to convert DICOM images.clpipeuses dcm2bids for DICOM import.conversionis a Python library that can convert dcm2niix created NIfTI files to the popular NRRD format (including DWI gradient tables). Note, recent versions of dcm2niix can directly convert DICOM images to NRRD.DAC2BIDSuses dcm2niibatch to createBIDSdatasets.Dcm2Bidsuses dcm2niix to createBIDSdatasets. Here is atutorialdescribing usage.dcm2niirR wrapper for dcm2niix/dcm2nii.dcm2niixpyPython package of dcm2niix.dcm2niix_afniis a version of dcm2niix included with theAFNIdistribution.dcm2niiXLis a shell script and tuned compilation of dcm2niix designed for accelerated conversion of extra large datasets.dcmwranglea Python interactive and static tool for organizing dicoms.DeepDicomSortcan recognize different scan types.DICOM2BIDSis a Python 2 script for creating BIDS files.dicom2bidsincludes python modules for converting dicom files to nifti in a bids-compatible file structure that use dcm2niix.dicom2nifti_batchis a Matlab script for automating dcm2niix.DICOM-to-NIfTI-GUIis a Python script that provides a graphical wrapper for dcm2niix.divestR interface to dcm2niix.ExploreASLuses dcm2niix to import images.ezBIDSis a web service for converting directory full of DICOM images into BIDS without users having to learn python nor custom configuration file.fmrif toolsuses dcm2niix for itsoxy2bidstool.fMRIprep.dcm2niixis designed to convert DICOM format to the NIfTI format.fsleyesis a powerful Python-based image viewer. It uses dcm2niix to handle DICOM files through its fslpy libraries.Functional Real-Time Interactive Endogenous Neuromodulation and Decoding (FRIEND) Engineuses dcm2niix.heudiconvcan use dcm2niix to createBIDSdatasets. Data acquired using thereproinconvention can be easily converted to BIDS.kipettoolsuses dcm2niix to load PET data.LEAD-DBSuses dcm2niix forDICOM import.lin4neuroreleases such as the English l4n-18.04.4-amd64-20200801-en.ova include MRIcroGL and dcm2niix pre-installed. This allows user with VirtualBox or VMWarePlayer to use these tools (and many other neuroimaging tools) in a graphical virtual machine.MRIcroGLis available for MacOS, Linux and Windows and provides a graphical interface for dcm2niix. You can get compiled copies from theMRIcroGL NITRC web site.neurodockerincludes dcm2niix as a lean, minimal install Dockerfile.neuro_dockerincludes dcm2niix as part of a single, static Dockerfile.NeuroDebianprovides up-to-date version of dcm2niix for Debian-based systems.neurodockergeneratescustomDockerfiles given specific versions of neuroimaging software.NeuroElfcan use dcm2niix to convert DICOM images.Neuroinformatics Database (NiDB)is designed to store, retrieve, analyze, and share neuroimaging data. It uses dcm2niix for image QA and handling some formats.NiftyPETprovides PET image reconstruction and analysis, and uses dcm2niix to handle DICOM images.nipypecan use dcm2niix to convert images.py2bidsdcm2niix dicom to bids conversion wrapper.pyBIDSconv provides a graphical format for converting DICOM images to the BIDS format. It includes clever default heuristics for identifying Siemens scans.pydcm2niix is a Python module for working with dcm2niix.pydra-dcm2niixis a contains Pydra task interface for dcm2niix.qsmQuantitative Susceptibility Mapping software.reproinis a setup for automatic generation of shareable, version-controlled BIDS datasets from MR scanners.Retina_OCT_dcm2niiconverts optical coherence tomography (OCT) data to NIfTI.sci-tran dcm2niixFlywheel Gear (docker).shimming-toolboxenabled static and real-time shimming, using dcm2niix to import DICOM data.TheSlicerDcm2nii extensionis one method to import DICOM data into Slicer.tar2bidsconverts DICOM tarball(s) to BIDS using heudiconv which invokes dcm2niix.TORTOISEis used for processing diffusion MRI data, and uses dcm2niix to import DICOM images.TractoR (Tracto­graphy with R) uses dcm2niix for image conversion.