Skip to content

ENH: Add random seed option to ANTs registration #3463

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 3 commits into from
May 9, 2022
Merged
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
11 changes: 10 additions & 1 deletion nipype/interfaces/ants/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,11 @@ class RegistrationInputSpec(ANTSCommandInputSpec):
usedefault=True,
desc="The Lower quantile to clip image ranges",
)

random_seed = traits.Int(
argstr="--random-seed %d",
desc="Fixed seed for random number generation",
min_ver="2.3.0",
)
verbose = traits.Bool(
argstr="-v", default_value=False, usedefault=True, nohash=True
)
Expand Down Expand Up @@ -1708,6 +1712,11 @@ class RegistrationSynQuickInputSpec(ANTSCommandInputSpec):
desc="precision type (default = double)",
usedefault=True,
)
random_seed = traits.Int(
argstr="-e %d",
desc="fixed random seed",
min_ver="2.3.0",
)


class RegistrationSynQuickOutputSpec(TraitedSpec):
Expand Down
4 changes: 4 additions & 0 deletions nipype/interfaces/ants/tests/test_auto_Registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def test_Registration_inputs():
requires=["metric_weight"],
usedefault=True,
),
random_seed=dict(
argstr="--random-seed %d",
min_ver="2.3.0",
),
restore_state=dict(
argstr="--restore-state %s",
extensions=None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def test_RegistrationSynQuick_inputs():
argstr="-p %s",
usedefault=True,
),
random_seed=dict(
argstr="-e %d",
min_ver="2.3.0",
),
spline_distance=dict(
argstr="-s %d",
usedefault=True,
Expand Down