Code covered by the BSD License  

Highlights from
2D fast marching algorithm

1.0

1.0 | 1 rating Rate this file 20 Downloads (last 30 days) File Size: 3.44 KB File ID: #18529

2D fast marching algorithm

by Juan Cardelino

 

30 Jan 2008 (Updated 13 Aug 2008)

computation of distance maps using fast marching

| Watch this File

File Information
Description

Compute the distance map to a set of points using the fast marching algorithm.
Solves the 2-D eikonal PDE.

MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
30 Jan 2008 w s

I tried following:

>> x = randn(100,1);
>> y = randn(100,1);
>> T = fast_marching([x y]);

??? Error using ==> sub2ind at 56
Out of range subscript.

Error in ==> fast_marching at 36
lin_ind=sub2ind(tam,punto_dato(:,1),punto_dato(:,2));

I guess it is the input that is wrong here, hence I tried

>> T = fast_marching(x, y);
??? Error using ==> fast_marching
Too many input arguments.

So what input required here? The help says:
punto_dato: column vector with 2-dimensional points.

Unfortunately I don't know how to create a column vector with 2-dimensional points.

Please provide a better help. I'll be happy to give a better review than.

01 Feb 2008 Juan Cardelino

I've corrected that. Now the expected arguments are docuemnted and with a sample. However, use only few points as input arguments. Using big random does not make any sense. At least if you want to easily understand the results.

04 Feb 2008 w s

Hi Juan,

this function provides a part of the functionality of bwdist (image processing toolbox). I think, for people that do not have the IPT this function will have some value when you do some more editing.

First, improve your help with a minimal example. E.g take your example from test_fm and include it in the help text.

Second, the help text as it stands now is wrong. The function should ask for subscripts and not for data_points. tam should be replaced by e.g. siz (see function size). The option plot is not supported in the current function. I get an error when I set three input arguments. Currently I cannot switch off the plot option and the function is extremely slow.

Third, you should run mlint since there are various warnings (e.g. memory allocation) that show that the code could be improved.

Fourth, I did not check the code properly. But there are various nested loops which may slow down calculation when the matrix domain is large. Perhaps there are ways to vectorize these loops and to improve performance of the function.
 

05 Feb 2008 igor scardanzan

the topic is hot
see also this contribution that works fine both in 2D and 3D

File Id: 6110 Average rating: 4.29
  Size: 1345 KB # of reviews: 35
  Submitted: 2004-10-24 Downloads: 5969
  Subscribers: 9
  Keywords: Fast Marching, level set, PDE, eikonal equation, front propagation, 3D

05 Feb 2008 Juan Cardelino

Thank you very much for your comments. I will take them into account and try to improve the function. What you say about IPT is true, but I wrote this function many years ago without it, Im not sure if it even existed.
Thanks again.

16 Jun 2011 ladi

How can I use this program for segmentation?

Thank you
Ladi

17 Oct 2011 Juan Cardelino

You can't use it directly for segmentation. This will only compute a distance map from a set of initial points. You need to read some papers and find out how to use that for segmentation.

Please login to add a comment or rating.
Updates
01 Feb 2008

improved the help and input arguments

01 Feb 2008

improved documentation

13 Aug 2008

corrected input arguments and changed naming conventions. corrected some mlint warnings too

Tag Activity for this File
Tag Applied By Date/Time
differential equations Juan Cardelino 22 Oct 2008 09:45:34
fast marching Juan Cardelino 22 Oct 2008 09:45:34
algorithm Juan Cardelino 22 Oct 2008 09:45:34
eikonal Juan Cardelino 22 Oct 2008 09:45:34
distance Juan Cardelino 22 Oct 2008 09:45:34
2d Juan Cardelino 22 Oct 2008 09:45:35
mathematics Juan Cardelino 22 Oct 2008 09:45:35
algorithm Sheeja Krishnan 15 Feb 2009 02:21:11

Contact us at files@mathworks.com