@@ -803,9 +803,8 @@ class DenoiseImageInputSpec(ANTSCommandInputSpec):
803
803
'as a specified-dimensional image. If not '
804
804
'specified, the program tries to infer the '
805
805
'dimensionality from the input image.' )
806
- input_image = File (exists = True , argstr = "-i %s" ,
807
- mandatory = True , desc = 'A scalar image is expected '
808
- 'as input for noise correction.' )
806
+ input_image = File (exists = True , argstr = "-i %s" , mandatory = True ,
807
+ desc = 'A scalar image is expected as input for noise correction.' )
809
808
noise_model = traits .Enum ('Gaussian' , 'Rician' , argstr = '-n %s' , usedefault = True ,
810
809
desc = ('Employ a Rician or Gaussian noise model.' ))
811
810
shrink_factor = traits .Int (default_value = 1 , usedefault = True , argstr = '-s %s' ,
@@ -814,7 +813,7 @@ class DenoiseImageInputSpec(ANTSCommandInputSpec):
814
813
'the input image can be resampled. The shrink '
815
814
'factor, specified as a single integer, describes '
816
815
'this resampling. Shrink factor = 1 is the default.' ))
817
- output_image = traits .List (traits .Str (), argstr = "-o %s... " ,
816
+ output_image = traits .List (traits .Str (), argstr = "" ,
818
817
desc = 'The output consists of the noise corrected '
819
818
'version of the input image. Optionally, one '
820
819
'can also output the estimated noise image.' )
@@ -826,6 +825,7 @@ class DenoiseImageInputSpec(ANTSCommandInputSpec):
826
825
827
826
class DenoiseImageOutputSpec (TraitedSpec ):
828
827
output_corrected_image = File (exists = True )
828
+ output_noise_image = File (exists = True )
829
829
# TODO: optional outputs - output_noise_image
830
830
831
831
@@ -839,7 +839,18 @@ class DenoiseImage(ANTSCommand):
839
839
output_spec = DenoiseImageOutputSpec
840
840
_cmd = 'DenoiseImage'
841
841
842
+ def _format_arg (self , opt , spec , val ):
843
+ if opt == 'output_image' :
844
+ if len (val ) == 1 :
845
+ retval = '-o {0}' .format (val [0 ])
846
+ elif len (val ) == 2 :
847
+ retval = '-o [{0},{1}]' .format (val [0 ], val [1 ])
848
+ return retval
849
+ return super (ANTSCommand , self )._format_arg (opt , spec , val )
850
+
842
851
def _list_outputs (self ):
843
852
outputs = self ._outputs ().get ()
844
- outputs ['output_corrected_image' ] = os .path .abspath (self .inputs .output_image )
845
- return outputs
853
+ outputs ['output_corrected_image' ] = os .path .abspath (self .inputs .output_image [0 ][0 ])
854
+ if len (self .inputs .output_image ) == 2 :
855
+ outputs ['output_noise_image' ] = os .path .abspath (self .inputs .output_image [0 ][1 ])
856
+ return outputs
0 commit comments