CBICA / CaPTk

Cancer Imaging Phenomics Toolkit (CaPTk) is a software platform to perform image analysis and predictive modeling tasks. Documentation: https://cbica.github.io/CaPTk
https://www.cbica.upenn.edu/captk
Other
175 stars 63 forks source link

Dicom2Nifti conversion works in GUI but not CLI #1312

Closed jvbelenky closed 3 years ago

jvbelenky commented 3 years ago

Attempting to construct niftis from dicoms; worked on a set of CT images, but none of the PET images.

Ran this input on local machine: C:\CaPTk_Full\1.8.0.Beta\bin\Utilities.exe -i Z:\Acrin_FLT\001001_4277_6688\20091113\PET_AC\IM-0005-0001.dcm -o Z:\Acrin_FLT\001001_4277_6688\Case_001001_20091113_PET_AC.nii -d2n

Received error 'Dicom Load Failed'

Running this analogous input on cluster produced a segmentation fault: /cbica/software/lab/captk/centos7/1.8.0.Beta/bin/Utilities -i ~/Acrin_FLT/001001_4277_6688/20091113/PET_AC/IM-0005-0001.dcm -o ~/Acrin_FLT/001001_4277_6688/Case_001001_20091113_PET_AC.nii -d2n

However, running d2n within the GUI worked fine. Also--is it possible to run this feature in the GUI to produce uncompressed .nii files?

sarthakpati commented 3 years ago

Hey @jvbelenky, could you provide an example image somewhere with global read access? Without this, we cannot debug this issue:

(base) patis@/cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200916.596fd79/bin>$ ./Utilities -inf -i ~belenkyv/Acrin_FLT/00
1001_4277_6688/20091113/PET_AC/IM-0005-0001.dcm
Input file '/cbica/home/belenkyv/Acrin_FLT/001001_4277_6688/20091113/PET_AC/IM-0005-0001.dcm' not found.
(base) patis@/cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200916.596fd79/bin>$ ls /cbica/home/belenkyv/Acrin_FLT/001001_4277_6688/
ls: cannot open directory /cbica/home/belenkyv/Acrin_FLT/001001_4277_6688/: Permission denied
jvbelenky commented 3 years ago

I'm not sure I have write access to anywhere that has global read access. This ACRIN-FLT project is also located in the cbica/projects directory but I currently can't log into my remote workstation to double check the full filepath.

sarthakpati commented 3 years ago

Generally, our "comp_space" is global read.

Update: In any case, could you check if this is failing with a newer build (for instance, ~patis/testing/captkMyFork_1.8.0.nonRelease.20200917.e89823b)?

sarthakpati commented 3 years ago

Regarding your second part of the question

Also--is it possible to run this feature in the GUI to produce uncompressed .nii files?

Technically, it is possible, but the size of uncompressed NIfTI files is significantly large without any advantage as all I/O libraries (ITK, Nibabel, etc.) can read directly read the compressed NIfTI files.

ashishsingh18 commented 3 years ago

@jvbelenky This might already work with the latest master. If you could try this with the binaries that @sarthakpati shared, we would know. Alternatively, if you can share the dicom data via comp-space, we can try it.

jvbelenky commented 3 years ago

I tried the new build, but I'm still getting a segmentation fault--most likely the same error as before.

I've copied the Acrin_FLT folder to my comp_space directory, so the path to the problem dicom with global read access should now be:

~/cbica/comp_space/belenkyv/Acrin_FLT/001001_4277_6688/20091113/PET_AC/IM-0005-0001.dcm

ashishsingh18 commented 3 years ago

@jvbelenky I am unable to access the data you shared in comp_space, can you check the permissions? image

jvbelenky commented 3 years ago

Okay, I just set +rwx permission for the comp_space/belenkyv/ directory--try now? Also, I thought that the new server was cubic.login, not cubic-share?

sarthakpati commented 3 years ago

@jvbelenky: I am not able to access any folder in that location:

(base) patis@/cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200630.3d40a50/bin>$ ls -lt ~belenkyv/comp_space/Acrin_FLT/001001_4277_6688
ls: cannot open directory /cbica/home/belenkyv/comp_space/Acrin_FLT/001001_4277_6688: Permission denied
sarthakpati commented 3 years ago

