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

Test build producing corrupt niftis from dicoms with dicom2nifti #1347

Closed jvbelenky closed 3 years ago

jvbelenky commented 3 years ago

Following instructions located here , using test build captkMyFork_1.8.0.nonRelease.20200922.52ae0cc to convert dicoms to nifti following failure of 1.8.0 beta to load PET dicoms. Using this command, C is local drive and Z is cluster drive: C:/CaPTk_Full/1.8.0.nonRelease.20200923.2b132ae3/bin/Utilities.exe -i Z:\Acrin_FLT\002005_4221_6688\20110318\e+1_3Dosem_6i28s_7Ga_AxStd_55dFOV\IM-0006-0001.dcm -o Z:\Acrin_FLT\002005_4221_6688\Case_002005_20110318_e+1_3Dosem_6i28s_7Ga_AxStd_55dFOV.nii -d2n

This build produces corrupt .niis--attempts to load with ITK-SNAP produce this error: image

Attempts to load with MATLAB produce this error Error using load_nii_hdr (line 77) File "Z:\Acrin_FLT\002005_4221_6688\Case_002005_20110318_e+1_3Dosem_6i28s_7Ga_AxStd_55dFOV.nii" is corrupted.

Seems to affect all images, but here is an example: /cbica/home/belenkyv/Acrin_FLT/002005_4221_6688/Case_002005_20110318_e+1_3Dosem_6i28s_7Ga_AxStd_55dFOV.nii

sarthakpati commented 3 years ago

Hi @jvbelenky, unfortunately, saying "Z:" corresponds to the "cluster drive" doesn't tell us anything. Please provide the actual path on the cluster in order for us to debug.

Also, can you try saving as "nii.gz"? They are the same as ".nii" files but take far less space in comparison.

sarthakpati commented 3 years ago

Assuming it is in a similar location as the previous ticket, I do not have the required permissions:

(base) patis@/cbica/home/patis/testing/captkMyFork_1.8.0/bin>$ ls /cbica/home/belenkyv/comp_space/Acrin_FLT/002005_4221_6688/20110318/
ls: cannot open directory /cbica/home/belenkyv/comp_space/Acrin_FLT/002005_4221_6688/20110318/: Permission denied
ashishsingh18 commented 3 years ago

@jvbelenky This is happening because the output nifti is compressed but the extension says '.nii' only, This confuses the other softwares such as ITK-Snap. Could you try a few things?

1) Install the latest CaPTk release 1.8 from: https://github.com/CBICA/CaPTk 2) After installing the new release try running the following command: Utilities.exe -i [path_to_a_dicom_image] -o [path_to_output_folder] -d2n

It will create a Nifti file with an auto generated name based on information in the dicom header.

or you could try renaming your existing output

Case_002005_20110318_e+1_3Dosem_6i28s_7Ga_AxStd_55dFOV.nii

to

Case_002005_20110318_e+1_3Dosem_6i28s_7Ga_AxStd_55dFOV.nii.gz

Can you let me know if this works?

jvbelenky commented 3 years ago

Okay--this seems to be resolved in 1.8.0. However, some images give this output in the nonrelease and 1.8.0 (but not the 1.8.0.Beta): Warning: Slice timing appears corrupted (range 0..0, TR=0 ms) . In what situations would this likely become a problem?

Sarthak--I'm not sure why you don't have permissions; I thought I changed the permissions for the entire folder. I've done this again just in case; the command I used was chmod -R 755 ~/Acrin_FLT/

ashishsingh18 commented 3 years ago

Okay--this seems to be resolved in 1.8.0. However, some images give this output in the nonrelease and 1.8.0 (but not the 1.8.0.Beta): Warning: Slice timing appears corrupted (range 0..0, TR=0 ms) . In what situations would this likely become a problem?

Great!! Could you point me to the dicom that gives this error?

sarthakpati commented 3 years ago

Glad to hear the new build solved your issue. I'll leave the advanced error message in the capable hands of Ashish.

jvbelenky commented 3 years ago

Ashish-- /cbica/home/belenkyv/Acrin_FLT/002005_4221_6688/20110318/e+1_3Dosem_6i28s_7Ga_AxStd_55dFOV/IM-0006-0001.dcm has this issue. You should have permission--let me know if that's not the case.

ashishsingh18 commented 3 years ago

@jvbelenky Can you check if your input dicoms are not corrupt? Are you getting the exact number of axial slices as you should? This message is coming from the internal tool that we use for dicom to nifti conversion ( dcm2niix ) . When I look at the input dicom folder you shared, it shows half the dicom files of size 1KB - this seems incorrect. The warning points to the repetition time. It could be that these fields were overwritten during anonymization or it could be an error from the modality side. These are just warnings though and you may want to check if you need this information for your computation.

jvbelenky commented 3 years ago

Gotcha, thanks so much! That's probably okay, then.

ashishsingh18 commented 3 years ago

Gotcha, thanks so much! That's probably okay, then.

Perfect!! Thank you..