Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix path confusion when using manual_correction.py #43

Merged
merged 16 commits into from
Jul 14, 2023

Conversation

NathanMolinier
Copy link
Contributor

@NathanMolinier NathanMolinier commented May 18, 2023

Description

This PR addresses several issues related to path use with manual correction script

To avoid future confusions regarding the different use cases of the script manual_correction.py, this PR allows the user to directly specify:

  • the folder where images are stored using -path-img
  • the folder where labels are stored using -path-label
  • the folder where corrected labels will be stored using -path-out

Some additions to code were also done to improve robustness regarding the use of the "-manual" suffix and more, see related issues.

Related issues

#51
#47
#41
#40
#32

@NathanMolinier
Copy link
Contributor Author

The PR is not ready for merging, some testing need to be added

@valosekj valosekj marked this pull request as draft May 18, 2023 19:55
@valosekj
Copy link
Member

Thanks for this initiative!

The PR is not ready for merging, some testing need to be added

Okay, I have converted the PR to draft.

@valosekj valosekj marked this pull request as ready for review June 19, 2023 21:04
@valosekj
Copy link
Member

The PR is now ready to use! We will test it. If it works, then we will merge.

manual_correction.py Outdated Show resolved Hide resolved
manual_correction.py Outdated Show resolved Hide resolved
manual_correction.py Outdated Show resolved Hide resolved
@valosekj
Copy link
Member

valosekj commented Jun 29, 2023

Tested for creating SCI lesions from scratch. Working fine!

python manual_correction.py -config /Users/valosek/data/spineimage.ca/site_012/lesions_to_correct.yml -path-img /Users/valosek/data/spineimage.ca/site_012 -load-other-contrast acq-STIRsag_T2w

Also tested during correction of SC seg produced by sct_deepseg_sc:

python manual_correction.py -config /Users/valosek/data/spineimage.ca/site_012/sc_seg_to_correct.yml -path-img /Users/valosek/data/results/site_012_2023-06-27/data_processed -path-out /Users/valosek/data/spineimage.ca/site_012/derivatives/labels -suffix-files-seg _label-SC_mask
Enter your name (Firstname Lastname). It will be used to generate a json sidecar with each corrected file: Jan Valosek
FILES_SEG:   0%|                                                                                                                                                                             | 0/16 [00:00<?, ?file/s]
Copying: /Users/valosek/data/results/site_012_2023-06-27/data_processed/sub-hal001/anat/sub-hal001_acq-sag_T2w_label-SC_mask.nii.gz to /Users/valosek/data/spineimage.ca/site_012/derivatives/labels/sub-hal001/anat/sub-hal001_acq-sag_T2w_label-SC_mask-manual.nii.gz

manual_correction.py Outdated Show resolved Hide resolved
manual_correction.py Outdated Show resolved Hide resolved
@valosekj

This comment was marked as resolved.

@valosekj
Copy link
Member

I tested the latest commit f6af1aa with the following commands. With both, the script worked well!

Correct SC seg created using sct_run_batch located under data_processed and save them to the final git-annex dataset (specified by -path-out flag):

python manual_correction.py -config sci-paris_sc_seg_2023-07-12/qc_fail_sc.yml -path-img sci-paris_sc_seg_2023-07-12/data_processed -path-label sci-paris_sc_seg_2023-07-12/data_processed -path-out data/data.neuro.polymtl.ca/sci-paris/derivatives/labels

Add automatically generated and visually QCed SC seg (using -add-seg-only flag) to the final git-annex dataset (specified by -path-out flag):

python manual_correction.py -config sci-paris_sc_seg_2023-07-12/qc_fail_sc.yml -path-img sci-paris_sc_seg_2023-07-12/data_processed -path-label sci-paris_sc_seg_2023-07-12/data_processed -path-out data/data.neuro.polymtl.ca/sci-paris/derivatives/labels -add-seg-only

manual_correction.py Outdated Show resolved Hide resolved
manual_correction.py Outdated Show resolved Hide resolved
manual_correction.py Outdated Show resolved Hide resolved
@valosekj valosekj merged commit 3d6c194 into main Jul 14, 2023
1 check failed
@valosekj valosekj deleted the nm/clarify_path_use branch July 14, 2023 17:55
valosekj added a commit that referenced this pull request Jul 14, 2023
@valosekj
Copy link
Member

@NathanMolinier thanks a lot for this great contribution! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants