Skip to content

Commit bf25571

Browse files
committed
ENH: Add --restrict-deformation option to antsRegistration
1 parent a61e455 commit bf25571

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

nipype/interfaces/ants/registration.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,16 @@ class RegistrationInputSpec(ANTSCommandInputSpec):
354354
),
355355
)
356356
)
357+
restrict_deformation = traits.List(
358+
traits.List(traits.Enum(0, 1)),
359+
desc=("This option allows the user to restrict the optimization of "
360+
"the displacement field, translation, rigid or affine transform "
361+
"on a per-component basis. For example, if one wants to limit "
362+
"the deformation or rotation of 3-D volume to the first two "
363+
"dimensions, this is possible by specifying a weight vector of "
364+
"'1x1x0' for a deformation field or '1x1x0x1x1x0' for a rigid "
365+
"transformation. Low-dimensional restriction only works if "
366+
"there are no preceding transformations."))
357367
# Convergence flags
358368
number_of_iterations = traits.List(traits.List(traits.Int()))
359369
smoothing_sigmas = traits.List(traits.List(traits.Float()), mandatory=True)
@@ -770,6 +780,9 @@ def _format_registration(self):
770780
else:
771781
histval = self.inputs.use_histogram_matching[ii]
772782
retval.append('--use-histogram-matching %d' % histval)
783+
if isdefined(self.inputs.restrict_deformation):
784+
retval.append('--restrict-deformation %s' %
785+
self._format_xarray(self.inputs.restrict_deformation[ii]))
773786
return " ".join(retval)
774787

775788
def _get_outputfilenames(self, inverse=False):

nipype/interfaces/ants/tests/test_auto_Registration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def test_Registration_inputs():
7979
),
8080
restore_state=dict(argstr='--restore-state %s',
8181
),
82+
restrict_deformation=dict(),
8283
sampling_percentage=dict(requires=['sampling_strategy'],
8384
),
8485
sampling_percentage_item_trait=dict(),

0 commit comments

Comments
 (0)