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?