Compiling dcm2niix on CentOS 7

Prerequisites

  1. GNU 6.5
  2. > CMAKE 3.9.6

What is dcm2niix?

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.

Compilation

% git clone https://github.com/rordenlab/dcm2niix.git
% cd dcm2niix
% cmake -DUSE_OPENJPEG=ON -DCMAKE_CXX_FLAGS=-g -DUSE_STATIC_RUNTIME:BOOL=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/dcm2niix . && make
% make install

If you turn USE_STATIC_RUNTIME:BOOL=ON, Some Centos/Redhat may report “/usr/bin/ld: cannot find -lstdc++”. This can be resolved by installing static versions of libstdc++: yum install libstdc++-static.