QIICR / dcmqi

dcmqi (DICOM for Quantitative Imaging) is a free, open source C++ library for conversion between imaging research formats and the standard DICOM representation for image analysis results
https://qiicr.gitbook.io/dcmqi-guide/
BSD 3-Clause "New" or "Revised" License
228 stars 62 forks source link

error: when using dcmqi docker using segimage2itkimage #465

Closed SangHLee closed 1 year ago

SangHLee commented 1 year ago

I am trying to use segimage2itkimage command to convert segmentation file in DICOM (.dcm) to nii (.nii.gz) file format.

Here is the basic segimage2itkimage command with necessary arguments that I am using:

segimage2itkimage --inputDICOM /input_file_path/1-1.dcm --outputTYPE nii --outputDirectory /output_file_path

When running above commands in qiicr/dcmqi docker (image pulled earlier today) on Windows OS (not using wsl2 based engine) with c:\ drive file sharing under Resources in docker setting, I am getting the following errors:

segimage2itkimage: /lib64/libc.so.6: version `GLIBC_2.6' not found (required by segimage2itkimage)
segimage2itkimage: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by segimage2itkimage)
segimage2itkimage: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by segimage2itkimage)
segimage2itkimage: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by segimage2itkimage)
segimage2itkimage: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by segimage2itkimage)
segimage2itkimage: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by segimage2itkimage)
segimage2itkimage: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.3' not found (required by segimage2itkimage)
segimage2itkimage: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by segimage2itkimage)
segimage2itkimage: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by segimage2itkimage)
segimage2itkimage: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by segimage2itkimage)
segimage2itkimage: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.2' not found (required by segimage2itkimage)

Below is the docker run command that I used in powershell: docker run -v C:\Users\ABCD\Documents\input_file_path:/tmp qiicr/dcmqi segimage2itkimage --inputDICOM /tmp/1-1.dcm --outputType nii --outputDirectory /tmp

On a side note, if when I tried docker using wsl2 based engine, conversion didn't work either and no error messages were present in the wsl2 terminal (ubuntu 20.04 LTS). Below is the docker run command that I used when using wsl2 based engine in wsl2 terminal: docker run -v /home/ABCD/input_file_path:/tmp qiicr/dcmqi --inputDICOM 1-1.dcm --outputType nii --outputDirectory /tmp

Am I using the docker run commands with necessary arguments correctly?

Any help would be greatly appreciated.

p.s. when using locally installed dcmqi on wsl2 (ubuntu 20.04 LTS), segimage2itkimage worked. But I am trying to use docker for my work.

fedorov commented 1 year ago

@SangHLee thank you for the report, and sorry for the problems you are experiencing!

I am able to reproduce this issue on my linux machine. Right away, I do not have any idea what is going on. Perhaps this might be related to the change of the image used by dockcross in https://github.com/QIICR/dcmqi/commit/1dead419b38cfac65577724d038f0320ce5cfb23, but I don't know, and I don't even know how to debug this. @jcfr @thewtex maybe you have some ideas? Somehow dockcross build succeeded, tests succeeded, but the image appears to have the problem.

The only idea I have is to switch from using dockcross to use pre-built dcmqi binaries and build docker image with a Dockerfile. Since you were able to use dcmqi binaries directly, as a quick workaround you could just make your own dockerfile and build an image wrapping those binaries. But I understand it is suboptimal.

On a side note, if when I tried docker using wsl2 based engine, conversion didn't work either and no error messages were present in the wsl2 terminal (ubuntu 20.04 LTS). Below is the docker run command that I used when using wsl2 based engine in wsl2 terminal: docker run -v /home/ABCD/input_file_path:/tmp qiicr/dcmqi --inputDICOM 1-1.dcm --outputType nii --outputDirectory /tmp

No, that was not the right command. The container entry point expects you to specify the name of the command line tool that you want to run, like you did in your other example:

docker run -v /home/ABCD/input_file_path:/tmp qiicr/dcmqi segimage2itkimage --inputDICOM 1-1.dcm --outputType nii --outputDirectory /tmp

I do not have any experience with wsl2 (I don't even know what it is), so can't provide any guidance on that.

SangHLee commented 1 year ago

Thanks @fedorov for your quick reply, replicating and confirming this issue.

I am a novice docker user as well as dcmqi. I will try to get a docker container built with pre-built dcmqi binaries via Dockerfile.

As for wsl2 command in my post, I accidentally forgot to type segimage2itkimage after the docker image name (qiicr/dcmqi). So, I used the same command as your post, but didn't work either (no nii outfile created and no error messages). wsl2 is Windows Subsystem for Linux version 2 that is built into Windows OS.

fedorov commented 1 year ago

We also confirmed this docker doesn't work on any of the platforms we tried, which included ubuntu linux, mac, and windows ... :-(

jcfr commented 1 year ago

To move forward with this, I suggest we update the centos version in docker/dcmqi/Dockerfile from 5 to 7.

This will ensure the the executable build using manylinux2014-x64 and copied into the dockerimage can effectively be executed.

See https://github.com/pypa/manylinux

SangHLee commented 1 year ago

Hi @fedorov and @jcfr ,

Thank you both for looking into this issue.

I can confirm that modifying Dockerfile to have centos:7 (line 1 of Dockerfile) and adding pre-built dcmqi binary location (using dcmqi-1.2.5-linux/bin/* in line 5 of Dockerfile), then building a docker image did successfully execute the segimage2itkimage command (see below).

docker run -v /home/ABCD/input_file_path:/tmp dcmqi-centos7 segimage2itkimage --inputDICOM 1-1.dcm --outputType nii --outputDirectory /tmp

note: modified Docker image was named dcmqi-centos7. I am running docker in ubuntu 20.04 LTS on WSL2 on Windows 11 Pro with WSL2 based docker engine.

fedorov commented 1 year ago

Sorry, this was automatically closed because I linked the issue, but I definitely want you @SangHLee to confirm the issue is resolved before closing!

SangHLee commented 1 year ago

Hi @fedorov and @jcfr,

I just pull docker qiicr/dcmqi from docker hub and ran the segimage2itkimage command via docker and I can confirm that the command ran successfully!

Again, my docker environment is ubuntu 20.04 LTS in WSL2 on Windows 11 Pro using docker wsl2 based engine.

Thank you so much for getting this issue resolved quickly!

fedorov commented 1 year ago

Wonderful, thank you for confirming!

Kudos and gratitude to @jcfr for, as always, spot on and super-quick response! 🥇