Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only in /home/yoh/deb/gits/pkg-exppsy/dcm_qa/Ref: fMRI_MB_int_26.{json,nii} #5

Closed
yarikoptic opened this issue Jun 23, 2017 · 14 comments

Comments

@yarikoptic
Copy link
Collaborator

sorry to be the pain... dcm2niix v1.0.20170623, this repo 01fd3df

Running command:
diff -br /home/yoh/deb/gits/pkg-exppsy/dcm_qa/Out /home/yoh/deb/gits/pkg-exppsy/dcm_qa/Ref -I ConversionSoftwareVersion
Only in /home/yoh/deb/gits/pkg-exppsy/dcm_qa/Ref: fMRI_MB_int_26.json
Only in /home/yoh/deb/gits/pkg-exppsy/dcm_qa/Ref: fMRI_MB_int_26.nii
@neurolabusc
Copy link
Owner

This is as a valid error, and indeed the reason I included sample JPEG2000 images. This warning suggests you are testing a copy of dcm2niix compiled without JPEG2000 support. Therefore, your copy failed to convert the images jp2k1.dcm and jp2k2.dcm. One solution is to get a pre-compiled release, alternatively you can build a copy with cmake -DBATCH_VERSION=ON .. or create a custom JPEG2000 build.

@yarikoptic
Copy link
Collaborator Author

hmm... it as built with BATCH_VERSION=ON:

$> grep BATCH dcm2niix_1.0.20170623-1_amd64.build
  -DBATCH_VERSION:BOOL=ON
	cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DUSE_STATIC_RUNTIME:BOOL=OFF -DUSE_SYSTEM_TURBOJPEG:BOOL=ON -DUSE_SYSTEM_ZLIB:BOOL=ON -DBATCH_VERSION:BOOL=ON
cd /home/yoh/deb/gits/pkg-exppsy/build-area/dcm2niix-1.0.20170623/build/console-build && /usr/bin/cmake -Wno-dev --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=/home/yoh/deb/gits/pkg-exppsy/build-area/dcm2niix-1.0.20170623/build -DUSE_STATIC_RUNTIME:BOOL=OFF -DUSE_SYSTEM_ZLIB:BOOL=ON -DUSE_SYSTEM_TURBOJPEG:BOOL=ON -DUSE_SYSTEM_JASPER:BOOL= -DUSE_OPENJPEG:BOOL=OFF -DOpenJPEG_DIR:PATH= -DBATCH_VERSION:BOOL=ON -DYAML-CPP_DIR:PATH=/cmake/yaml-cpp "-GUnix Makefiles" /home/yoh/deb/gits/pkg-exppsy/build-area/dcm2niix-1.0.20170623/console

$> apt-cache policy dcm2niix
dcm2niix:
  Installed: 1:1.0.20170623-1
  Candidate: 1:1.0.20170623-1
  Version table:
 *** 1:1.0.20170623-1 100
        100 /var/lib/dpkg/status

may be you meant that I have to use USE_OPENJPEG instead of turbojpeg?

@neurolabusc
Copy link
Owner

Mea culpa, as described on the README.MD, to compile for OPENJPEG (which provides JPEG2000 support, classic JPEG and lossless ancient JPEG are different) you use:

mkdir build && cd build
cmake -DUSE_OPENJPEG=ON ..
make

@yarikoptic
Copy link
Collaborator Author

yarikoptic commented Jun 24, 2017

sorry for being a pain but FWIW -DUSE_OPENJPEG=ON -- still not sufficient ... built with it, verified that openjp is linked, still qa fails (see below). README suggests that I have to build openjpeg statically myself, but that shouldn't be required I hope

(git)hopa:~exppsy/dcm2niix/dcm_qa[master]git
$> grep USE_OPENJPEG ../../build-area/dcm2niix_1.0.20170624-1_amd64.build
      -DUSE_OPENJPEG:BOOL=ON \
	cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DUSE_STATIC_RUNTIME:BOOL=OFF -DUSE_SYSTEM_TURBOJPEG:BOOL=ON -DUSE_OPENJPEG:BOOL=ON -DUSE_SYSTEM_ZLIB:BOOL=ON -DBATCH_VERSION:BOOL=ON
cd /home/yoh/deb/gits/pkg-exppsy/build-area/dcm2niix-1.0.20170624/build/console-build && /usr/bin/cmake -Wno-dev --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=/home/yoh/deb/gits/pkg-exppsy/build-area/dcm2niix-1.0.20170624/build -DUSE_STATIC_RUNTIME:BOOL=OFF -DUSE_SYSTEM_ZLIB:BOOL=ON -DUSE_SYSTEM_TURBOJPEG:BOOL=ON -DUSE_SYSTEM_JASPER:BOOL= -DUSE_OPENJPEG:BOOL=ON -DOpenJPEG_DIR:PATH=/usr/lib/x86_64-linux-gnu/openjepg-2.1 -DBATCH_VERSION:BOOL=ON -DYAML-CPP_DIR:PATH=/cmake/yaml-cpp "-GUnix Makefiles" /home/yoh/deb/gits/pkg-exppsy/build-area/dcm2niix-1.0.20170624/console
2 23015.....................................:Sat 24 Jun 2017 07:08:42 AM PDT:.
(git)hopa:~exppsy/dcm2niix/dcm_qa[master]git
$> ldd /usr/bin/dcm2niix                                                 
	linux-vdso.so.1 (0x00007ffeea7e6000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f962b807000)
	libturbojpeg.so.0 => /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0 (0x00007f962b594000)
	libopenjp2.so.7 => /usr/lib/x86_64-linux-gnu/libopenjp2.so.7 (0x00007f962b359000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f962afd7000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f962acd3000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f962aaba000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f962a71c000)
	/lib64/ld-linux-x86-64.so.2 (0x000055d0bde96000)
