From e2b7047b8589e0fe3aa668741d46fa6bf9a2b0d9 Mon Sep 17 00:00:00 2001 From: Ghislain Vaillant Date: Sat, 7 May 2022 12:29:23 +0200 Subject: [PATCH 1/3] ENH: Add random seed option to ANTs registration --- nipype/interfaces/ants/registration.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index 7ab6b30c30..7f66646a61 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -585,7 +585,10 @@ 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", + ) verbose = traits.Bool( argstr="-v", default_value=False, usedefault=True, nohash=True ) @@ -1708,6 +1711,10 @@ class RegistrationSynQuickInputSpec(ANTSCommandInputSpec): desc="precision type (default = double)", usedefault=True, ) + random_seed = traits.Int( + argstr="-e %d", + desc="fixed random seed", + ) class RegistrationSynQuickOutputSpec(TraitedSpec): From 22a8a150fa92b253f18a0c9be792d1031a635541 Mon Sep 17 00:00:00 2001 From: Ghislain Vaillant Date: Mon, 9 May 2022 11:18:09 +0200 Subject: [PATCH 2/3] FIX: add minimum version to random seed option --- nipype/interfaces/ants/registration.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index 7f66646a61..478b26dc36 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -588,6 +588,7 @@ class RegistrationInputSpec(ANTSCommandInputSpec): 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 @@ -1714,6 +1715,7 @@ class RegistrationSynQuickInputSpec(ANTSCommandInputSpec): random_seed = traits.Int( argstr="-e %d", desc="fixed random seed", + min_ver="2.3.0", ) From 77b3da1d520c2a724e0a496c930454e29ed0abe9 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 9 May 2022 10:08:58 -0400 Subject: [PATCH 3/3] TEST: make specs --- nipype/interfaces/ants/tests/test_auto_Registration.py | 4 ++++ .../interfaces/ants/tests/test_auto_RegistrationSynQuick.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/nipype/interfaces/ants/tests/test_auto_Registration.py b/nipype/interfaces/ants/tests/test_auto_Registration.py index 507e0effe2..814948835c 100644 --- a/nipype/interfaces/ants/tests/test_auto_Registration.py +++ b/nipype/interfaces/ants/tests/test_auto_Registration.py @@ -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, diff --git a/nipype/interfaces/ants/tests/test_auto_RegistrationSynQuick.py b/nipype/interfaces/ants/tests/test_auto_RegistrationSynQuick.py index c09f08d17a..c799f47299 100644 --- a/nipype/interfaces/ants/tests/test_auto_RegistrationSynQuick.py +++ b/nipype/interfaces/ants/tests/test_auto_RegistrationSynQuick.py @@ -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,