@@ -2382,13 +2382,38 @@ def _list_outputs(self):
23822382class ConcatenateLTAInputSpec (FSTraitedSpec ):
23832383 # required
23842384 in_lta1 = File (exists = True , mandatory = True , argstr = '%s' , position = - 3 ,
2385- desc = "maps some src1 to dst1" )
2386- in_lta2 = File (exists = True , mandatory = True , argstr = '%s' , position = - 2 ,
2387- desc = "maps dst1(src2) to dst2" )
2388- out_file = File (exists = False , position = - 1 , argstr = '%s' ,
2389- name_source = ['in_lta1' ], name_template = '%s-long' ,
2390- hash_files = False , keep_extension = True ,
2391- desc = "the combined LTA maps: src1 to dst2 = LTA2*LTA1" )
2385+ desc = 'maps some src1 to dst1' )
2386+ in_lta2 = traits .Either (
2387+ File (exists = True ), 'identity.nofile' , argstr = '%s' , position = - 2 ,
2388+ mandatory = True , desc = 'maps dst1(src2) to dst2' )
2389+ out_file = File (
2390+ 'concat.lta' , usedefault = True , position = - 1 , argstr = '%s' ,
2391+ hash_files = False ,
2392+ desc = 'the combined LTA maps: src1 to dst2 = LTA2*LTA1' )
2393+
2394+ # Inversion and transform type
2395+ invert_1 = traits .Bool (argstr = '-invert1' ,
2396+ desc = 'invert in_lta1 before applying it' )
2397+ invert_2 = traits .Bool (argstr = '-invert2' ,
2398+ desc = 'invert in_lta2 before applying it' )
2399+ invert_out = traits .Bool (argstr = '-invertout' ,
2400+ desc = 'invert output LTA' )
2401+ out_type = traits .Enum ('VOX2VOX' , 'RAS2RAS' , argstr = '-out_type %d' ,
2402+ desc = 'set final LTA type' )
2403+
2404+ # Talairach options
2405+ tal_source_file = traits .File (
2406+ exists = True , argstr = '-tal %s' , position = - 5 ,
2407+ requires = ['tal_template_file' ],
2408+ desc = 'if in_lta2 is talairach.xfm, specify source for talairach' )
2409+ tal_template_file = traits .File (
2410+ exists = True , argstr = '%s' , position = - 4 , requires = ['tal_source_file' ],
2411+ desc = 'if in_lta2 is talairach.xfm, specify template for talairach' )
2412+
2413+ subject = traits .Str (argstr = '-subject %s' ,
2414+ desc = 'set subject in output LTA' )
2415+ # Note rmsdiff would be xor out_file, and would be most easily dealt with
2416+ # in a new interface. -CJM 2017.10.05
23922417
23932418
23942419class ConcatenateLTAOutputSpec (TraitedSpec ):
@@ -2397,23 +2422,44 @@ class ConcatenateLTAOutputSpec(TraitedSpec):
23972422
23982423
23992424class ConcatenateLTA (FSCommand ):
2400- """concatenates two consecutive LTA transformations
2401- into one overall transformation, Out = LTA2*LTA1
2425+ """ Concatenates two consecutive LTA transformations into one overall
2426+ transformation
2427+
2428+ Out = LTA2*LTA1
24022429
24032430 Examples
24042431 --------
24052432 >>> from nipype.interfaces.freesurfer import ConcatenateLTA
24062433 >>> conc_lta = ConcatenateLTA()
2407- >>> conc_lta.inputs.in_lta1 = 'trans.mat'
2408- >>> conc_lta.inputs.in_lta2 = 'trans.mat'
2434+ >>> conc_lta.inputs.in_lta1 = 'lta1.lta'
2435+ >>> conc_lta.inputs.in_lta2 = 'lta2.lta'
2436+ >>> conc_lta.cmdline # doctest: +ALLOW_UNICODE
2437+ 'mri_concatenate_lta lta1.lta lta2.lta concat.lta'
2438+
2439+ You can use 'identity.nofile' as the filename for in_lta2, e.g.:
2440+
2441+ >>> conc_lta.inputs.in_lta2 = 'identity.nofile'
2442+ >>> conc_lta.inputs.invert_1 = True
2443+ >>> conc_lta.inputs.out_file = 'inv1.lta'
24092444 >>> conc_lta.cmdline # doctest: +ALLOW_UNICODE
2410- 'mri_concatenate_lta trans.mat trans.mat trans-long.mat'
2445+ 'mri_concatenate_lta -invert1 lta1.lta identity.nofile inv1.lta'
2446+
2447+ To create a RAS2RAS transform:
2448+
2449+ >>> conc_lta.inputs.out_type = 'RAS2RAS'
2450+ >>> conc_lta.cmdline # doctest: +ALLOW_UNICODE
2451+ 'mri_concatenate_lta -invert1 -out_type 1 lta1.lta identity.nofile inv1.lta'
24112452 """
24122453
24132454 _cmd = 'mri_concatenate_lta'
24142455 input_spec = ConcatenateLTAInputSpec
24152456 output_spec = ConcatenateLTAOutputSpec
24162457
2458+ def _format_arg (self , name , spec , value ):
2459+ if name == 'out_type' :
2460+ value = {'VOX2VOX' : 0 , 'RAS2RAS' : 1 }[value ]
2461+ return super (ConcatenateLTA , self )._format_arg (name , spec , value )
2462+
24172463 def _list_outputs (self ):
24182464 outputs = self .output_spec ().get ()
24192465 outputs ['out_file' ] = os .path .abspath (self .inputs .out_file )
0 commit comments