Unsupported transfer syntex when using dcm2niix

Hi! I’ve got a problem when using dcm2bids to my data set since it doesn’t get passed the dcm–>nifti conversion. The error I get from dcm2bids is:
Command '['dcm2niix', '-b', 'y', '-ba', 'y', '-z', 'y', '-f', '%3s_%f_%p_%t', '-o', '/home/brain/Documents/data/iNPH/BIDS/bids_nii/tmp_dcm2bids/sub-01_ses-1', 'sourcedata/dicomdata/exam_01/']' returned non-zero exit status 2.

So I started investigating dcm2niix

When I do the dcm2niix on my data set I get following error message: Warning: Unsupported transfer syntax '1.2.840.10008.1.2.4.90'

I’ve read a lot about this now and from https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage one can read that it has someting about JPEG2000. Haven’t my dcm2niix version support for that? Or is it something else? Can tha data be corrupt?

Appreciate all help I can get!

dcm2bids:version: 2.1.4
dcm2niix:version: v1.0.20190902

Short answer: Use a version of dcm2niix compiled with JPEG200 support
https://github.com/rordenlab/dcm2niix/releases

Your DICOM images have been encoded using JPEG2000. Therefore, you will need a copy of dcm2niix that has been compiled to support this compression strategy. You can always see what options dcm2niix has been compiled with by running it from the command line with no parameters. dcm2niix always support raw, classic lossy JPEG and lossless JPEG, but support for JPEG-LS (using CharLS) and JPEG2000 (using OpenJPEG) are optional. Below is output of a version that supports JPEG2000 (JP2):

dcm2niix
Chris Rorden’s dcm2niiX version v1.0.20190902 (JP2:OpenJPEG) (JP-LS:CharLS) Clang10.0.1 (64-bit MacOS)

Personally, I would check how these images got saved to JPEG2000. The DICOM standard only requires tools to support the uncompressed transfer syntax, so perfectly valid DICOM tools may not handle your images. I would suggest using a general file compression method (e.g. zip, zstd, or disk-based compression) to reduce disk space rather than JPEG2000.

Assuming you are using MacOS or Linux, you can always compile your own copy

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

For Windows (assuming you have git and mdvc installed, you would compile with:

git clone https://github.com/rordenlab/dcm2niix.git
cd dcm2niix
mkdir build && cd build
cmake -Wno-dev -G "Visual Studio 14 2015 Win64" -DUSE_OPENJPEG=ON -DUSE_JPEGLS=ON ..\
msbuild dcm2niix.sln
2 Likes

Hi Chris, thank you so much for your answear! Bur I’m having issues making the commands that you proposed.

I’m running on a Linux virtual machine and this was fine:

git clone https://github.com/rordenlab/dcm2niix.git
cd dcm2niix
mkdir build && cd build

But I dont know what to replace the two dots after

cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON

When I just run the code above it says: The source directory “/home/brain/dcm2niix/build” does not appear to contain CMakeLists.txt

So i tried cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON /home/brain/dcm2niix since CMakeLists.txt exists in that directory.

But then I get the error: No CMAKE_CXX_COMPILER could be found

This is really not my strong side and running on Linux is still quite new for me so I would appreciate some help!

Sincerely, Jesper

I suggest you try the short answer solution:

  1. Use a web browser to go to the dcm2niix releases page
  2. Download the release compiled for your operating system. Since you are using Linux this is called “dcm2niix_lnx.zip”
  3. Extract the zip archive and try running it from the command line. This will reveal that it supports your transfer syntax:
    Chris Rorden's dcm2niiX version v1.0.20190902 (JP2:OpenJPEG) (JP-LS:CharLS) GCC5.5.0 (64-bit Linux)

For completeness, in the Linux command line .. refers to the parent directory. The comment suggest you do not have a C compiler installed. Assuming you are using a Debian distribution, you could install one with
sudo apt install build-essential

Hi! Thank you so much for your help but I’ve tried to unzip it and execute it but it doesn’t work.

I also tried sudo apt install build-essential and the installing it like Chris_Rorden told me like this:

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

But I get the error message:

Scanning dependencies of target openjpeg
[  4%] Creating directories for 'openjpeg'
[  8%] Performing download step (git clone) for 'openjpeg'
Cloning into 'openjpeg'...
fatal: unable to connect to github.com:
github.com[0: 140.82.118.3]: errno=Connection refused

Cloning into 'openjpeg'...
fatal: unable to connect to github.com:
github.com[0: 140.82.118.3]: errno=Connection refused

Cloning into 'openjpeg'...
fatal: unable to connect to github.com:
github.com[0: 140.82.118.3]: errno=Connection refused

-- Had to git clone more than once:
          3 times.
CMake Error at openjpeg-prefix/tmp/openjpeg-gitclone.cmake:40 (message):
  Failed to clone repository: 'git://github.com/ningfei/openjpeg.git'


CMakeFiles/openjpeg.dir/build.make:83: recipe for target 'openjpeg-prefix/src/openjpeg-stamp/openjpeg-download' failed
make[2]: *** [openjpeg-prefix/src/openjpeg-stamp/openjpeg-download] Error 1
CMakeFiles/Makefile2:96: recipe for target 'CMakeFiles/openjpeg.dir/all' failed
make[1]: *** [CMakeFiles/openjpeg.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2

Any suggestions?

Can you be specific regarding how the download did not work? What happens when you run these commands (using sudo apt install for curl and unzip if needed)?

curl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zip
unzip dcm2niix_lnx.zip
./dcm2niix

With regards to the compilation, does the command git work in isolation, and if not have you tried sudo apt install git. Alternatively, is this computer behind a firewall that limits access to the web.

Can I suggest you consult a local Linux expert who can help. Hard to troubleshoot from a distance.

Hi! Thank you so much for all your help, now it’s working!!