Basic snake, using dynamic programming to update. More...
#include <mfpf_dp_snake.h>
Public Member Functions | |
mfpf_dp_snake () | |
Dflt ctor. | |
virtual | ~mfpf_dp_snake () |
Destructor. | |
void | set_to_circle (const mfpf_point_finder &finder, unsigned n_points, const vgl_point_2d< double > ¢re, double r) |
Initialise as a circle of given radius about the given centre. | |
unsigned | size () const |
Number of points. | |
mfpf_point_finder & | finder () |
Finder used to search for good points along profiles. | |
const vcl_vector< vgl_point_2d < double > > & | points () const |
Current set of boundary points (a closed curve). | |
double | update_step (const vimt_image_2d_of< float > &image) |
Perform one iteration of snake search algorithm. | |
void | search (const vimt_image_2d_of< float > &image) |
Search image (running iterations until convergence). | |
void | smooth_curve () |
Replace each point with the average of it and its neighbours. | |
vgl_point_2d< double > | cog () const |
Centre of gravity of points. | |
double | mean_radius () const |
Mean distance of points to cog(). | |
void | radius_stats (double &mean, double &sd) const |
Compute mean and sd of distance to cog(). | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual void | print_summary (vcl_ostream &os) const |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
Protected Member Functions | |
void | smooth_curve (vcl_vector< vgl_point_2d< double > > &src_pts, vcl_vector< vgl_point_2d< double > > &dest_pts) |
Compute the average of each point and its neighbours. | |
Protected Attributes | |
unsigned | max_its_ |
Maximum number of iterations to use during search. | |
mbl_cloneable_ptr < mfpf_point_finder > | finder_ |
Finder used to search for good points along profiles. | |
vcl_vector< vgl_point_2d < double > > | pts_ |
Current set of boundary points (a closed curve). |
Basic snake, using dynamic programming to update.
Contains a single mfpf_point_finder, which is used to locate all candidate points along a profile.
Definition at line 16 of file mfpf_dp_snake.h.
mfpf_dp_snake::mfpf_dp_snake | ( | ) |
Dflt ctor.
Definition at line 24 of file mfpf_dp_snake.cxx.
mfpf_dp_snake::~mfpf_dp_snake | ( | ) | [virtual] |
Destructor.
Definition at line 34 of file mfpf_dp_snake.cxx.
void mfpf_dp_snake::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Definition at line 253 of file mfpf_dp_snake.cxx.
void mfpf_dp_snake::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Definition at line 241 of file mfpf_dp_snake.cxx.
vgl_point_2d< double > mfpf_dp_snake::cog | ( | ) | const |
Centre of gravity of points.
Definition at line 160 of file mfpf_dp_snake.cxx.
mfpf_point_finder & mfpf_dp_snake::finder | ( | ) |
Finder used to search for good points along profiles.
Definition at line 39 of file mfpf_dp_snake.cxx.
vcl_string mfpf_dp_snake::is_a | ( | ) | const [virtual] |
Name of the class.
Definition at line 216 of file mfpf_dp_snake.cxx.
double mfpf_dp_snake::mean_radius | ( | ) | const |
Mean distance of points to cog().
Definition at line 175 of file mfpf_dp_snake.cxx.
const vcl_vector<vgl_point_2d<double> >& mfpf_dp_snake::points | ( | ) | const [inline] |
Current set of boundary points (a closed curve).
Definition at line 54 of file mfpf_dp_snake.h.
void mfpf_dp_snake::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Definition at line 222 of file mfpf_dp_snake.cxx.
void mfpf_dp_snake::radius_stats | ( | double & | mean, |
double & | sd | ||
) | const |
Compute mean and sd of distance to cog().
Definition at line 188 of file mfpf_dp_snake.cxx.
void mfpf_dp_snake::search | ( | const vimt_image_2d_of< float > & | image | ) |
Search image (running iterations until convergence).
Definition at line 144 of file mfpf_dp_snake.cxx.
void mfpf_dp_snake::set_to_circle | ( | const mfpf_point_finder & | finder, |
unsigned | n_points, | ||
const vgl_point_2d< double > & | c, | ||
double | r | ||
) |
Initialise as a circle of given radius about the given centre.
Clone taken of finder object
Definition at line 46 of file mfpf_dp_snake.cxx.
unsigned mfpf_dp_snake::size | ( | ) | const [inline] |
Number of points.
Definition at line 48 of file mfpf_dp_snake.h.
void mfpf_dp_snake::smooth_curve | ( | vcl_vector< vgl_point_2d< double > > & | src_pts, |
vcl_vector< vgl_point_2d< double > > & | dest_pts | ||
) | [protected] |
Compute the average of each point and its neighbours.
Replace each point with the average of it and its neighbours.
Definition at line 63 of file mfpf_dp_snake.cxx.
void mfpf_dp_snake::smooth_curve | ( | ) |
Replace each point with the average of it and its neighbours.
Definition at line 153 of file mfpf_dp_snake.cxx.
double mfpf_dp_snake::update_step | ( | const vimt_image_2d_of< float > & | image | ) |
Perform one iteration of snake search algorithm.
Return the mean movement of each point
Definition at line 76 of file mfpf_dp_snake.cxx.
short mfpf_dp_snake::version_no | ( | ) | const |
Version number for I/O.
Definition at line 206 of file mfpf_dp_snake.cxx.
mbl_cloneable_ptr<mfpf_point_finder> mfpf_dp_snake::finder_ [protected] |
Finder used to search for good points along profiles.
Definition at line 23 of file mfpf_dp_snake.h.
unsigned mfpf_dp_snake::max_its_ [protected] |
Maximum number of iterations to use during search.
Definition at line 20 of file mfpf_dp_snake.h.
vcl_vector<vgl_point_2d<double> > mfpf_dp_snake::pts_ [protected] |
Current set of boundary points (a closed curve).
Definition at line 26 of file mfpf_dp_snake.h.