-
Notifications
You must be signed in to change notification settings - Fork 533
[FIX] coord for mrconvert #3369
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
Conversation
mrconvert crashes if -coord is float
Codecov Report
@@ Coverage Diff @@
## master #3369 +/- ##
==========================================
- Coverage 65.11% 64.84% -0.27%
==========================================
Files 307 307
Lines 40373 40364 -9
Branches 5326 5326
==========================================
- Hits 26288 26174 -114
- Misses 13014 13099 +85
- Partials 1071 1091 +20
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -560,7 +560,7 @@ class MRConvertInputSpec(MRTrix3BaseInputSpec): | |||
desc="output image", | |||
) | |||
coord = traits.List( | |||
traits.Float, | |||
traits.Int, |
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.
If previous versions allowed floats, then this change could break workflows that were written for those versions. Do you know what the history is here?
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.
@Lestropie Possibly you could shed some light here?
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.
Proposed change is correct. First input to mrconvert -coord
has always been an integer, as it selects an image axis. If a pipeline is attempting to pass a genuine floating-point number here, breaking it is IMO the best outcome.
In MRtrix3 C++ binaries, attempting to convert e.g. string "3.6" to an integer happens via operator >>
on a std::istringstream
, which simply terminates upon encountering the first incompatible character, and so would terminate at the dot point character and yield 3 in this case. Reason for the change in behaviour is that from 3.0_RC3
to 3.0.0
(specifically MRtrix3/mrtrix3#1794), an additional check is applied to ensure that the entire string is consumed in that conversion; so now attempting to convert string "3.6" to an integer will result in an Exception
being thrown (and command execution failure if not caught). This successful conversion of substrings to numerical values was causing a number of stealthy bugs, so we now forbid it.
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.
Sounds good. Thanks for the confirmation.
Summary
Fixes # .
List of changes proposed in this PR (pull-request)
mrconvert in the newest version of MRtrix3 crashes if -coord is float
Acknowledgment