From SlicerWiki
Jump to: navigation, search
Home < Modules:N4ITKBiasFieldCorrection-Documentation-3.6

Return to Slicer 3.6 Documentation

Gallery of New Features

N4ITK Bias field correction

Prostate erMRI
After bias correction
Before - After subtract image
Recovered bias field

General Information

Module Type & Category

Type: CLI

Category: Filtering

Authors, Collaborators & Contact

  • Author: Nick Tustison, UPenn (algorithm and ITK implementation)
  • Author: Andriy Fedorov, BWH (Slicer integration)
  • Contact: Andriy Fedorov, fedorov at bwh dot harvard dot edu

Module Description

This module is a CLI wrapper around the N4 bias field correction algorithm, which was presented by Nick Tustison in this Insight Journal publication. This module can be used to remove field inhomogeneity artifact from the image. The module is based on the version 9 of the Insight Journal contribution, with minor changes to the processing filters to track execution progress and to fix some minor issues.


With the basic usage scenario, you only need to specify the input and output images. You can improve the performance of this module by specifying the binary mask for the region of interest in your input image. If this mask is not specified, the module will use Otsu thresholding algorithm to estimate the mask automatically.

In case you are not happy with the result of processing, you may need to experiment with the parameters described below. If you are still not satisfied with the result, you will need to study the relevant papers (see References section at the bottom of this page) and/or contact the Slicer and ITK user lists.

Use Cases, Examples

This module is especially appropriate for these use cases:

  • You observe smooth variation of the intensity over the tissue that should have intensity close to uniform
  • Your attempts to segment or register your data are not successful, and you are not sure what to do next

Examples of the module in use:

  • Correction of the bias in vervet MRI. Acquisition parameters: 3T GE scanner, single-channel dedicated RF coil (Litzcage, Doty Scientific, Columbia, SC); 3D SPGR sequence (TI 600ms, TE 3.276ms, TR 15.28ms; flip angle 15 deg; matrix 256x256; FOV 12cm; in-plane resolution 0.47 mm; slice thickness 0.5 mm).
Slice of the input test volume with apparent bias field and label outlines
Output image visually contains less inhomogeneity
Before - After subtract image
Recovered bias field
  • Example 2


There are no tutorials available at this time.

However, you can use the images that we use to test the functionality of this module, and the output it generates with the default values of the parameters to experiment with the parameters:

Slice of the input test volume with apparent bias field and label outlines
Output image visually contains less inhomogeneity
Before - After subtract image
Recovered bias field (zoom in to see the actual value in the background image)

Quick Tour of Features and Use

The N4 algorithm uses a hierarchy of bspline grids to approximate the smooth inhomogeneity field present in the image.

  • IO:
    • Input Image: image with intensity inhomogeneity
    • Mask Image: binary mask that defines the structure of your interest. If mask is not specified, the module will use internally Otsu thresholding to define this mask. Better processing results can often be obtained when a meaningful mask is defined.
    • Output Volume: result of processing.
    • Output bias field image: recovered bias field (optional)
  • N4 Parameters:
    • Number of iterations: maximum number of iterations at each level of resolution.
    • Convergence threshold: stopping criterion for the iterative bias estimation. Larger values will lead to smaller execution time.
    • BSpline grid resolution: resolution of the initial bspline grid defined as a sequence of three numbers. The actual resolution will be defined by adding the bspline order (default is 3) to the resolution in each dimension specified here. For example, 1,1,1 will result in a 4x4x4 grid of control points. This parameter may need to be adjusted based on your input image. In the multi-resolution N4 framework, the resolution of the bspline grid at subsequent iterations will be doubled. The number of resolutions is implicitly defined by Number of iterations parameter (the size of this list is the number of resolutions)
    • Spline distance: an alternative means to define the spline grid, by setting the distance between the control points. This parameter is used only if the grid resolution is not specified.
    • Shrink factor: defines how much the image should be upsampled before estimating the inhomogeneity field. Increase if you want to reduce the execution time.
  • Advanced N4 Parameters:
  • Advanced N4 Parameters: these are the parameters you probably should not touch
    • BSpline order: order of bspline used in the approximation. Larger values will lead to longer execution times, may result in overfitting and poor result.
    • Weight image: the developer of this module did not have time to study the meaning and influence of this and the rest of the advanced parameters. Please refer to the references and support mailing lists for help, if you need to change these.
    • BSpline alpha:
    • BSpline beta:
    • Histogram sharpening:
User Interface
  • Bias correction in brain MRI: It was shown that performance of bias correction for brain MRI is significantly improved when the bias estimation is limited to the brain region (see Boyes et al. in References). You might be able to achieve better results for your application if you provide a meaningful brain mask as a parameter to this module.


Notes from the Developer(s)

If you use this module in a Slicer installation compiled from source, it is very important that you compile in Release mode. The difference in performance can be as much as 10x between the Release mode and Debug mode (default mode used by Slicer build scripts). To ensure your installation uses Release mode, run the build script as follows:

Slicer3/Scripts/getbuildtest.tcl --release --clean


This is a shared library module that uses Slicer Execution Model, and therefore requires CommandLineModules to be enabled.


On the Dashboard, these tests verify that the module is working on various platforms:

Known bugs

No reported bugs.

Usability issues

Follow this link to the Slicer3 bug tracker. Please select the usability issue category when browsing or contributing.

Source code & documentation

Links to the module's source code:

Source code:

Doxygen documentation:

More Information


The development of this module was partially supported by NIH grants R01 AA016748-01 and R01 CA111288, as well as by NA-MIC, NAC, NCIGT and the Slicer community.


  • Tustison N, Gee J N4ITK: Nick's N3 ITK Implementation For MRI Bias Field Correction, The Insight Journal 2009 January-June link
  • Tustison N, Avants B, Cook P, Gee J N4ITK: Improved N3 Bias Correction with Robust B-Spline Approximation, Proc. of ISBI'10, 2010
  • Tustison NJ, Avants BB, Cook PA, Zheng Y, Egan A, Yushkevich PA, Gee JC N4ITK: Improved N3 Bias Correction, IEEE Trans Med Imag, 2010 link
  • Boyes RG, Gunter JL, Frost C, Janke AL, Yeatman T, Hill DL, Bernstein MA, Thompson PM, Weiner MW, Schuff N, Alexander GE, Killiany RJ, DeCarli C, Jack CR, Fox NC (2008) Intensity non-uniformity correction using N3 on 3-T scanners with multichannel phased array coils. NeuroImage 39:1752-62 link.