@@ -218,7 +218,8 @@ class AllineateInputSpec(AFNICommandInputSpec):
218
218
out_file = File (
219
219
desc = 'output file from 3dAllineate' ,
220
220
argstr = '-prefix %s' ,
221
- genfile = True ,
221
+ name_template = '%s_allineate' ,
222
+ name_source = 'in_file' ,
222
223
hash_files = False ,
223
224
xor = ['allcostx' ])
224
225
out_param_file = File (
@@ -425,11 +426,11 @@ class AllineateInputSpec(AFNICommandInputSpec):
425
426
_dirs = ['X' , 'Y' , 'Z' , 'I' , 'J' , 'K' ]
426
427
nwarp_fixmot = traits .List (
427
428
traits .Enum (* _dirs ),
428
- argstr = '-nwarp_fixmot%s' ,
429
+ argstr = '-nwarp_fixmot%s... ' ,
429
430
desc = 'To fix motion along directions.' )
430
431
nwarp_fixdep = traits .List (
431
432
traits .Enum (* _dirs ),
432
- argstr = '-nwarp_fixdep%s' ,
433
+ argstr = '-nwarp_fixdep%s... ' ,
433
434
desc = 'To fix non-linear warp dependency along directions.' )
434
435
verbose = traits .Bool (
435
436
argstr = '-verb' , desc = 'Print out verbose progress reports.' )
@@ -466,50 +467,43 @@ class Allineate(AFNICommand):
466
467
'3dAllineate -source functional.nii -prefix functional_allineate.nii -1Dmatrix_apply cmatrix.mat'
467
468
>>> res = allineate.run() # doctest: +SKIP
468
469
469
- >>> from nipype.interfaces import afni
470
470
>>> allineate = afni.Allineate()
471
471
>>> allineate.inputs.in_file = 'functional.nii'
472
472
>>> allineate.inputs.reference = 'structural.nii'
473
473
>>> allineate.inputs.allcostx = 'out.allcostX.txt'
474
474
>>> allineate.cmdline
475
475
'3dAllineate -source functional.nii -base structural.nii -allcostx |& tee out.allcostX.txt'
476
476
>>> res = allineate.run() # doctest: +SKIP
477
+
478
+ >>> allineate = afni.Allineate()
479
+ >>> allineate.inputs.in_file = 'functional.nii'
480
+ >>> allineate.inputs.reference = 'structural.nii'
481
+ >>> allineate.inputs.nwarp_fixmot = ['X', 'Y']
482
+ >>> allineate.cmdline
483
+ '3dAllineate -source functional.nii -nwarp_fixmotX -nwarp_fixmotY -prefix functional_allineate -base structural.nii'
484
+ >>> res = allineate.run() # doctest: +SKIP
477
485
"""
478
486
479
487
_cmd = '3dAllineate'
480
488
input_spec = AllineateInputSpec
481
489
output_spec = AllineateOutputSpec
482
490
483
- def _format_arg (self , name , trait_spec , value ):
484
- if name == 'nwarp_fixmot' or name == 'nwarp_fixdep' :
485
- arg = ' ' .join ([trait_spec .argstr % v for v in value ])
486
- return arg
487
- return super (Allineate , self )._format_arg (name , trait_spec , value )
488
-
489
- def _gen_outfilename (self ):
490
- out_file = self .inputs .out_file
491
- if not isdefined (out_file ) and isdefined (self .inputs .in_file ) and not isdefined (self .inputs .allcostx ):
492
- out_file = op .abspath (self ._gen_fname (self .inputs .in_file ,op .dirname (self .inputs .in_file ),suffix = '_allineate' ))
493
- return out_file
494
-
495
491
def _list_outputs (self ):
496
- outputs = self .output_spec ().get ()
497
-
498
- outputs ['out_file' ] = self ._gen_outfilename ()
492
+ outputs = super (Allineate , self )._list_outputs ()
499
493
500
- if isdefined ( self .inputs .out_weight_file ) :
494
+ if self .inputs .out_weight_file :
501
495
outputs ['out_weight_file' ] = op .abspath (
502
496
self .inputs .out_weight_file )
503
497
504
- if isdefined ( self .inputs .out_matrix ) :
498
+ if self .inputs .out_matrix :
505
499
path , base , ext = split_filename (self .inputs .out_matrix )
506
500
if ext .lower () not in ['.1d' , '.1D' ]:
507
501
outputs ['out_matrix' ] = self ._gen_fname (
508
502
self .inputs .out_matrix , suffix = '.aff12.1D' )
509
503
else :
510
504
outputs ['out_matrix' ] = op .abspath (self .inputs .out_matrix )
511
505
512
- if isdefined ( self .inputs .out_param_file ) :
506
+ if self .inputs .out_param_file :
513
507
path , base , ext = split_filename (self .inputs .out_param_file )
514
508
if ext .lower () not in ['.1d' , '.1D' ]:
515
509
outputs ['out_param_file' ] = self ._gen_fname (
@@ -518,16 +512,10 @@ def _list_outputs(self):
518
512
outputs ['out_param_file' ] = op .abspath (
519
513
self .inputs .out_param_file )
520
514
521
- if isdefined (self .inputs .allcostx ):
522
- outputs ['allcostX' ] = os .path .abspath (
523
- os .path .join (os .getcwd (), self .inputs .allcostx ))
515
+ if self .inputs .allcostx :
516
+ outputs ['allcostX' ] = os .path .abspath (self .inputs .allcostx )
524
517
return outputs
525
518
526
- def _gen_filename (self , name ):
527
- if name == 'out_file' :
528
- return self ._gen_outfilename ()
529
- return None
530
-
531
519
532
520
class AutoTcorrelateInputSpec (AFNICommandInputSpec ):
533
521
in_file = File (
0 commit comments