This function segments (clusters) an image into object classes, and estimates and corrects for slow varying illumination artifacts. Estimates and corrects for bias field in 3D MRI, streak artifacts in CT, and illumination artifacts in color photos.
It's an implementation of the paper of M.N. Ahmed et. al. "A Modified Fuzzy C-Means Algorithm for Bias Field estimation and Segmentation of MRI Data" 2002, IEEE Transactions on medical imaging.
Only difference is added Gaussian regularization to the bias-field, (disable when sigma is set to zero).
See the screenshot.
The code is both available as matlab code and as c-coded mex file for speed.
For a 2D image the mex-file segmentation takes a few seconds, for a 512x512x512 volume it takes up to 1900s
Compile the c-code, and try the examples in the help
Please report bugs, successes and other helpful comment.