@@ -205,8 +205,9 @@ class RegistrationInputSpec(ANTSCommandInputSpec):
205
205
invert_initial_moving_transform = traits .Bool (
206
206
default = False , requires = ["initial_moving_transform" ],
207
207
desc = '' , xor = ['initial_moving_transform_com' ])
208
+
208
209
initial_moving_transform_com = traits .Bool (argstr = '%s' ,
209
- xor = ['initial_moving_transform' ],
210
+ default = False , xor = ['initial_moving_transform' ],
210
211
desc = "Use center of mass for moving transform" )
211
212
metric = traits .List (traits .Enum ("CC" , "MeanSquares" , "Demons" ,
212
213
"GC" , "MI" , "Mattes" ), mandatory = True , desc = '' )
@@ -466,12 +467,20 @@ def _format_arg(self, opt, spec, val):
466
467
elif opt == 'transforms' :
467
468
return self ._formatRegistration ()
468
469
elif opt == 'initial_moving_transform' :
470
+ try :
471
+ doInvertTransform = int (self .inputs .invert_initial_moving_transform )
472
+ except :
473
+ doInvertTransform = 0 ## Just do the default behavior
469
474
return '--initial-moving-transform [ %s, %d ]' % (self .inputs .initial_moving_transform ,
470
- int ( self . inputs . invert_initial_moving_transform ) )
475
+ doInvertTransform )
471
476
elif opt == 'initial_moving_transform_com' :
477
+ try :
478
+ doCenterOfMassInit = int (self .inputs .initial_moving_transform_com )
479
+ except :
480
+ doCenterOfMassInit = 0 ## Just do the default behavior
472
481
return '--initial-moving-transform [ %s, %s, %d ]' % (self .inputs .fixed_image [0 ],
473
482
self .inputs .moving_image [0 ],
474
- int ( self . inputs . initial_moving_transform_com ) )
483
+ doCenterOfMassInit )
475
484
elif opt == 'interpolation' :
476
485
# TODO: handle multilabel, gaussian, and bspline options
477
486
return '--interpolation %s' % self .inputs .interpolation
0 commit comments