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
173 stars 63 forks source link

improve error messages: distinguish permission from file-not-found #1506

Open rmsppu opened 1 year ago

rmsppu commented 1 year ago

Describe the bug When an unreadable input file is specified, the error message returned could be more helpful. The error message is that that the file wasn't found, which is true in the sense that the contents of the parent directory are unreadable, but "file not found" can be distinguished from "some component in the path has permissions that prevents reading the file (if it even exists)".

To Reproduce

  1. Confirm that a valid DICOM exists but is unreadable due to permissions:
    /path/to/an/unreadable/file/DET0001_03.dcm: DICOM medical imaging data
    $ ls -l /path/to/an/unreadable/file/DET0001_03.dcm
    ls: cannot access /path/to/an/unreadable/file/DET0001_03.dcm: Permission denied
  2. Run CaPTk, specifying the unreadable file as input: BreastTexturePipeline -i /path/to/an/unreadable/file/DET0001_03.dcm -o unc_test/ -d 1 Starting pre-processing. [getFilenameExtension()] Supplied file name '/path/to/an/unreadable/file/DET0001_03.dcm' wasn't found.

Preferred behavior The error message should distinguish various cases, such as:

CaPTk Version Linux, 1.9.0