Object to build a msm_shape_model. More...
#include <msm_shape_model_builder.h>
Public Member Functions | |
msm_shape_model_builder () | |
~msm_shape_model_builder () | |
void | set_aligner (const msm_aligner &aligner) |
Set up aligner to be used. | |
void | set_param_limiter (const msm_param_limiter &) |
Define parameter limiter. | |
void | set_mode_choice (unsigned min, unsigned max, double var_proportion) |
Define limits on number of parameters to use in model. | |
const msm_aligner & | aligner () const |
Object used to deal with global transformations. | |
const msm_param_limiter & | param_limiter () const |
Current object which limits parameters. | |
void | build_model (const vcl_vector< msm_points > &shapes, msm_shape_model &shape_model) |
Builds the model from the supplied examples. | |
void | build_model (const vcl_vector< msm_points > &shapes, const vcl_vector< vcl_vector< unsigned > > &pts_used, msm_shape_model &shape_model) |
Builds the model, using subsets of elements for some modes. | |
void | build_within_class_model (const vcl_vector< msm_points > &shapes, const vcl_vector< int > &id, const vcl_vector< vcl_vector< unsigned > > &pts_used, msm_shape_model &shape_model) |
Builds shape model from within-class variation. | |
void | build_within_class_model (const vcl_vector< msm_points > &shapes, const vcl_vector< int > &id, msm_shape_model &shape_model) |
Builds shape model from within-class variation. | |
void | build_from_files (const vcl_string &points_dir, const vcl_vector< vcl_string > &filenames, msm_shape_model &shape_model) |
Builds the model from the points loaded from given files. | |
short | version_no () const |
Version number for I/O. | |
vcl_string | is_a () const |
Name of the class. | |
void | print_summary (vcl_ostream &os) const |
Print class to os. | |
void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
Private Attributes | |
mbl_cloneable_ptr< msm_aligner > | aligner_ |
Object used to deal with global transformations. | |
mbl_cloneable_ptr < msm_param_limiter > | param_limiter_ |
Default choice of parameter limiter. | |
double | var_prop_ |
Choose n.modes to explain this proportion of variance. | |
unsigned | min_modes_ |
Min. number of modes to select. | |
unsigned | max_modes_ |
Max. number of modes to use. |
Object to build a msm_shape_model.
Definition at line 16 of file msm_shape_model_builder.h.
msm_shape_model_builder::msm_shape_model_builder | ( | ) |
Definition at line 22 of file msm_shape_model_builder.cxx.
msm_shape_model_builder::~msm_shape_model_builder | ( | ) |
Definition at line 31 of file msm_shape_model_builder.cxx.
const msm_aligner& msm_shape_model_builder::aligner | ( | ) | const [inline] |
Object used to deal with global transformations.
Definition at line 54 of file msm_shape_model_builder.h.
void msm_shape_model_builder::b_read | ( | vsl_b_istream & | bfs | ) |
Load class from binary file stream.
Definition at line 422 of file msm_shape_model_builder.cxx.
void msm_shape_model_builder::b_write | ( | vsl_b_ostream & | bfs | ) | const |
Save class to binary file stream.
Definition at line 407 of file msm_shape_model_builder.cxx.
void msm_shape_model_builder::build_from_files | ( | const vcl_string & | points_dir, |
const vcl_vector< vcl_string > & | filenames, | ||
msm_shape_model & | shape_model | ||
) |
Builds the model from the points loaded from given files.
Loads from points_dir/filenames
[i]. throws a mbl_exception_parse_error if fails to load in any of the files.
Definition at line 164 of file msm_shape_model_builder.cxx.
void msm_shape_model_builder::build_model | ( | const vcl_vector< msm_points > & | shapes, |
msm_shape_model & | shape_model | ||
) |
Builds the model from the supplied examples.
Definition at line 58 of file msm_shape_model_builder.cxx.
void msm_shape_model_builder::build_model | ( | const vcl_vector< msm_points > & | shapes, |
const vcl_vector< vcl_vector< unsigned > > & | pts_used, | ||
msm_shape_model & | shape_model | ||
) |
Builds the model, using subsets of elements for some modes.
Builds a shape model, allowing control of which elements may be varied in some of the modes. This allows construction of models where some groups of points are semi-independent of the others.
pts_used[i] | indicates the set of points to be used for mode i (or all if pts_used [i] is empty). Modes beyond pts_used.size() will use all elements. Builds at least pts_used.size() modes. Number defined by max_modes and var_prop. |
Builds a shape model, allowing control of which elements may be varied in some of the modes. This allows construction of models where some groups of points are semi-independent of the others.
pts_used[i] | indicates the set of elements to be used for mode i (or all if pts_used [i] is empty). Modes beyond pts_used.size() will use all elements. Builds at least pts_used.size() modes. Number defined by max_modes and var_prop. |
Definition at line 124 of file msm_shape_model_builder.cxx.
void msm_shape_model_builder::build_within_class_model | ( | const vcl_vector< msm_points > & | shapes, |
const vcl_vector< int > & | id, | ||
const vcl_vector< vcl_vector< unsigned > > & | pts_used, | ||
msm_shape_model & | shape_model | ||
) |
Builds shape model from within-class variation.
shapes[i] | belongs to class id [i]. Aligns all shapes to a common mean. Computes the average covariance about each class mean, and builds shape modes from this. |
If id
[i]<0, then shape is used for building global mean, but not for within class model.
pts_used[i] | indicates which points will be controlled by mode i. |
shape[i] | belongs to class id [i]. Aligns all shapes to a common mean. Computes the average covariance about each class mean, and builds shape modes from this. |
If id
[i]<0, then shape is used for building global mean, but not for within class model.
pts_used[i] | indicates which points will be controlled by mode i. |
Definition at line 279 of file msm_shape_model_builder.cxx.
void msm_shape_model_builder::build_within_class_model | ( | const vcl_vector< msm_points > & | shapes, |
const vcl_vector< int > & | id, | ||
msm_shape_model & | shape_model | ||
) |
Builds shape model from within-class variation.
shapes[i] | belongs to class id [i]. Aligns all shapes to a common mean. Computes the average covariance about each class mean, and builds shape modes from this. |
If id
[i]<0, then shape is used for building global mean, but not for within class model.
shape[i] | belongs to class id [i]. Aligns all shapes to a common mean. Computes the average covariance about each class mean, and builds shape modes from this. |
If id
[i]<0, then shape is used for building global mean, but not for within class model.
Definition at line 201 of file msm_shape_model_builder.cxx.
vcl_string msm_shape_model_builder::is_a | ( | ) | const |
Name of the class.
Definition at line 380 of file msm_shape_model_builder.cxx.
const msm_param_limiter& msm_shape_model_builder::param_limiter | ( | ) | const [inline] |
Current object which limits parameters.
Definition at line 57 of file msm_shape_model_builder.h.
void msm_shape_model_builder::print_summary | ( | vcl_ostream & | os | ) | const |
Print class to os.
Definition at line 390 of file msm_shape_model_builder.cxx.
void msm_shape_model_builder::set_aligner | ( | const msm_aligner & | aligner | ) |
void msm_shape_model_builder::set_mode_choice | ( | unsigned | min, |
unsigned | max, | ||
double | var_proportion | ||
) |
Define limits on number of parameters to use in model.
var_proportion | Proportion of variance in data to explain |
Definition at line 48 of file msm_shape_model_builder.cxx.
void msm_shape_model_builder::set_param_limiter | ( | const msm_param_limiter & | p | ) |
Define parameter limiter.
Definition at line 43 of file msm_shape_model_builder.cxx.
short msm_shape_model_builder::version_no | ( | ) | const |
Version number for I/O.
Definition at line 371 of file msm_shape_model_builder.cxx.
mbl_cloneable_ptr<msm_aligner> msm_shape_model_builder::aligner_ [private] |
Object used to deal with global transformations.
Definition at line 20 of file msm_shape_model_builder.h.
unsigned msm_shape_model_builder::max_modes_ [private] |
Max. number of modes to use.
Definition at line 32 of file msm_shape_model_builder.h.
unsigned msm_shape_model_builder::min_modes_ [private] |
Min. number of modes to select.
Definition at line 29 of file msm_shape_model_builder.h.
mbl_cloneable_ptr<msm_param_limiter> msm_shape_model_builder::param_limiter_ [private] |
Default choice of parameter limiter.
Definition at line 23 of file msm_shape_model_builder.h.
double msm_shape_model_builder::var_prop_ [private] |
Choose n.modes to explain this proportion of variance.
Definition at line 26 of file msm_shape_model_builder.h.