Skip to content

Expose --float option in ants registration #1024

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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: 2 additions & 0 deletions nipype/interfaces/ants/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ class RegistrationInputSpec(ANTSCommandInputSpec):
winsorize_lower_quantile = traits.Range(
low=0.0, high=1.0, value=0.0, argstr='%s', usedefault=True, desc="The Lower quantile to clip image ranges")

float_computations = traits.Int(argstr='--float %d', value=0, desc="Use single floating point for computations")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjmjohnson quick check here: does --float require an argument? in the past i have simply used --float as a flag. should we turn this into a Bool?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a quick look at the ANTs command line parser implementation it seems that the parser adds a default '1' if the argument following the command line option string starts with '-' and can not interpreted as a float (i.e. it is supposedly the start of the next command line option string), or if there are no arguments left.
However, one could also add "--float 0" to the command line ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gerddie - i think this can simply be:

use_float_computations = traits.Bool(argstr='--float', desc="Use single floating point for computations")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



class RegistrationOutputSpec(TraitedSpec):
forward_transforms = traits.List(
Expand Down
3 changes: 3 additions & 0 deletions nipype/interfaces/ants/tests/test_auto_Registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def test_Registration_inputs():
),
fixed_image_mask=dict(argstr='%s',
),
float_computations=dict(argstr='--float %d',
value=0,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
Expand Down