11"""ANTs' utilities."""
22import os
33from ...utils .imagemanip import copy_header as _copy_header
4- from ..base import traits , isdefined , TraitedSpec , File , Str , InputMultiPath
4+ from ..base import traits , isdefined , TraitedSpec , File , Str , InputMultiObject
55from .base import ANTSCommandInputSpec , ANTSCommand
66
77
@@ -400,11 +400,10 @@ class AI(ANTSCommand):
400400 'antsAI -c [10,1e-06,10] -d 3 -m Mattes[structural.nii,epi.nii,32,Regular,1]
401401 -o initialization.mat -p 0 -s [20,0.12] -t Affine[0.1] -v 0'
402402
403- >>> AI(
404- ... fixed_image='structural.nii',
405- ... moving_image='epi.nii',
406- ... metric=('Mattes', 32, 'Regular', 1),
407- ... search_grid=(12, (1, 1, 1)),
403+ >>> AI(fixed_image='structural.nii',
404+ ... moving_image='epi.nii',
405+ ... metric=('Mattes', 32, 'Regular', 1),
406+ ... search_grid=(12, (1, 1, 1)),
408407 ... ).cmdline
409408 'antsAI -c [10,1e-06,10] -d 3 -m Mattes[structural.nii,epi.nii,32,Regular,1]
410409 -o initialization.mat -p 0 -s [20,0.12] -g [12.0,1x1x1] -t Affine[0.1] -v 0'
@@ -418,15 +417,11 @@ class AI(ANTSCommand):
418417 def _run_interface (self , runtime , correct_return_codes = (0 ,)):
419418 runtime = super (AI , self )._run_interface (runtime , correct_return_codes )
420419
421- setattr (
422- self ,
423- "_output" ,
424- {
425- "output_transform" : os .path .join (
426- runtime .cwd , os .path .basename (self .inputs .output_transform )
427- )
428- },
429- )
420+ self ._output = {
421+ "output_transform" : os .path .join (
422+ runtime .cwd , os .path .basename (self .inputs .output_transform )
423+ )
424+ }
430425 return runtime
431426
432427 def _format_arg (self , opt , spec , val ):
@@ -439,8 +434,7 @@ def _format_arg(self, opt, spec, val):
439434 return spec .argstr % val
440435
441436 if opt == "search_grid" :
442- val1 = "x" .join (["%g" % v for v in val [1 ]])
443- fmtval = "[%s]" % "," .join ([str (val [0 ]), val1 ])
437+ fmtval = "[%s,%s]" % (val [0 ], "x" .join ("%g" % v for v in val [1 ]))
444438 return spec .argstr % fmtval
445439
446440 if opt == "fixed_image_mask" :
0 commit comments