Skip to content

ENH: Additional arguments to ANTs N4BiasFieldCorrection #3012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions nipype/interfaces/ants/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@ class N4BiasFieldCorrectionInputSpec(ANTSCommandInputSpec):
The result is that the range can "drift" from the original at each iteration.
This option rescales to the [min,max] range of the original image intensities
within the user-specified mask.""")
histogram_sharpening = traits.Tuple(
(0.15, 0.01, 200),
traits.Float, traits.Float, traits.Int,
argstr='--histogram-sharpening [%g,%g,%d]',
desc="""\
Three-values tuple of histogram sharpening parameters \
(FWHM, wienerNose, numberOfHistogramBins).
These options describe the histogram sharpening parameters, i.e. the \
deconvolution step parameters described in the original N3 algorithm.
The default values have been shown to work fairly well.""")


class N4BiasFieldCorrectionOutputSpec(TraitedSpec):
Expand Down Expand Up @@ -381,6 +391,15 @@ class N4BiasFieldCorrection(ANTSCommand):
>>> n4_4.cmdline
'N4BiasFieldCorrection -d 3 --input-image structural.nii \
--output [ structural_corrected.nii, structural_bias.nii ]'

>>> n4_5 = N4BiasFieldCorrection()
>>> n4_5.inputs.input_image = 'structural.nii'
>>> n4_5.inputs.dimension = 3
>>> n4_5.inputs.histogram_sharpening = (0.12, 0.02, 200)
>>> n4_5.cmdline
'N4BiasFieldCorrection -d 3 --histogram-sharpening [0.12,0.02,200] \
--input-image structural.nii --output structural_corrected.nii'

"""

_cmd = 'N4BiasFieldCorrection'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def test_N4BiasFieldCorrection_inputs():
nohash=True,
usedefault=True,
),
histogram_sharpening=dict(
argstr='--histogram-sharpening [%g,%g,%d]', ),
input_image=dict(
argstr='--input-image %s',
extensions=None,
Expand Down