-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
-initz flag and label value correction #2641
-initz flag and label value correction #2641
Conversation
scripts/sct_label_vertebrae.py
Outdated
@@ -315,9 +315,6 @@ def main(args=None): | |||
im_label.save(fname_labelz) | |||
elif fname_initlabel: | |||
import sct_label_utils | |||
# subtract "1" to label value because due to legacy, in this code the disc C2-C3 has value "2", whereas in the | |||
# recent version of SCT it is defined as "3". Therefore, when asking the user to define a label, we point to the | |||
# new definition of labels (i.e., C2-C3 = 3). | |||
sct_label_utils.main(['-i', fname_initlabel, '-add', '-1', '-o', fname_labelz]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be consistent, if you remove the explanation you also need to remove the code that actually does the "minus one"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-I've changed sct_label_utils
for Image(fname_initlabel).save(fname_labelz)
. It seems to work fine.
-Responding to second comment. vertebral_detection in core.py
uses the precedent convention. Should I shift label value in core.py
and see what happens or shift label value in sct_label_vertebrae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-I've changed sct_label_utils for Image(fname_initlabel).save(fname_labelz). It seems to work fine.
I don't see your change. Which commit are you referring to? But regardless, my point was that you should not do this "minus one" operation anymore (for the same reason you removed the comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-Responding to second comment. vertebral_detection in core.py uses the precedent convention. Should I shift label value in core.py and see what happens or shift label value in sct_label_vertebrae
I don't know which "second comment." you are referring to (there is only one comment in this thread). If you are referring to another post in this PR, a good habit within Github is to add a hyperlink to the post you are referring to.
good question-- i guess we (incl. you) need to find out :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried running 913c04a and noticed that the labeling below the specified z value is now wrong (see image below: C4 should be followed by C5, not C6):
To reproduce:
sct_download_data -d sct_testing_data
cd sct_testing_data/t2
sct_propseg -i t2.nii.gz -c t2 -qc qc
sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -initz 34,4 -qc qc
…fered in sct_label_vertebrae just before vertebral_detection -the shift in option -initlabel has been supressed
Correction fname_labelz initialisation Co-Authored-By: Julien Cohen-Adad <jcohen@polymtl.ca>
I've tested the following options and the script works as expected (i.e. no bug introduced by this PR):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Program fails when using "initlabel" on "sct_label_vertebrae".
When "fname_labelz" takes "fname_initlabel" path, "isct_antsAppllyTransforms" does not find "labelz.nii.gz" anymore.
See error:
log-error-sct_label_vertebrae.txt
The bug occurred when user used -initz flag but not when automatically finding c2c3 disc. This is because automatic c2c3 used the precedent label value convention (label value 2).
I've updated sct_label_vertebrae to use the new label value convention (label value 3).
However I've left vertebral_detection (core.py) use the precedent convention and shiftted it's init_disc value by one (should it be done in sct_label_vertebrae?). This could have for consequence to crash other programs still using the precedent convention.
DONE:
-No change in the usage
-modification in core.py: label value is shifted by one
-flag -initz takes correct label value
-C2_C3 automatic detection now takes label value 3
-Could the modification in core.py crash other scripts?
Fixes #2608