Problem using N4BiasFieldCorrection on prostate MRI

I’m using N4BiasFieldCorrectionImageFilter from SimpleITK to adjust inhomogeneity between MR images. While the algorithm performs well on most MR images, it doesn’t perform well on some outliers. Here is an example of the outliers:

The first row are slices from an MRI before N4 correction. The second are after N4 correction.

And here is another example of normal prostate MRI:
The first image is one slice from an MRI before N4 correction. The second is after N4 correction.

The code I use is:

img = sitk.ReadImage(filename)
ori_type = img.GetPixelIDValue()
corrector = sitk.N4BiasFieldCorrectionImageFilter()
mask_image = sitk.OtsuThreshold(img, 0, 1, 200)
new_img = sitk.Cast(img, sitk.sitkFloat32)
new_img = corrector.Execute(new_img, mask_image)
new_img = sitk.Cast(new_img, ori_type)

How should I deal with the outliers?

Probably better to post this question to the ITK forum.

About prostate MRI bias field correction using N4ITK (from my PhD thesis from a decade ago) - maybe it helps:

The N4ITK method has just a few user-defined parameters. The bias full width at half maximum characterizes the Gaussian that models the bias field. The noise parameter specifies the Wiener filter that is used for the field estimation. Number of fitting levels, convergence threshold, and maximum number of iterations define the numerical optimization parameters. The shrink factor defines the degree of sub-sampling that is performed on the input image before the bias estimation to decrease the computation time.

The N4ITK method was used for image intensity inhomogeneity correction of the input images. The most important parameter of the method is the bias full width at half maximum (BWHM), which defines the Gaussian that estimates the bias field. Testing on clinical images showed that low values (<0.3) tend to keep some inhomogeneity in the image, while too high values (>0.7) tend to remove valuable signal contents from the image, therefore 0.5, the center of the correct operation range was used for all the images

1 Like