File Exchange

image thumbnail

Intensity inhomogeneity correction

version 1.0 (6.87 MB) by

LEMS method to correct for intensity inhomogeneity of MR images



View License

Unzip all the files in a folder.
set the Matlab current dir to this folder or add it to the path.
At the matlab prompt, type LEMS1im_GUI
Follow the buttons order to perform the steps:
1) load image. Can be dicom or regular image format
2) crop. If not needed make a box emcompassing the whole image
3) Threshold. This step is necessary to identify the pixels subject to the bias field
4) Initialize bias field. The initial bias field is initialized using a 2D polynomial
5) Filter the image. Improve the performance of the correction method. Uses robust anisotropic diffusion filtering (Black et al. method). Noise scale is computed from the background identified from step 3.
6) call to the LEMS function to perform the actual correction.
7) Save results

This GUI is just a wrapper to call the LEMS function:
% BiasCorrLEMSS2D: Correct for Inhomo by local entropy minimization with splines support
% [B,x,B0] = BiasCorrLEMSS2D(I,Imask,V_mean,V_std,options,B0);
% B: Final bias filed
% x: corrected iamge (x=I/B)
% B0: Initial bias field in case it has been modified by the funciton
% I: input image (should be in [0 255])
% mask: identify the pixels subject to bias field
% V_mean: mean of the background
% V_std: std of the background
% options: structure with options. to initialize the stucture call the
% function without input argument
% option = BiasCorrLEMSS2D
% option =
% Nknots: [30 30] knot spacings in y and x direction
% NiterMax: 3 number of iteration max
% flag_display: 1 if 1, display intermediate results in a new figure
% overs: -1, if 1 pad the image to get an even number of knots
% normalize: 1, if 1 notrmalize the image
% flag_allknots: 1, if 1 optimze the knots at the image border
% GainSmooth: 0, gain to force the spline to be smooth by constraining the second derivatives
% Bgain: 0.5000, average of the bias field over the pixels with signal
% B0: Initial Bias field
% Olivier Salvado, 20-jan-04, Case Western Resrve University
% Salvado et al. IEEE TMI 25(5):539-552

For more information see the attached paper. Please cite this paper if you use this tool.

Comments and Ratings (8)

jason jiao

XiaoFang Gan

I hope the tool is useful

Seems to work well once tweaked. It won't run out-of-the-box, though.

1) Go to PolyMaskFilter.m and change if ~exist('basis') for if exist('basis') ~= 1. It's a matlab version issue.

2) After selecting the area to be cropped, you need to right click on the image and click crop. It's a little unintuitive.

3) You may need to hardcode or otherwise adapt parameter estimation, such as background std.

4) The 'manual threshold' option can only be use to give the low threshold.

After fixing these, it seems to give me a pretty good result, though I've yet to evaluate whether it will work on images universally.
Thanks for posting. Good luck to users.

Mohammad Ali Balafar

deliberately, some lines in files are deleted. It is strange provide files for use but do something to confuse people

Mohammad Ali Balafar

I got your file. I did all and run LEMS1im_GUI but option 1,2 arenot apeared

Hank Lee

I really appreciate to you for your help
I got the file and did all steps you told in readme.txt
but it did not work !!
Can you tell me what should I do to run it ??

brian coe

good stuff. works well, but i needed to touch up some of the memory consumption issues.
now for a 3D version.....

Bentlemsan Maouia

The application does not work and I do not know why. Perhaps it is a problem of matlab version. I have (R14) version

MATLAB Release
MATLAB 7.3 (R2006b)

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

» Watch video