@@ -205,6 +205,12 @@ class RegistrationInputSpec(ANTSCommandInputSpec):
205
205
desc = 'image to apply transformation to (generally a coregistered functional)' )
206
206
moving_image_mask = File (requires = ['fixed_image_mask' ],
207
207
exists = True , desc = 'mask used to limit metric sampling region of the moving image' )
208
+
209
+ save_state = File (argstr = '--save-state %s' , exists = False ,
210
+ desc = 'Filename for saving the internal restorable state of the registration' )
211
+ restore_state = File (argstr = '--restore-state %s' , exists = True ,
212
+ desc = 'Filename for restoring the internal restorable state of the registration' )
213
+
208
214
initial_moving_transform = File (argstr = '%s' , exists = True , desc = '' ,
209
215
xor = ['initial_moving_transform_com' ])
210
216
invert_initial_moving_transform = traits .Bool (
@@ -337,7 +343,7 @@ class RegistrationOutputSpec(TraitedSpec):
337
343
File (exists = True ), desc = 'Inverse composite transform file' )
338
344
warped_image = File (desc = "Outputs warped image" )
339
345
inverse_warped_image = File (desc = "Outputs the inverse of the warped image" )
340
-
346
+ save_state = File ( desc = "The saved registration state to be restored" )
341
347
342
348
class Registration (ANTSCommand ):
343
349
@@ -391,6 +397,8 @@ class Registration(ANTSCommand):
391
397
392
398
>>> # Test collapse transforms flag
393
399
>>> reg4 = copy.deepcopy(reg)
400
+ >>> reg.inputs.save_state = 'trans.mat'
401
+ >>> reg.inputs.restore_state = 'trans.mat'
394
402
>>> reg4.inputs.collapse_output_transforms = True
395
403
>>> outputs = reg4._list_outputs()
396
404
>>> print outputs #doctest: +ELLIPSIS
@@ -756,4 +764,6 @@ def _list_outputs(self):
756
764
outputs ['warped_image' ] = os .path .abspath (out_filename )
757
765
if inv_out_filename :
758
766
outputs ['inverse_warped_image' ] = os .path .abspath (inv_out_filename )
767
+ if len (self .inputs .save_state ):
768
+ outputs ['save_state' ] = os .path .abspath (self .inputs .save_state )
759
769
return outputs
0 commit comments