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

[FIX] coord for mrconvert #3369

merged 1 commit into from
Oct 14, 2021

Conversation

rmukh
Copy link
Contributor

@rmukh rmukh commented Aug 21, 2021

Summary

Fixes # .

List of changes proposed in this PR (pull-request)

mrconvert in the newest version of MRtrix3 crashes if -coord is float

Acknowledgment

  • [X ] (Mandatory) I acknowledge that this contribution will be available under the Apache 2 license.

mrconvert crashes if -coord is float
@codecov
Copy link

codecov bot commented Aug 21, 2021

Codecov Report

Merging #3369 (8bf5af2) into master (7080ef9) will decrease coverage by 0.26%.
The diff coverage is n/a.

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 64.84% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
nipype/interfaces/mrtrix3/utils.py 83.00% <ø> (ø)
nipype/interfaces/r.py 45.83% <0.00%> (-37.51%) ⬇️
nipype/interfaces/nipy/base.py 80.00% <0.00%> (-20.00%) ⬇️
nipype/testing/utils.py 70.90% <0.00%> (-18.19%) ⬇️
nipype/workflows/__init__.py 88.23% <0.00%> (-11.77%) ⬇️
nipype/interfaces/freesurfer/base.py 65.32% <0.00%> (-11.30%) ⬇️
nipype/info.py 78.12% <0.00%> (-9.38%) ⬇️
nipype/pkg_info.py 75.00% <0.00%> (-6.25%) ⬇️
nipype/interfaces/fsl/base.py 77.65% <0.00%> (-3.20%) ⬇️
nipype/pipeline/plugins/legacymultiproc.py 63.23% <0.00%> (-2.46%) ⬇️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7080ef9...8bf5af2. Read the comment docs.

@@ -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.

@effigies effigies merged commit 8c2330d into nipy:master Oct 14, 2021
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.

3 participants