sct-pipeline / ukbiobank-spinalcord-csa

Measure of the averaged cross-sectional area (cord CSA) between C2 and C3 of the spinal cord with UK Biobank Brain MRI dataset.
MIT License
3 stars 1 forks source link

Check if ITK-SNAP exists, exits program if not in manual_correction.py #39

Closed sandrinebedard closed 3 years ago

sandrinebedard commented 3 years ago

Description

This PR addresses issue #38 for usage of ITK-SNAP for manual segmentations. It includes:

Linked issues

Closes #38

jcohenadad commented 3 years ago

@alexfoias can you pls test it? (i have no time)-- thx

alexfoias commented 3 years ago

Sure. I'll test it.

alexfoias commented 3 years ago

When running manual_correction.py I get an error. I followed the installation procedure for the package listed here: https://github.com/sct-pipeline/ukbiobank-spinalcord-csa#installation

[23/02/21 3:21:44] (base) alex@NeuroPoly-MacBook-Pro cli % pwd
/Users/alex/code/ukbiobank-spinalcord-csa/pipeline_ukbiobank/cli
[23/02/21 3:21:45] (base) alex@NeuroPoly-MacBook-Pro cli % python manual_correction.py
Traceback (most recent call last):
  File "manual_correction.py", line 240, in <module>
    main()
  File "manual_correction.py", line 152, in main
    parser = get_parser()
  File "manual_correction.py", line 35, in get_parser
    formatter_class=utils.SmartFormatter,
AttributeError: module 'utils' has no attribute 'SmartFormatter'

Did I do something wrong ?

sandrinebedard commented 3 years ago

Did I do something wrong ?

@alexfoias let me check! I'll get back to you!

sandrinebedard commented 3 years ago

@alexfoias So this is weird, could you check that the class SmartFormatter is actually in utils.py to start with?

alexfoias commented 3 years ago

yes it is.

sandrinebedard commented 3 years ago

@alexfoias the import of utils works import utils?

sandrinebedard commented 3 years ago

@alexfoias, I changed the import for utils.py so if you could git pull the branch and test it again! I don't really get why it doesn't find the class, I never had this problem on my compter or on Joplin. If you have any clue, feel free to give me your insights :blush:

alexfoias commented 3 years ago
[26/02/21 3:35:59] (base) alex@NeuroPoly-MacBook-Pro cli % python manual_correction.py -path-in /Volumes/temp/sebeda/segmentation_350/ukbiobank_seg/data_processed/ -config /Volumes/temp/sebeda/segmentation_350/manual_seg_test.yml 
Enter your name (Firstname Lastname). It will be used to generate a json sidecar with each corrected file: Alex Foias
In ITK-SNAP, correct the segmentation, then save it with the same name (overwrite).
ITK-SNAP not found. Please install it before using this program or check if it was added to PATH variable. Exit program.
alexfoias commented 3 years ago

After adding to path:

[26/02/21 3:36:34] (base) alex@NeuroPoly-MacBook-Pro cli % export PATH=/Applications/ITK-SNAP.app/Contents/bin:$PATH 
[26/02/21 3:47:08] (base) alex@NeuroPoly-MacBook-Pro cli % python manual_correction.py -path-in /Volumes/temp/sebeda/segmentation_350/ukbiobank_seg/data_processed/ -config /Volumes/temp/sebeda/segmentation_350/manual_seg_test.yml
Enter your name (Firstname Lastname). It will be used to generate a json sidecar with each corrected file: AF
WARNING! The file ./derivatives/labels/sub-1000394/anat/sub-1000394_T2w_seg-manual.nii.gz already exists. Would you like to overwrite it? [y/n] n
In ITK-SNAP, correct the segmentation, then save it with the same name (overwrite).
[26/02/21 3:47:25] (base) alex@NeuroPoly-MacBook-Pro cli % libpng warning: sCAL: invalid unit
libpng warning: sCAL: invalid unit
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: sCAL: invalid unit