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

Problem using DeepLearning-based Segmentation : Skull Stripping #1368

Closed flavienalonzo closed 3 years ago

flavienalonzo commented 3 years ago

Describe the bug I have a problem while using the skull stripping model from the DeepLearning toolbox: as soon that the model is launched, I get an exit error !=0 from DeepMedic

To Reproduce Steps to reproduce the behaviour:

  1. I am using 4 MRI as data: a T1, T1Gd, T2 and T2 FLAIR from the patient W48 given in the IvyGap database (http://glioblastoma.alleninstitute.org/ish). "AX T1 MEMP" file is used as T1, "AX T1 MEMP POST ATNL" file is used as T1Gd, "AX T2 FSE" file is used as T2 and "AX T2 FLAIR" file is used as FLAIR.
  2. Import all .dcm files into CaPTk and give the modality corresponding to each file
  3. Go to the DeepLearning toolbox and click on Skull Stripping
  4. Select the existing model given in CaPTk and take a random output file
  5. Press the "confirm" button and press "ok" on the next panel
  6. DeepMedic exits immediately with the error: "DeepMedic returned with exit code !=0"

Expected behaviour I expect the algorithm to work as from the tutorial given in https://www.youtube.com/watch?v=eD9AzjJfaDQ

Screenshots

screenshot01 screenshot02 screenshot03

CaPTk Version v 1.8.1

Desktop (please complete the following information):

Additional context I have tried to do the same thing on another patient from the IvyGap database but the same error happened.

sarthakpati commented 3 years ago

Thanks for your report, @flavienalonzo!

Could you try this on the command line [ref] and post the logs from it? Thanks.

flavienalonzo commented 3 years ago

Yes, I've used the command line: C:\CaPTk_Full\1.8.1>C:\CaPTk_Full\1.8.1\bin\DeepMedic.exe - md C:\CaPTk_Full\1.8.1\data\deepMedic\saved_models\brainTumorSegmentation -i D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\12.000000-AX_T1_FSPGR_3D_PRE_ATNL-25760_AX_T1_FSPGR_3D_PRE_ATNL_19991021145852_12.nii.gz,D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\18.000000-AX_T1_FSPGR_3D_POST_STEALTH_ATNL-22931_AX_T1_FSPGR_3D_POST_STEALTH_ATNL_19991021145852_18.nii.gz,D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\6.000000-AX_T2_FRFSE-XL_2MM_STEALTH-26010_AX_T2_FRFSE-XL_2MM_STEALTH_19991021145852_6.nii.gz,D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\7.000000-AX_T2_FLAIR_3MM_STEALTH_ATNL-07776_AX_T2_FLAIR_3MM_STEALTH_ATNL_19991021145852_7.nii.gz -o D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\outputSegmentation.nii.gz

and I get the error: The origin in dimension[0] of the image_1 (D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\12.000000-AX_T1_FSPGR_3D_PRE_ATNL-25760_AX_T1_FSPGR_3D_PRE_ATNL_19991021145852_12.nii.gz) and image_2 (D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\6.000000-AX_T2_FRFSE-XL_2MM_STEALTH-26010_AX_T2_FRFSE-XL_2MM_STEALTH_19991021145852_6.nii.gz) doesn't match. The first image file 'D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\12.000000-AX_T1_FSPGR_3D_PRE_ATNL-25760_AX_T1_FSPGR_3D_PRE_ATNL_19991021145852_12.nii.gz' has different physical dimensions with 'D:\TCIA\Ivygap\IvyGap_NIfTI_format\W48\6.000000-AX_T2_FRFSE-XL_2MM_STEALTH-26010_AX_T2_FRFSE-XL_2MM_STEALTH_19991021145852_6.nii.gz', please register them before trying again.

So I understand that the problem comes from data but I don't know how to solve that issue. What should I do?

sarthakpati commented 3 years ago

please register them before trying again.

You could perform a rigid registration in CaPTk: https://cbica.github.io/CaPTk/preprocessing_reg.html

Please let me know if you run into problems. Cheers.

sarthakpati commented 3 years ago

Closing issue as it is not related with Deep Learning, as originally anticipated. Please respond to this thread for more clarifications and/or questions.

flavienalonzo commented 3 years ago

Thank you, it worked, I have been able to launch the skull stripping model on my MRIs but know I kind of feel stupid because I don't know how to save the MRIs without the skull.

screenshot

As you can see, the brain is correctly found in red but I find no file of my MRI without the skull.

I can see that I have 2 folders that have been created: logs and predictions. logs contains the text file corresponding to the skull stripping algorithm testApiSession.txt

predictions contains one folder called testApiSession that have an empty folder called features and a folder called predictions containing the files ProbMapClass0.nii.gz, ProbMapClass1.nii.gz and Segm.nii.gz. I understand that those 3 files contain the mask to decide if a part of the MRI is from the brain or not, yet I don't know how to get the 4 MRIs files, corresponding to the ones I uploaded, but with no skull.

Do you know how I can get that?

My idea is to go from the step 1:20 to the step 1:30 from this tutorial: https://www.youtube.com/watch?v=eD9AzjJfaDQ.

Thank you, Flavien Alonzo

sarthakpati commented 3 years ago

Not a problem. You can do that by going to the "drawing" tab and clicking on the "apply mask" button.

image