|
4 | 4 | import os
|
5 | 5 |
|
6 | 6 | from .base import ANTSCommand, ANTSCommandInputSpec
|
7 |
| -from ..base import TraitedSpec, File, traits, isdefined, InputMultiPath |
| 7 | +from ..base import TraitedSpec, File, traits, isdefined, InputMultiObject |
8 | 8 | from ...utils.filemanip import split_filename
|
9 | 9 |
|
10 | 10 |
|
@@ -52,7 +52,7 @@ class WarpTimeSeriesImageMultiTransformInputSpec(ANTSCommandInputSpec):
|
52 | 52 | use_bspline = traits.Bool(
|
53 | 53 | argstr="--use-Bspline", desc="Use 3rd order B-Spline interpolation"
|
54 | 54 | )
|
55 |
| - transformation_series = InputMultiPath( |
| 55 | + transformation_series = InputMultiObject( |
56 | 56 | File(exists=True),
|
57 | 57 | argstr="%s",
|
58 | 58 | desc="transformation file(s) to be applied",
|
@@ -204,7 +204,7 @@ class WarpImageMultiTransformInputSpec(ANTSCommandInputSpec):
|
204 | 204 | use_bspline = traits.Bool(
|
205 | 205 | argstr="--use-BSpline", desc="Use 3rd order B-Spline interpolation"
|
206 | 206 | )
|
207 |
| - transformation_series = InputMultiPath( |
| 207 | + transformation_series = InputMultiObject( |
208 | 208 | File(exists=True),
|
209 | 209 | argstr="%s",
|
210 | 210 | desc="transformation file(s) to be applied",
|
@@ -369,15 +369,14 @@ class ApplyTransformsInputSpec(ANTSCommandInputSpec):
|
369 | 369 | traits.Float(), traits.Float() # Gaussian/MultiLabel (sigma, alpha)
|
370 | 370 | ),
|
371 | 371 | )
|
372 |
| - transforms = traits.Either( |
373 |
| - InputMultiPath(File(exists=True)), |
374 |
| - "identity", |
| 372 | + transforms = InputMultiObject( |
| 373 | + traits.Either(File(exists=True), "identity"), |
375 | 374 | argstr="%s",
|
376 | 375 | mandatory=True,
|
377 | 376 | desc="transform files: will be applied in reverse order. For "
|
378 | 377 | "example, the last specified transform will be applied first.",
|
379 | 378 | )
|
380 |
| - invert_transform_flags = InputMultiPath(traits.Bool()) |
| 379 | + invert_transform_flags = InputMultiObject(traits.Bool()) |
381 | 380 | default_value = traits.Float(0.0, argstr="--default-value %g", usedefault=True)
|
382 | 381 | print_out_composite_warp_file = traits.Bool(
|
383 | 382 | False,
|
@@ -411,7 +410,7 @@ class ApplyTransforms(ANTSCommand):
|
411 | 410 | >>> at.cmdline
|
412 | 411 | 'antsApplyTransforms --default-value 0 --float 0 --input moving1.nii \
|
413 | 412 | --interpolation Linear --output moving1_trans.nii \
|
414 |
| ---reference-image fixed1.nii -t identity' |
| 413 | +--reference-image fixed1.nii --transform identity' |
415 | 414 |
|
416 | 415 | >>> at = ApplyTransforms()
|
417 | 416 | >>> at.inputs.dimension = 3
|
@@ -441,6 +440,22 @@ class ApplyTransforms(ANTSCommand):
|
441 | 440 | 'antsApplyTransforms --default-value 0 --dimensionality 3 --float 0 --input moving1.nii \
|
442 | 441 | --interpolation BSpline[ 5 ] --output deformed_moving1.nii --reference-image fixed1.nii \
|
443 | 442 | --transform [ ants_Warp.nii.gz, 0 ] --transform [ trans.mat, 0 ]'
|
| 443 | +
|
| 444 | + Identity transforms may be used as part of a chain: |
| 445 | +
|
| 446 | + >>> at2 = ApplyTransforms() |
| 447 | + >>> at2.inputs.dimension = 3 |
| 448 | + >>> at2.inputs.input_image = 'moving1.nii' |
| 449 | + >>> at2.inputs.reference_image = 'fixed1.nii' |
| 450 | + >>> at2.inputs.output_image = 'deformed_moving1.nii' |
| 451 | + >>> at2.inputs.interpolation = 'BSpline' |
| 452 | + >>> at2.inputs.interpolation_parameters = (5,) |
| 453 | + >>> at2.inputs.default_value = 0 |
| 454 | + >>> at2.inputs.transforms = ['identity', 'ants_Warp.nii.gz', 'trans.mat'] |
| 455 | + >>> at2.cmdline |
| 456 | + 'antsApplyTransforms --default-value 0 --dimensionality 3 --float 0 --input moving1.nii \ |
| 457 | +--interpolation BSpline[ 5 ] --output deformed_moving1.nii --reference-image fixed1.nii \ |
| 458 | +--transform identity --transform ants_Warp.nii.gz --transform trans.mat' |
444 | 459 | """
|
445 | 460 |
|
446 | 461 | _cmd = "antsApplyTransforms"
|
|
0 commit comments