@@ -64,24 +64,29 @@ class AllineateInputSpec(AFNICommandInputSpec):
64
64
desc = 'output file from 3dAllineate' ,
65
65
argstr = '-prefix %s' ,
66
66
position = - 2 ,
67
- name_source = '%s_allineate' ,
68
67
genfile = True )
69
68
out_param_file = File (
70
69
argstr = '-1Dparam_save %s' ,
71
- desc = 'Save the warp parameters in ASCII (.1D) format.' )
70
+ desc = 'Save the warp parameters in ASCII (.1D) format.' ,
71
+ xor = ['in_param_file' ])
72
72
in_param_file = File (
73
73
exists = True ,
74
74
argstr = '-1Dparam_apply %s' ,
75
75
desc = 'Read warp parameters from file and apply them to '
76
- 'the source dataset, and produce a new dataset' )
76
+ 'the source dataset, and produce a new dataset' ,
77
+ xor = ['out_param_file' ])
77
78
out_matrix = File (
78
79
argstr = '-1Dmatrix_save %s' ,
79
- desc = 'Save the transformation matrix for each volume.' )
80
+ desc = 'Save the transformation matrix for each volume.' ,
81
+ xor = ['in_matrix' ])
80
82
in_matrix = File (
81
83
desc = 'matrix to align input file' ,
82
84
argstr = '-1Dmatrix_apply %s' ,
83
- position = - 3 )
84
-
85
+ position = - 3 ,
86
+ xor = ['out_matrix' ])
87
+ overwrite = traits .Bool (
88
+ desc = 'overwrite output file if it already exists' ,
89
+ argstr = '-overwrite' )
85
90
_cost_funcs = [
86
91
'leastsq' , 'ls' ,
87
92
'mutualinfo' , 'mi' ,
@@ -250,8 +255,10 @@ class AllineateInputSpec(AFNICommandInputSpec):
250
255
251
256
252
257
class AllineateOutputSpec (TraitedSpec ):
253
- out_file = File (desc = 'output image file name' )
254
- matrix = File (desc = 'matrix to align input file' )
258
+ out_file = File (exists = True , desc = 'output image file name' )
259
+ out_matrix = File (exists = True , desc = 'matrix to align input file' )
260
+ out_param_file = File (exists = True , desc = 'warp parameters' )
261
+ out_weight_file = File (exists = True , desc = 'weight volume' )
255
262
256
263
257
264
class Allineate (AFNICommand ):
@@ -271,7 +278,6 @@ class Allineate(AFNICommand):
271
278
>>> allineate.cmdline # doctest: +ALLOW_UNICODE
272
279
'3dAllineate -1Dmatrix_apply cmatrix.mat -prefix functional_allineate.nii -source functional.nii'
273
280
>>> res = allineate.run() # doctest: +SKIP
274
-
275
281
"""
276
282
277
283
_cmd = '3dAllineate'
@@ -285,21 +291,23 @@ def _format_arg(self, name, trait_spec, value):
285
291
return super (Allineate , self )._format_arg (name , trait_spec , value )
286
292
287
293
def _list_outputs (self ):
288
- outputs = self .output_spec ().get ()
294
+ outputs = self ._outputs ().get ()
289
295
if not isdefined (self .inputs .out_file ):
290
- outputs ['out_file' ] = self ._gen_filename (self .inputs .in_file ,
291
- suffix = self . inputs . suffix )
296
+ outputs ['out_file' ] = self ._gen_fname (self .inputs .in_file ,
297
+ suffix = '_allineate.nii' )
292
298
else :
293
299
outputs ['out_file' ] = os .path .abspath (self .inputs .out_file )
294
300
295
301
if isdefined (self .inputs .out_matrix ):
296
- outputs ['matrix' ] = os .path .abspath (os .path .join (os .getcwd (),\
297
- self .inputs .out_matrix + '.aff12.1D' ))
302
+ outputs ['out_matrix' ] = os .path .abspath (os .path .join (os .getcwd (),
303
+ self .inputs .out_matrix +
304
+ '.aff12.1D' ))
298
305
return outputs
299
306
300
307
def _gen_filename (self , name ):
301
308
if name == 'out_file' :
302
309
return self ._list_outputs ()[name ]
310
+ return None
303
311
304
312
305
313
class AutoTcorrelateInputSpec (AFNICommandInputSpec ):
@@ -358,6 +366,7 @@ class AutoTcorrelate(AFNICommand):
358
366
'3dAutoTcorrelate -eta2 -mask mask.nii -mask_only_targets -prefix functional_similarity_matrix.1D -polort -1 functional.nii'
359
367
>>> res = corr.run() # doctest: +SKIP
360
368
"""
369
+
361
370
input_spec = AutoTcorrelateInputSpec
362
371
output_spec = AFNICommandOutputSpec
363
372
_cmd = '3dAutoTcorrelate'
0 commit comments