Skip to content

Commit c20e1d9

Browse files
committed
Fixed doctests
1 parent cd6312b commit c20e1d9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

nipype/interfaces/ants/registration.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,21 @@ class Registration(ANTSCommand):
673673
--convergence [ 100x50x30, 1e-09, 20 ] --smoothing-sigmas 2.0x1.0x0.0vox --shrink-factors 3x2x1 \
674674
--use-estimate-learning-rate-once 1 --use-histogram-matching 1 --masks [ fixed1.nii, NULL ] \
675675
--winsorize-image-intensities [ 0.0, 1.0 ] --write-composite-transform 1'
676+
677+
>>> # Test initialization with multiple transforms matrices (e.g., unwarp and affine transform)
678+
>>> reg10 = copy.deepcopy(reg)
679+
>>> reg10.inputs.initial_moving_transform = ['func_to_struct.mat', 'ants_Warp.nii.gz']
680+
>>> reg10.inputs.invert_initial_moving_transform = [False, False]
681+
>>> reg10.cmdline # doctest: +ALLOW_UNICODE
682+
'antsRegistration --collapse-output-transforms 0 --dimensionality 3 --initial-moving-transform \
683+
[ func_to_struct.mat, 0 ] [ ants_Warp.nii.gz, 0 ] --initialize-transforms-per-stage 0 --interpolation Linear \
684+
--output [ output_, output_warped_image.nii.gz ] --transform Affine[ 2.0 ] \
685+
--metric Mattes[ fixed1.nii, moving1.nii, 1, 32, Random, 0.05 ] --convergence [ 1500x200, 1e-08, 20 ] \
686+
--smoothing-sigmas 1.0x0.0vox --shrink-factors 2x1 --use-estimate-learning-rate-once 1 --use-histogram-matching 1 \
687+
--transform SyN[ 0.25, 3.0, 0.0 ] --metric Mattes[ fixed1.nii, moving1.nii, 1, 32 ] \
688+
--convergence [ 100x50x30, 1e-09, 20 ] --smoothing-sigmas 2.0x1.0x0.0vox --shrink-factors 3x2x1 \
689+
--use-estimate-learning-rate-once 1 --use-histogram-matching 1 --winsorize-image-intensities [ 0.0, 1.0 ] \
690+
--write-composite-transform 1'
676691
"""
677692
DEF_SAMPLING_STRATEGY = 'None'
678693
"""The default sampling strategy argument."""
@@ -878,7 +893,7 @@ def _get_initial_transform_filenames(self):
878893
raise Exception(("ERROR: The useInverse list must have the same number "
879894
"of entries as the transformsFileName list."))
880895
else:
881-
retval.append("[ %s, 0 ] " % self.inputs.initial_moving_transform[ii])
896+
retval.append("[ %s, 0 ]" % self.inputs.initial_moving_transform[ii])
882897
return " ".join(retval)
883898

884899
def _format_arg(self, opt, spec, val):

0 commit comments

Comments
 (0)