Hi @jvbelenky, after you changed the permissions on the folder, I was able to access it without problem and I was also able to do the conversion successfully:

(base) patis@/cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin>$ ./Utilities -i /cbica/home/belenkyv/comp_space/Acrin_FLT/001001_4277_6688/20091113/PET_AC/IM-0005-0001.dcm -o ~/testing/Acrin_FLT_001001_4277_6688_20091113_PET_AC.nii.gz -d2n
Chris Rorden's dcm2niiX version v1.0.20200331  (JP2:OpenJPEG) (JP-LS:CharLS) GCC5.5.0 (64-bit Linux)
Found 239 DICOM file(s)
Convert 239 DICOM as /cbica/home/patis/.cbicaTemp/tmp_12397177688148061436/PET_AC_PET_AC_20091113151201_2288214489 (128x128x239x1)
Compress: "/usr/bin/pigz" -b 960 -n -f -6 "/cbica/home/patis/.cbicaTemp/tmp_12397177688148061436/PET_AC_PET_AC_20091113151201_2288214489.nii"
Conversion required 1.044336 seconds (0.260000 for core code).
(base) patis@/cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin>$ ./Utilities ~/testing/Acrin_FLT_001001_4277_6688_20091113_PET_AC.nii.gz
Input file '' not found.
(base) patis@/cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin>$ ./Utilities -inf -i ~/testing/Acrin_FLT_001001_4277_6688_20091113_PET_AC.nii.gz
ITK Image information:.
Property,Value
Dimensions,3
Size,128x128x239
Total,3915776
Origin,-250.000000x246.093750x-1026.500000
Spacing,3.906250x3.906250x4.250000
Component,float
Pixel Type,scalar
Directions,[1.000000x-0.000000x0.000000;-0.000000x-1.000000x0.000000;0.000000x0.000000x1.000000]

When you mentioned that you tried the new build, could you tell me which version you had tried? For instance, this is the latest build for Windows.

ashishsingh18 commented 3 years ago

@jvbelenky I am also able to access the data now and the conversion is working fine without any errors. Can you please try with installer shared by @sarthakpati ?

jvbelenky commented 3 years ago

Using that build, I can't run that command as a bash process--I get the No such file or directory error-- and running the utilities executable directly still produces a segmentation fault.

I also can't access the link; I receive this message: {"$id":"1","innerException":null,"message":"TF400813: The user '58e32bb7-141e-4bae-af01-f29f2a6613c2\\BelenkyV@pennmedicine.upenn.edu' is not authorized to access this resource.","typeName":"Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server","typeKey":"UnauthorizedRequestException","errorCode":0,"eventId":3000}

sarthakpati commented 3 years ago

Using that build, I can't run that command as a bash process--I get the No such file or directory error

Could you please tell me the command you are trying to run?

I also can't access the link

Apologies, I thought the builds were open to download from anywhere. Check the following link:

ftp://www.nitrc.org/home/groups/captk/downloads/CaPTk_1.8.0.nonRelease.20200923.2b132ae3_Installer.exe

jvbelenky commented 3 years ago

The command I used that produced a segfault was this one: cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin/Utilities -i /cbica/home/belenkyv/comp_space/Acrin_FLT/001001_4277_6688/20091113/PET_AC/IM-0005-0001.dcm -o ~/Acrin_FLT/Acrin_FLT_001001_4277_6688_20091113_PET_AC.nii.gz -d2n

I'll try the new installer in the meantime.

sarthakpati commented 3 years ago

cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin/Utilities

It should be: /cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin/Utilities

Or ~patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin/Utilities

jvbelenky commented 3 years ago

Ok--that one worked. Thanks! Is there a particular reason that running Utilities after doing cd cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin/ would produce a segfault but passing the whole path wouldn't?

sarthakpati commented 3 years ago

Ok--that one worked. Thanks! Is there a particular reason that running Utilities after doing cd cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200922.52ae0cc/bin/ would produce a segfault but passing the whole path wouldn't?

That is because there was a missing "/" in the beginning of the full path. 😄

sarthakpati commented 3 years ago

Closing because the issue seems to be fixed. Please reopen if it comes up. :)