File Exchange

image thumbnail

Bias Field Corrected Fuzzy C-Means

version 1.1 (137 KB) by

Estimates the illumination artifact in 2D (color) and 3D CT and MRI and segments into classes.

4.66667
3 Ratings

22 Downloads

Updated

View License

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.

Comments and Ratings (14)

Awais Ashfaq

After compiling the .c files, we need to load MRI;
Where do I find MRI?

Mehdi Sharafi

Hi sir
i want to simulate FLGMM algorithm.
can you help me?

Sir according to 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 we should take log of input image data.But in this implementation we are not taking log.And also Bais image is not coming as shown in the paper.I am new to this.Can you explain a little

Xen

Xen (view profile)

...sorry, my bad. There's a description about that in the m file.

Xen

Xen (view profile)

Hello. Can someone please indicate how we get the corrected image using the produced bias field? I apologize for my ignorance, I am new to digital image processing. Thanks.

Jered Wells

Update: I recently updated my machine, and after recompiling BCFCM3D, it appears to be working fine. I do, however, think the code would benefit from some free(*) statements within the mallocf and mallocd subfunctions. Although I am not a C-professional, I am pretty sure that this poses a significant memory leak that quickly becomes problematic when dealing with large volumes.

Jered Wells

Hi. I have been having memory issues with this code. I have been segmenting large volumes (512x512x512) so I have been monitoring my RAM consumption using Windows task manager. When running the program, it slowly but steadily consumes more RAM up until about 7GB (out of 16GB). This takes only about 2 min, but then the program runs for about 10 min and finally crashes with an "Out of Memory" error when more memory clearly exists. What's worse is that MATLAB holds onto this ~6GB chunk of memory, and no manner of memory clearing or packing gets it back. I am not a mex expert, so maybe you could shed some light on this issue? Thanks in advance.

shaik gousal

can any one tell me the execution process

inri

inri (view profile)

where is the BCFCM3D file??? Could sommeone sent it ??

rekoba

rekoba (view profile)

hi i try to run the file but it gives me this error

C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: 'BCFCM3D.c' not found.

??? Error using ==> mex at 221
Unable to complete successfully.

i work in visual studio 2008 and matlab 2009 b
plz help me as soon as possible

uhm in this folder D:\bin there are
mex.pl and BCFCM2D.c and many files [all files of this application *.m, *.c]
and mexutils.pm and mexsetup.pm ecc and many .bat for example [matlab]

why it doesnt find 'BCFCM2D.c' file? there is it in folder :/

Otherwise I try mex-setup but at the end there is the same the error

Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

*ciaiaia ccccccc
The error is very clear it cannot find the file, probably you executed the MEX command from a different folder ?

Otherwise try "mex -setup" to reset your compiler settings.

D:\BIN\MEX.PL: Error: 'BCFCM2D.c' not found.

??? Error using ==> mex
Unable to complete successfully.

Error in ==> Untitled2 at 3
mex BCFCM2D.c -v;

Updates

1.1

Now uploaded also the testimage, updated the screen-shot, and gave some information about the time in 2D and 3D .

MATLAB Release
MATLAB 7.9 (R2009b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video