2 23016.....................................:Sat 24 Jun 2017 07:08:48 AM PDT:.
(git)hopa:~exppsy/dcm2niix/dcm_qa[master]git
$> rm -rf Out/; ./batch.sh 2>&1 | tail -n 5                              

Running command:
diff -br /home/yoh/deb/gits/pkg-exppsy/dcm2niix/dcm_qa/Out /home/yoh/deb/gits/pkg-exppsy/dcm2niix/dcm_qa/Ref -I ConversionSoftwareVersion
Only in /home/yoh/deb/gits/pkg-exppsy/dcm2niix/dcm_qa/Ref: fMRI_MB_int_26.json
Only in /home/yoh/deb/gits/pkg-exppsy/dcm2niix/dcm_qa/Ref: fMRI_MB_int_26.nii

2 23018.....................................:Sat 24 Jun 2017 07:09:11 AM PDT:.
(git)hopa:~exppsy/dcm2niix/dcm_qa[master]git
$> dcm2niix --version
Chris Rorden's dcm2niiX version v1.0.20170624 (OpenJPEG build) GCC6.3.0 (64-bit Linux)
Example output filename: '/MPRAGE_1.nii'

@ningfei
Copy link
Collaborator

ningfei commented Jun 24, 2017

If you do want to use your own build of dcm2niix, please comment out Line 45-48 in SuperBuild.cmake, thus force building OpenJPEG from github and linking to it statically.
Another option would be: uninstall your local installation of libeopenjp2, which might be incompatible. Although the version you installed is probably also v2.1/v2.0...

@yarikoptic
Copy link
Collaborator Author

I want my own build of dcm2niix but not of openjpeg, which I want to use the one installed system-wide.
I have 2.1.2 version of libopenjp2.

@neurolabusc
Copy link
Owner

The compile.md provides several recipes for compiling custom variations of dcm2niix, including those with JPEG2000. Check your compiler for details on how to build with dynamic libraries relative to static builds. In general, I would highly discourage the use of JPEG2000 as a DICOM transfer syntax, and suspect it will greatly complicate archival studies. To my knowledge, dcm2niix is the only open source DICOM tool to support this transfer syntax. The only commercial tools that use this are DCMJP2K and Osirix (via its usage of DCMJP2K). Unfortunately, JPEG2000 as a standard saw little adoption, despite being somewhat better than classic JPEG. In my experience the two open source implementations were either slow, poorly documented, cumbersome (OpenJPEG) or unsuitable for high-bit depth DICOM (JASPER). Now that HEIF is here, I think that any opportunity JPEG2000 had to gain traction is long since past. Therefore, I think it is completely reasonable to compile dcm2niix without JPEG2000 support. It does provide clear feedback when it detects an offending image. For Unix users with a C compiler installed, you can compile dcm2niix by simply typing "make" in the "console" folder.

@ningfei
Copy link
Collaborator

ningfei commented Jun 24, 2017

@yarikoptic it will probably work if you use 2.1.0 version of libopenjp2. That's why I fixed the external build of the openjpeg library to a specific commit. Something is broken in newer version.
Support of JPEG2000 is somehow really troublesome. I recently got some JPEG2000 lossless DICOMs from GE machine, in which the offset tables are problematic. For another dataset with the same transfer syntax, it also failed when I tried (with different tools) to convert the DICOMs to nifti. Feels like these JPEG2000 DICOMs were produced using different standards. Besides, the API of OpenJPEG seems changing with versions. Even within the same version, there might be compatibility issue if you use the code from different commits.

@ningfei
Copy link
Collaborator

ningfei commented Jun 26, 2017

Hi @yarikoptic, confirmed that dcm2niix doesn't work with libopenjp2 if the library is built using code after this commit. Any version larger than 2.1.0 is affected. As far as I see, we can't solve this on dcm2niix side. Chris just created an issue report here. You may either install 2.1.0 version of libopenjp2 or build it on the fly when buiding dcm2niix.

neurolabusc added a commit to rordenlab/dcm2niix that referenced this issue Jul 24, 2017
Update OpenJPEG seek to work with modern versions of OpenJPEG, see uclouvain/openjpeg#962
@neurolabusc
Copy link
Owner

@yarikoptic and @ningfei - can you please test the latest master of dcm2niix. This should work with modern versions of dcm2niix. My fault entirely, I am afraid.

@ningfei
Copy link
Collaborator

ningfei commented Jul 24, 2017

@neurolabusc - tested with openjpeg v2.1.2, works now without problem!

@neurolabusc
Copy link
Owner

Great. I have tested it with Debian Linux using the current origin master 2.2.0. To use the 2.2.0 branch you need to compile with -lpthreads - I have noted this in the COMPILE.md, but perhaps something that could be incorporated into your build files. Perhaps @TheChymera can test for gentoo.

@TheChymera
Copy link

before I can test this I need to package dcm2niix.

@yarikoptic
Copy link
Collaborator Author

FWIW -- seems to work for me on my Debian box now... I will build with openjpeg support and upload to neurodebian shortly

yarikoptic added a commit to neurodebian/dcm2niix that referenced this issue Aug 30, 2017
* commit 'v1.0.20170624-8-g87d2142':
  Fix for neurolabusc/dcm_qa#5
  Fix rordenlab#116
  [Consistent stdout when generating gradient tables](rordenlab#115)
  Update CMake files.
  Update note and warning message on OpenJPEG.
  Detect images compressed to multiple fragments and warn user
  Kludges for invalid JPEG2000 files
  Fix zip working directory in .travis.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants