Compute the distance map to a set of points using the fast marching algorithm.
Solves the 2-D eikonal PDE with constant speed T=1.
It is not very general but well suited for learning.
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.
How can I use this program for segmentation?
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.
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
Keywords: Fast Marching, level set, PDE, eikonal equation, front propagation, 3D
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.
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.
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
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.
Just added a screenshot and improved documentation.
improved the help and input arguments