@@ -219,16 +219,12 @@ class RegistrationInputSpec(ANTSCommandInputSpec):
219
219
usedefault = True , desc = 'image dimension (2 or 3)' )
220
220
fixed_image = InputMultiPath (File (exists = True ), mandatory = True ,
221
221
desc = 'image to apply transformation to (generally a coregistered functional)' )
222
- fixed_image_mask = InputMultiPath (
223
- traits .Either ('NULL' , File (exists = True )),
224
- desc = 'mask used to limit metric sampling region of the fixed image '
225
- '(Use "NULL" to omit a mask at a given stage)' )
222
+ fixed_image_mask = File (argstr = '%s' , exists = True ,
223
+ desc = 'mask used to limit metric sampling region of the fixed image' )
226
224
moving_image = InputMultiPath (File (exists = True ), mandatory = True ,
227
225
desc = 'image to apply transformation to (generally a coregistered functional)' )
228
- moving_image_mask = InputMultiPath (
229
- traits .Either ('NULL' , File (exists = True )),
230
- desc = 'mask used to limit metric sampling region of the moving image '
231
- '(Use "NULL" to omit a mask at a given stage)' )
226
+ moving_image_mask = File (requires = ['fixed_image_mask' ],
227
+ exists = True , desc = 'mask used to limit metric sampling region of the moving image' )
232
228
233
229
save_state = File (argstr = '--save-state %s' , exists = False ,
234
230
desc = 'Filename for saving the internal restorable state of the registration' )
@@ -787,20 +783,6 @@ def _format_registration(self):
787
783
if isdefined (self .inputs .restrict_deformation ):
788
784
retval .append ('--restrict-deformation %s' %
789
785
self ._format_xarray (self .inputs .restrict_deformation [ii ]))
790
- if any ((isdefined (self .inputs .fixed_image_mask ),
791
- isdefined (self .inputs .moving_image_mask ))):
792
- if isdefined (self .inputs .fixed_image_mask ):
793
- fixed_masks = filename_to_list (self .inputs .fixed_image_mask )
794
- fixed_mask = fixed_mask [ii if len (fixed_masks ) > 1 else 0 ]
795
- else :
796
- fixed_mask = 'NULL'
797
-
798
- if isdefined (self .inputs .moving_image_mask ):
799
- moving_masks = filename_to_list (self .inputs .moving_image_mask )
800
- moving_mask = moving_mask [ii if len (moving_masks ) > 1 else 0 ]
801
- else :
802
- moving_mask = 'NULL'
803
- retval .append ('--masks [ %s, %s ]' % (fixed_mask , moving_mask ))
804
786
return " " .join (retval )
805
787
806
788
def _get_outputfilenames (self , inverse = False ):
@@ -845,7 +827,13 @@ def _format_winsorize_image_intensities(self):
845
827
self .inputs .winsorize_upper_quantile )
846
828
847
829
def _format_arg (self , opt , spec , val ):
848
- if opt == 'transforms' :
830
+ if opt == 'fixed_image_mask' :
831
+ if isdefined (self .inputs .moving_image_mask ):
832
+ return '--masks [ %s, %s ]' % (self .inputs .fixed_image_mask ,
833
+ self .inputs .moving_image_mask )
834
+ else :
835
+ return '--masks %s' % self .inputs .fixed_image_mask
836
+ elif opt == 'transforms' :
849
837
return self ._format_registration ()
850
838
elif opt == 'initial_moving_transform' :
851
839
do_invert_transform = self .inputs .invert_initial_moving_transform \
0 commit comments