File Exchange

image thumbnail

Image segmentation - multiscale energy-based level sets

version 1.17 (53.3 KB) by

Segmentation using active contour without edges and multi-scale acceleration. GUI included

37 Downloads

Updated

View License

This toolbox implements an energy-based segmentation algorithm that uses
finite-difference based level set evolution. (See [1], [2]).
Multiscale control of the curve evolution is implemented -- this greatly reduces
the sensitivity to initialization as well as improves the execution speed
by factors of 10-1000 and even more([3]).

Given a segmentation problem, one can use this GUI in order to find the
proper parameters that will yield the desired partition for the class of images used.
The functions in the toolbox can be then re-used for a scripting algorithm, if desired.

NOTE:
This is not a full multigrid algorithm, the scale navigation is provided in 'manual'
mode, for "image learning". Once you get the hang of it, you can then code that
bit in. On the same line, the error is calculated and shown, but no decision is
taken, the iteration control is also left on "manual".

For details on the algorithm see the references at the end.

From the GUI one is able to:
 - load data and save intermediate states using the Load/Save menu
 - choose the segmentation parameters (Mu, Lambda+, Lambda- , dt, Nu)
 - iterate(relax) a chosen number of steps
 - prolong, restrict, redistance the level set
 - visualise the current solution
 - inspect the error (and more goodies as error function gradient, residue, etc.)
 - set various options (levelset initialization style, regularization, scale depth, #steps)

For more details on the interface and implementation see the appropriate help sections in the GUI.

References:
-----------
[1] R. J. LeVeque - "Finite Difference Methods
for Differential Equations" September, 2005
[2] T. Chan and L. Vese, "Active contours without edges"
IEEE Trans.Img.Proc., vol. 10, pp. 266–277, 2001.
[3] W. L. Briggs, V. Emden Henson, S. F. McCormick
"A Multigrid Tutorial", SIAM, Philadelphia, 2001.

Comments and Ratings (15)

Ziang Pei

muthu Kumar

tudor dima

tudor dima (view profile)

@Javier
While drawing the initial contour follow the messages in the command window.

At load time (whether from image or .mat file) keep scale depth at 0 if you want to start at the finest resolution. (I suspect you load a ~72x72 array and have kmax set at 3?)

Will look into adding capability to load an initial contour. What is in there already is the ability to save the level-set function and re-use it. (Say once you have input a complicated initialization, you don't want to go through it every time, so you can save it and load it over. However, the image data has to be of the same size.

Javier

Javier (view profile)

Hi,

another question: when I load a .mat with a double image (the variable is g0 as commented in the code) and then I press "DO Iter" I only see 9 pixels of my image. What can I do?

Thanks

Javier

Javier (view profile)

Hi,

thanks for sharing the code. I'm having troubles to create a manual initial contour. I select the option Ini. Method "draw" and then I press the button "DO Iter!" but I can't select points with the mouse. What am I doing wrong?

Another question: If I have already the initial contour as a binary mask, can I avoid the function "iniMembrane"?

Thank you very much

tudor dima

tudor dima (view profile)

Hi, Marcos,

For starters, there is a very short description under Help | Buttons.

You can try the Chan-Vese paper I referenced higher in the abstract (no. [2])

The normalization you mention is done precisely in order to decouple the parameters value from the actual image values (which could come as uint8, uint16, 0-1, or any other data).

Hi,I'm doing my final project of the degree and I haven't a lot of experience so, it's hard for me to follow so much lines of code. I was wondering if you had a paper explaining this guide: the differential equations you employed for the method or something like this. I have proved your method and I really like the results but I want to understand how the parameters affect in order to get better results.

By the way, my images are double and of 16 bits and
approx at lines 840-841 I see:
MaxGVal = max(g(:));
g = g * (255/MaxGVal);

Does it affect my intensity values? It is necessary? Thank you very much!

You warned me about blank spaces in a previous comment but I forgot it, thanks again.

tudor dima

tudor dima (view profile)

Hi, Marcos
Check if your current location (where you installed this toolbox) contains any spaces. (it happends on Windows, .../My Documents/ ...)
If this is the case try to move it to a space-less location.
If for some reason this isn't possible try this hack, until I post the new version :

Replace line 307 with cd(attData.myData.loc.ImageDir)

Hi, thanks for the answer. Now I'm trying to use images as jpg but with the button Load Image File appears immediatly the same error as I posted before, without appearing any menu to select a file. What can be the problem and then, how can I place a circle of the radius I want and where I want for an initial seed?

Thanks

tudor dima

tudor dima (view profile)

@Marcos
This box uses Matlab imread.m, I suspect you could find a Dicom reader on the exchange and either plug it in or convert your images to .jpg, .png, etc.

Be careful with blank spaces in your directory, though, the error above seems to stem from there. I am planning to allow this in a future release.

Hi, thanks for sharing your code. I have a problem loading dicom images with Load Image File. First I have run ini.m and then segm_energy_LS, what can be the problem?

??? Error using ==> cd
Too many input arguments.

Error in ==> segm_energy_LS>fLoadData at 307
    eval(['cd ' attData.myData.loc.ImageDir])
 
??? Error while evaluating uimenu Callback

Thanks very much

tudor dima

tudor dima (view profile)

@Qwuasi Moore - I am not sure I understand what you mean. The evolution rule is solved discreetly using an FD method, I suppose (and this is just a wild guess) that it would be possible to write an FEM solution. I assume you'd encounter similar issues (mainly execution speed, and the infamous convergence issues)

@Pooja
Depending on how your images look like you might want to choose your segmentation method. This one in particular is powerful when dealing with fuzzy and/or incomplete contours, low gradients, etc. (f.i. environments with noise and jitter)

Pooja

Pooja (view profile)

can I use these codes for Brain tumor segmentation?

Qwuasi Moore

Great...Is it possible to do it with FEM?

Updates

1.17

v.1.0.1 - allow saving and loading of masks and level-set functions
- improved workflow and help comments

1.15

.

1.10

1.0.0.2 - 22.04.2012
          allow spaces in image directory names
          add handy reset button (before in pull-down menu)
          better help, split by section

1.11

1.0.0.2 - 22.04.2012
          allow spaces in image directory names
          add handy reset button (before in pull-down menu)
          better help, split by section

1.8

.

1.6

can now change on the fly the scale depth kMax (before one had to reload the file)

1.4

Undersampling of the image to be segmented using splines.
Better help, fixed some window sizes.

1.1

better description

MATLAB Release
MATLAB 7.11 (R2010b)

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

» Watch video