11
11
12
12
import os
13
13
14
- from ..base import ( TraitedSpec , File , traits , isdefined , InputMultiPath )
14
+ from ..base import TraitedSpec , File , traits , InputMultiPath
15
15
from .base import ANTSCommand , ANTSCommandInputSpec
16
16
17
17
@@ -57,12 +57,16 @@ def _list_outputs(self):
57
57
class AverageImagesInputSpec (ANTSCommandInputSpec ):
58
58
dimension = traits .Enum (3 , 2 , argstr = '%d' , mandatory = True ,
59
59
position = 0 , desc = 'image dimension (2 or 3)' )
60
- output_average_image = File ("average.nii" , argstr = '%s' , position = 1 , desc = 'the name of the resulting image.' ,
61
- usedefault = True , hash_files = False )
62
- normalize = traits .Bool (argstr = "%d" , mandatory = True , position = 2 , desc = 'Normalize: if true, the 2nd image' +
63
- 'is divided by its mean. This will select the largest image to average into.' )
64
- images = InputMultiPath (File (exists = True ), argstr = '%s' , mandatory = True , position = 3 ,
65
- desc = 'image to apply transformation to (generally a coregistered functional)' )
60
+ output_average_image = File (
61
+ "average.nii" , argstr = '%s' , position = 1 , usedefault = True , hash_files = False ,
62
+ desc = 'the name of the resulting image.' )
63
+ normalize = traits .Bool (
64
+ argstr = "%d" , mandatory = True , position = 2 ,
65
+ desc = 'Normalize: if true, the 2nd image is divided by its mean. '
66
+ 'This will select the largest image to average into.' )
67
+ images = InputMultiPath (
68
+ File (exists = True ), argstr = '%s' , mandatory = True , position = 3 ,
69
+ desc = 'image to apply transformation to (generally a coregistered functional)' )
66
70
67
71
68
72
class AverageImagesOutputSpec (TraitedSpec ):
@@ -101,8 +105,9 @@ class MultiplyImagesInputSpec(ANTSCommandInputSpec):
101
105
desc = 'image dimension (2 or 3)' )
102
106
first_input = File (argstr = '%s' , exists = True ,
103
107
mandatory = True , position = 1 , desc = 'image 1' )
104
- second_input = traits .Either (File (exists = True ), traits .Float , argstr = '%s' , mandatory = True , position = 2 ,
105
- desc = 'image 2 or multiplication weight' )
108
+ second_input = traits .Either (
109
+ File (exists = True ), traits .Float , argstr = '%s' , mandatory = True , position = 2 ,
110
+ desc = 'image 2 or multiplication weight' )
106
111
output_product_image = File (argstr = '%s' , mandatory = True , position = 3 ,
107
112
desc = 'Outputfname.nii.gz: the name of the resulting image.' )
108
113
@@ -231,12 +236,12 @@ def _list_outputs(self):
231
236
232
237
233
238
class ComposeMultiTransformInputSpec (ANTSCommandInputSpec ):
234
- dimension = traits .Enum (3 , 2 , argstr = '%d' , usedefault = True , mandatory = True ,
235
- position = 0 , desc = 'image dimension (2 or 3)' )
236
- output_transform = File (argstr = '%s' , mandatory = True , position = 1 ,
237
- name_source = [ 'transforms' ], name_template = '%s_composed' ,
239
+ dimension = traits .Enum (3 , 2 , argstr = '%d' , usedefault = True , position = 0 ,
240
+ desc = 'image dimension (2 or 3)' )
241
+ output_transform = File (argstr = '%s' , position = 1 , name_source = [ 'transforms' ] ,
242
+ name_template = '%s_composed' , keep_ext = True ,
238
243
desc = 'the name of the resulting transform.' )
239
- reference_image = File (argstr = '%s' , mandatory = False , position = 2 ,
244
+ reference_image = File (argstr = '%s' , position = 2 ,
240
245
desc = 'Reference image (only necessary when output is warpfield)' )
241
246
transforms = InputMultiPath (File (exists = True ), argstr = '%s' , mandatory = True ,
242
247
position = 3 , desc = 'transforms to average' )
@@ -245,6 +250,7 @@ class ComposeMultiTransformInputSpec(ANTSCommandInputSpec):
245
250
class ComposeMultiTransformOutputSpec (TraitedSpec ):
246
251
output_transform = File (exists = True , desc = 'Composed transform file' )
247
252
253
+
248
254
class ComposeMultiTransform (ANTSCommand ):
249
255
"""
250
256
Take a set of transformations and convert them to a single transformation matrix/warpfield.
@@ -255,13 +261,10 @@ class ComposeMultiTransform(ANTSCommand):
255
261
>>> compose_transform = ComposeMultiTransform()
256
262
>>> compose_transform.inputs.dimension = 3
257
263
>>> compose_transform.inputs.transforms = ['struct_to_template.mat', 'func_to_struct.mat']
258
- >>> compose_transform.inputs.output_transform = 'func_to_template.mat'
259
264
>>> compose_transform.cmdline # doctest: +ALLOW_UNICODE
260
- 'ComposeMultiTransform 3 func_to_template.mat struct_to_template.mat func_to_struct.mat'
265
+ 'ComposeMultiTransform 3 struct_to_template_composed struct_to_template.mat func_to_struct.mat'
266
+
261
267
"""
262
268
_cmd = 'ComposeMultiTransform'
263
269
input_spec = ComposeMultiTransformInputSpec
264
270
output_spec = ComposeMultiTransformOutputSpec
265
-
266
- def _format_arg (self , opt , spec , val ):
267
- return super (ComposeMultiTransform , self )._format_arg (opt , spec , val )
0 commit comments