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
178 stars 64 forks source link

GeodesicSegmentation output file argument error #1435

Closed ShyamDesai closed 2 years ago

ShyamDesai commented 3 years ago

Describe the bug Attempting to run GeodesicSegmentation module from the command line with mask, image, and output file arguments provided. CaPTk returns error message stating "Output file extension needs to be compatible with NIfTI format. Only '.nii.gz' or '.nii' allowed".

To Reproduce Steps to reproduce the behavior:

  1. Log on to cluster (ssh -X ....)
  2. Check captk version (which captk)
  3. Navigate to directories with files (cd ../../projects/Breast_Birads4/Data/dicoms/batch1/87041714/PROC_Tomo_RC/87041714_PROC_RMLO_RC_1/)
  4. GeodesicSegmentation -i 87041714_PROC_RMLO_RC.nii.gz -m 87041714_PROC_RMLO_RC_mask.nii.gz -o output.nii.gz
  5. Error Message: Output file extension needs to be compatible with NIfTI format. Only '.nii.gz' or '.nii' allowed

Expected behavior Create a 3D NIfTI volume "output.nii.gz"

CaPTk Version /cbica/software/lab/captk/centos7/1.7.2/bin/captk

Desktop (please complete the following information):

sarthakpati commented 3 years ago

Can you try passing the full path to the output image?

ShyamDesai commented 3 years ago

Sure, I tried the following with full output path: GeodesicSegmentation -i 87041714_PROC_RMLO_RC.nii.gz -m 87041714_PROC_RMLO_RC_mask.nii.gz -o /cbica/projects/Breast_Birads4/Data/dicoms/batch1/87041714/PROC_Tomo_RC/output.nii.gz

Still got the same error. Are there any requirements for the output image file besides the extension? I simply created a regular empty file named output.nii.gz

sarthakpati commented 3 years ago

I simply created a regular empty file named output.nii.gz

Can you remove the previously created file and try again?

ShyamDesai commented 3 years ago

image I removed the file and attempted the command (picture above), same error however

sarthakpati commented 3 years ago

Thanks, will keep you posted.

ShyamDesai commented 3 years ago

@sarthakpati Just following up. Any update on what might be the issue/potential workarounds? Thanks.

sarthakpati commented 3 years ago

Tagging @AlexanderGetka-cbica for clarification.

AlexanderGetka-cbica commented 3 years ago

@ShyamDesai My apologies for the delay. The issue lies in some faulty logic within the GeodesicSegmentation tool's CLI parsing. I've identified the issue in the code which makes it impossible for the output file extension check to pass. I'll be putting a fix in for this which will be in the next release.

I'm sorry to report that no current workaround exists for this to my knowledge, at least not using the GeodesicSegmentation tool. Unfortunately that tool has not seen updates in a while.

However, the GeodesicTraining tool provided by CaPTk provides similar functionality and has been worked on more recently (the CLI seems more robust to these sorts of errors). Can you give that a try? You might need to add more than one mask label to define the rest of the image, but I guess you could remove the additional label from the output after it is generated.

AlexanderGetka-cbica commented 3 years ago

Actually @ShyamDesai can you try the latest version of CaPTk? I think 1.8.0 is available on the cluster, but I can't check at the moment. It seems the master branch already has this code fixed.

sarthakpati commented 3 years ago

I think 1.8.0 is available on the cluster

1.8.1 is available.

ShyamDesai commented 3 years ago

Actually @ShyamDesai can you try the latest version of CaPTk? I think 1.8.0 is available on the cluster, but I can't check at the moment. It seems the master branch already has this code fixed.

image Still getting a similar output on the latest CaPTk. Would it be possible to use GeodesicTraining with 1 label? We have auto-generated labels for the dataset.

AlexanderGetka-cbica commented 3 years ago

Ah, OK. I'm not sure if GeodesicTraining allows 1 label -- I know for a fact it requires two or more on the GUI. If you can manipulate the label images, you might be able to replace any integer values of 0 with any other integer label besides 1 (assuming your auto-generated labels use 1 for the region of interest).

It seems this bug was fixed in the master after the release of 1.8.1, so this fix unfortunately isn't available yet on the cluster.

waltman commented 2 years ago

I just retested the bug that Shyam reported with the 1.9.0 Alpha. It ran for over 5 minutes, but eventually finished successfully. Here's my output:

% ~/Downloads/CaPTk/1.9.0.Alpha/captk GeodesicSegmentation -i 87041714_PROC_RMLO_RC.nii.gz -m 87041714_PROC_RMLO_RC_mask.nii.gz -o /tmp/output.nii.gz
Reading inputs.
Performing Geodesic map estimation.
Performing normalization.
Writing Output File:
/tmp/output.nii.gz
Finished Successfully.

I compared output.nii.gz to the original image in ITK-SNAP. I’m not an expert at ITK-SNAP, but as far as I can tell it worked! The output showed what appears to be a small 3D tumor, and it corresponds to a region that looks like it might be an actual tumor in the original image.

AlexanderGetka-cbica commented 2 years ago

Closing this issue as it seems to have been fixed.