Skip to content

Commit b68f488

Browse files
committed
Finished TODO items in ApplyTransforms and added option to Atropos
Added interpolation_parameters, float and verbose to ApplyTransforms and added use_random_seed and verbose to Atropos
1 parent 126d0ca commit b68f488

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

nipype/interfaces/ants/resampling.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ class ApplyTransformsInputSpec(ANTSCommandInputSpec):
253253
default_value = traits.Float(0.0, argstr='--default-value %g', usedefault=True)
254254
print_out_composite_warp_file = traits.Bool(False, requires=["output_image"],
255255
desc='output a composite warp file instead of a transformed image')
256+
float = traits.Bool(argstr='--float %d', default=False, desc='Use float instead of double for computations.')
257+
# Verbose Output
258+
verbose = traits.Bool(True, argstr='--verbose %d', desc='enable verbose logging', usedefault=True)
256259

257260

258261
class ApplyTransformsOutputSpec(TraitedSpec):
@@ -279,7 +282,7 @@ class ApplyTransforms(ANTSCommand):
279282
>>> at.cmdline
280283
'antsApplyTransforms --default-value 0 --dimensionality 3 --input moving1.nii --interpolation Linear \
281284
--output deformed_moving1.nii --reference-image fixed1.nii --transform [ trans.mat, 0 ] \
282-
--transform [ ants_Warp.nii.gz, 0 ]'
285+
--transform [ ants_Warp.nii.gz, 0 ] --verbose 1'
283286
284287
>>> at1 = ApplyTransforms()
285288
>>> at1.inputs.dimension = 3
@@ -294,7 +297,7 @@ class ApplyTransforms(ANTSCommand):
294297
>>> at1.cmdline
295298
'antsApplyTransforms --default-value 0 --dimensionality 3 --input moving1.nii --interpolation BSpline[ 5 ] \
296299
--output deformed_moving1.nii --reference-image fixed1.nii --transform [ trans.mat, 0 ] \
297-
--transform [ ants_Warp.nii.gz, 0 ]'
300+
--transform [ ants_Warp.nii.gz, 0 ] --verbose 1'
298301
299302
300303
"""

nipype/interfaces/ants/segmentation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ class AtroposInputSpec(ANTSCommandInputSpec):
4444
n_iterations = traits.Int(argstr="%s")
4545
convergence_threshold = traits.Float(requires=['n_iterations'])
4646
posterior_formulation = traits.Str(argstr="%s")
47+
use_random_seed = traits.Bool(True, argstr='--use-random-seed %d', desc='use random seed value over constant',
48+
usedefault=True)
4749
use_mixture_model_proportions = traits.Bool(
4850
requires=['posterior_formulation'])
4951
out_classified_image_name = File(argstr="%s", genfile=True,
5052
hash_files=False)
5153
save_posteriors = traits.Bool()
5254
output_posteriors_name_template = traits.Str('POSTERIOR_%02d.nii.gz',
5355
usedefault=True)
56+
# Verbose Output
57+
verbose = traits.Bool(True, argstr='--verbose %d', desc='enable verbose logging', usedefault=True)
5458

5559

5660
class AtroposOutputSpec(TraitedSpec):
@@ -92,7 +96,8 @@ class Atropos(ANTSCommand):
9296
'Atropos --image-dimensionality 3 --icm [1,1] \
9397
--initialization PriorProbabilityImages[2,priors/priorProbImages%02d.nii,0.8,1e-07] --intensity-image structural.nii \
9498
--likelihood-model Gaussian --mask-image mask.nii --mrf [0.2,1x1x1] --convergence [5,1e-06] \
95-
--output [structural_labeled.nii,POSTERIOR_%02d.nii.gz] --posterior-formulation Socrates[1]'
99+
--output [structural_labeled.nii,POSTERIOR_%02d.nii.gz] --posterior-formulation Socrates[1] --use-random-seed 1 \
100+
--verbose 1'
96101
"""
97102
input_spec = AtroposInputSpec
98103
output_spec = AtroposOutputSpec

nipype/interfaces/ants/tests/test_auto_ApplyTransforms.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ def test_ApplyTransforms_inputs():
1414
environ=dict(nohash=True,
1515
usedefault=True,
1616
),
17+
float=dict(argstr='--float %d',
18+
),
1719
ignore_exception=dict(nohash=True,
1820
usedefault=True,
1921
),
@@ -46,6 +48,9 @@ def test_ApplyTransforms_inputs():
4648
transforms=dict(argstr='%s',
4749
mandatory=True,
4850
),
51+
verbose=dict(argstr='--verbose %d',
52+
usedefault=True,
53+
),
4954
)
5055
inputs = ApplyTransforms.input_spec()
5156

nipype/interfaces/ants/tests/test_auto_Atropos.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def test_Atropos_inputs():
6161
),
6262
use_mixture_model_proportions=dict(requires=['posterior_formulation'],
6363
),
64+
use_random_seed=dict(argstr='--use-random-seed %d',
65+
usedefault=True,
66+
),
67+
verbose=dict(argstr='--verbose %d',
68+
usedefault=True,
69+
),
6470
)
6571
inputs = Atropos.input_spec()
6672

0 commit comments

Comments
 (0)