Base for objects which generate regions from sets of points. More...
#include <mfpf_region_definer.h>
Public Member Functions | |
mfpf_region_definer () | |
Dflt ctor. | |
virtual | ~mfpf_region_definer () |
Destructor. | |
virtual bool | is_centred_on_pt () const =0 |
Returns true if the region is centred on an input point. | |
virtual unsigned | ref_point_index () const =0 |
Returns index of reference point on which the region is centred. | |
virtual unsigned | orig_ref_point_index () const =0 |
Returns original index of reference point on which the region is centred. | |
virtual vgl_point_2d< double > | get_ref_point (const vcl_vector< vgl_point_2d< double > > &pts) const =0 |
Returns reference point for region. | |
virtual mfpf_region_form | set_up (const vcl_vector< vgl_point_2d< double > > &pts)=0 |
Uses some subset of pts to define a region. | |
virtual mfpf_region_form | get_region (const vcl_vector< vgl_point_2d< double > > &pts) const =0 |
Uses some subset of pts to define a new region. | |
virtual bool | replace_index (const vcl_vector< unsigned > &new_index)=0 |
Replace each point index i with new_index[i]. | |
virtual bool | set_from_stream (vcl_istream &is) |
Initialise from a stream. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual mfpf_region_definer * | clone () const =0 |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const =0 |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const =0 |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs)=0 |
Load class from binary file stream. | |
Static Public Member Functions | |
static vcl_auto_ptr < mfpf_region_definer > | create_from_stream (vcl_istream &is) |
Create a concrete object, from a text specification. |
Base for objects which generate regions from sets of points.
Given a set of points, derived classes can generate a region. Typically this is centred on one point or set of points, and is aligned with reference to some other points.
Two key functions are provided: set_up(pts1), which defines the region and its aspect ratio, and get_region(pts2), which returns a box of the same aspect ratio, with its pose defined by the points in pts2. Two separate functions are required because all returned regions should have the same aspect ratio, since the boxes are to be used to initialise point_finders, which require a fixed aspect.
Definition at line 29 of file mfpf_region_definer.h.
mfpf_region_definer::mfpf_region_definer | ( | ) |
Dflt ctor.
Definition at line 19 of file mfpf_region_definer.cxx.
mfpf_region_definer::~mfpf_region_definer | ( | ) | [virtual] |
Destructor.
Definition at line 27 of file mfpf_region_definer.cxx.
virtual void mfpf_region_definer::b_read | ( | vsl_b_istream & | bfs | ) | [pure virtual] |
Load class from binary file stream.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
virtual void mfpf_region_definer::b_write | ( | vsl_b_ostream & | bfs | ) | const [pure virtual] |
Save class to binary file stream.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
virtual mfpf_region_definer* mfpf_region_definer::clone | ( | ) | const [pure virtual] |
Create a copy on the heap and return base class pointer.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
vcl_auto_ptr< mfpf_region_definer > mfpf_region_definer::create_from_stream | ( | vcl_istream & | is | ) | [static] |
Create a concrete object, from a text specification.
Definition at line 50 of file mfpf_region_definer.cxx.
virtual vgl_point_2d<double> mfpf_region_definer::get_ref_point | ( | const vcl_vector< vgl_point_2d< double > > & | pts | ) | const [pure virtual] |
Returns reference point for region.
Returns the point that would be returned by set_up(pts).pose().p(), but without changing internal state.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
virtual mfpf_region_form mfpf_region_definer::get_region | ( | const vcl_vector< vgl_point_2d< double > > & | pts | ) | const [pure virtual] |
Uses some subset of pts to define a new region.
The aspect ratio of the region will be the same as that from the last call to set_up. Only region.pose() will be different. Thus the returned region.pose() can be used to define the pose for training an mfpf_point_finder, for instance.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
vcl_string mfpf_region_definer::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
Definition at line 79 of file mfpf_region_definer.cxx.
virtual bool mfpf_region_definer::is_centred_on_pt | ( | ) | const [pure virtual] |
Returns true if the region is centred on an input point.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
virtual unsigned mfpf_region_definer::orig_ref_point_index | ( | ) | const [pure virtual] |
Returns original index of reference point on which the region is centred.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
virtual void mfpf_region_definer::print_summary | ( | vcl_ostream & | os | ) | const [pure virtual] |
Print class to os.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
virtual unsigned mfpf_region_definer::ref_point_index | ( | ) | const [pure virtual] |
Returns index of reference point on which the region is centred.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
virtual bool mfpf_region_definer::replace_index | ( | const vcl_vector< unsigned > & | new_index | ) | [pure virtual] |
Replace each point index i with new_index[i].
Allows for re-numbering of the points used. new_index[i]==mfpf_invalid_index indicates an invalid index Returns true if successful.
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
bool mfpf_region_definer::set_from_stream | ( | vcl_istream & | is | ) | [virtual] |
Initialise from a stream.
Initialise from a string stream.
Reimplemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
Definition at line 32 of file mfpf_region_definer.cxx.
virtual mfpf_region_form mfpf_region_definer::set_up | ( | const vcl_vector< vgl_point_2d< double > > & | pts | ) | [pure virtual] |
Uses some subset of pts to define a region.
The pose for the region will be a translation + rotation, ie region.pose().u() is a unit length
Implemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
short mfpf_region_definer::version_no | ( | ) | const |
Version number for I/O.
Reimplemented in mfpf_region_about_pt, and mfpf_region_about_lineseg.
Definition at line 70 of file mfpf_region_definer.cxx.