Skip to content

[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

Merged
merged 1 commit into from
Oct 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nipype/interfaces/mrtrix3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ class MRConvertInputSpec(MRTrix3BaseInputSpec):
desc="output image",
)
coord = traits.List(
traits.Float,
traits.Int,
Copy link
Member

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?

Copy link
Member

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?

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.

Copy link
Member

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.

sep=" ",
argstr="-coord %s",
desc="extract data at the specified coordinates",
Expand Down