@@ -317,6 +317,18 @@ class N4BiasFieldCorrectionInputSpec(ANTSCommandInputSpec):
317317The result is that the range can "drift" from the original at each iteration.
318318This option rescales to the [min,max] range of the original image intensities
319319within the user-specified mask.""" )
320+ histogram_fwhm = traits .Float (
321+ 0.15 , usedefault = True ,
322+ argstr = '--histogram-sharpening %s' ,
323+ desc = 'Histogram sharpening parameter: FWHM' )
324+ histogram_wiener_noise = traits .Float (
325+ 0.01 , usedefault = True ,
326+ requires = ['histogram_fwhm' ],
327+ desc = 'Histogram sharpening parameter: Wiener noise' )
328+ histogram_bins = traits .Int (
329+ 200 , usedefault = True ,
330+ requires = ['histogram_fwhm' , 'histogram_wiener_noise' ],
331+ desc = 'Histogram sharpening parameter: number of bins' )
320332
321333
322334class N4BiasFieldCorrectionOutputSpec (TraitedSpec ):
@@ -414,6 +426,16 @@ def _format_arg(self, name, trait_spec, value):
414426 [str (elt ) for elt in value ])
415427 return trait_spec .argstr % newval
416428
429+ if name == 'histogram_fwhm' :
430+ newval = '[ %f' % value
431+ if isdefined (self .inputs .histogram_wiener_noise ):
432+ newval = '%s, %f' % (
433+ newval , self .inputs .histogram_wiener_noise )
434+ if isdefined (self .inputs .histogram_bins ):
435+ newval = '%s, %d' % (newval , self .inputs .histogram_bins )
436+ newval = '%s ]' % newval
437+ return trait_spec .argstr % newval
438+
417439 return super (N4BiasFieldCorrection , self )._format_arg (
418440 name , trait_spec , value )
419441
0 commit comments