Skip to content

Commit ff66eae

Browse files
authored
Merge pull request #3012 from nipy/enh/n4_args
ENH: Additional arguments to ANTs N4BiasFieldCorrection
2 parents 216db0d + cd227a2 commit ff66eae

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

nipype/interfaces/ants/segmentation.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,16 @@ class N4BiasFieldCorrectionInputSpec(ANTSCommandInputSpec):
317317
The result is that the range can "drift" from the original at each iteration.
318318
This option rescales to the [min,max] range of the original image intensities
319319
within the user-specified mask.""")
320+
histogram_sharpening = traits.Tuple(
321+
(0.15, 0.01, 200),
322+
traits.Float, traits.Float, traits.Int,
323+
argstr='--histogram-sharpening [%g,%g,%d]',
324+
desc="""\
325+
Three-values tuple of histogram sharpening parameters \
326+
(FWHM, wienerNose, numberOfHistogramBins).
327+
These options describe the histogram sharpening parameters, i.e. the \
328+
deconvolution step parameters described in the original N3 algorithm.
329+
The default values have been shown to work fairly well.""")
320330

321331

322332
class N4BiasFieldCorrectionOutputSpec(TraitedSpec):
@@ -381,6 +391,15 @@ class N4BiasFieldCorrection(ANTSCommand):
381391
>>> n4_4.cmdline
382392
'N4BiasFieldCorrection -d 3 --input-image structural.nii \
383393
--output [ structural_corrected.nii, structural_bias.nii ]'
394+
395+
>>> n4_5 = N4BiasFieldCorrection()
396+
>>> n4_5.inputs.input_image = 'structural.nii'
397+
>>> n4_5.inputs.dimension = 3
398+
>>> n4_5.inputs.histogram_sharpening = (0.12, 0.02, 200)
399+
>>> n4_5.cmdline
400+
'N4BiasFieldCorrection -d 3 --histogram-sharpening [0.12,0.02,200] \
401+
--input-image structural.nii --output structural_corrected.nii'
402+
384403
"""
385404

386405
_cmd = 'N4BiasFieldCorrection'

nipype/interfaces/ants/tests/test_auto_N4BiasFieldCorrection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def test_N4BiasFieldCorrection_inputs():
2525
nohash=True,
2626
usedefault=True,
2727
),
28+
histogram_sharpening=dict(
29+
argstr='--histogram-sharpening [%g,%g,%d]', ),
2830
input_image=dict(
2931
argstr='--input-image %s',
3032
extensions=None,

0 commit comments

Comments
 (0)