Representation of an instance of a shape model in ref frame. More...
#include <msm_ref_shape_instance.h>
Public Member Functions | |
msm_ref_shape_instance () | |
~msm_ref_shape_instance () | |
void | set_shape_model (const msm_ref_shape_model &model) |
Set up model (retains pointer to model). | |
void | set_param_limiter (const msm_param_limiter &limiter) |
Define limits on parameters (clone taken). | |
const msm_param_limiter & | param_limiter () const |
Current object which limits parameters. | |
msm_param_limiter & | param_limiter () |
Current object which limits parameters (non-const). | |
bool | use_prior () const |
When true, use Gaussian prior on params in fit_to_points*. | |
void | set_use_prior (bool) |
When true, use Gaussian prior on params in fit_to_points*. | |
void | set_params (const vnl_vector< double > &b) |
Define parameters. | |
void | set_to_mean () |
Set all shape parameters to zero. | |
const msm_ref_shape_model * | model_ptr () const |
Pointer to current model. | |
const msm_ref_shape_model & | model () const |
Reference to current model. | |
const vnl_vector< double > & | params () const |
Current shape parameters. | |
const msm_points & | points () |
Current shape in model frame (uses lazy evaluation). | |
void | fit_to_points (const msm_points &points, double pt_var=0) |
Finds parameters to best match to points. | |
void | fit_to_points_wt (const msm_points &points, const vnl_vector< double > &wts) |
Finds parameters to best match to points. | |
void | fit_to_points_wt_mat (const msm_points &pts, const vcl_vector< msm_wt_mat_2d > &wt_mat) |
Finds parameters to best match to points. | |
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 | |
const msm_ref_shape_model * | model_ |
Shape model of which this is an instance. | |
vnl_vector< double > | b_ |
Model parameters. | |
msm_points | points_ |
Current model points. | |
bool | use_prior_ |
When true, use Gaussian prior on params in fit_to_points*. | |
bool | points_valid_ |
True if model points up to date with b_. | |
mbl_cloneable_ptr < msm_param_limiter > | param_limiter_ |
Object which applies limits to parameters in fit_to_points*. | |
msm_points | tmp_points_ |
Workspace for points in fit_to_points. |
Representation of an instance of a shape model in ref frame.
Includes functions to fit instances to sets of points and to generate sets of points.
By default, all shape parameters are used and params() returns a vector of length equal to the full number of shape modes. To use fewer modes, create a parameter vector with the desired number, and call set_params(b).
This uses no global pose - use msm_shape_instance for those.
Definition at line 26 of file msm_ref_shape_instance.h.
msm_ref_shape_instance::msm_ref_shape_instance | ( | ) |
Definition at line 26 of file msm_ref_shape_instance.cxx.
msm_ref_shape_instance::~msm_ref_shape_instance | ( | ) |
Definition at line 36 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::b_read | ( | vsl_b_istream & | bfs | ) |
Load class from binary file stream.
Definition at line 361 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::b_write | ( | vsl_b_ostream & | bfs | ) | const |
Save class to binary file stream.
Definition at line 348 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::fit_to_points | ( | const msm_points & | pts, |
double | pt_var = 0 |
||
) |
Finds parameters to best match to points.
Finds parameters and pose to best match to points.
All points equally weighted. If pt_var>0, and use_prior(), then effect of Gaussian prior is to scale parameters by mode_var/(mode_var+pt_var).
All points equally weighted. If res_pt>0, and use_prior(), then effect of Gaussian prior is to scale parameters by mode_var/(mode_var+pt_var).
Definition at line 105 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::fit_to_points_wt | ( | const msm_points & | pts, |
const vnl_vector< double > & | wts | ||
) |
Finds parameters to best match to points.
Finds parameters and pose to best match to points.
Errors on point i are weighted by wts[i] If use_prior(), then include Gaussian prior on the shape parameters, and assume that wts are inverse variances.
Errors on point i are weighted by wts[i]
Definition at line 259 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::fit_to_points_wt_mat | ( | const msm_points & | pts, |
const vcl_vector< msm_wt_mat_2d > & | wt_mat | ||
) |
Finds parameters to best match to points.
Finds parameters and pose to best match to points.
Errors on point i are weighted by wt_mat[i] in target frame If use_prior(), then include Gaussian prior on the shape parameters, and assume that wt_mat are inverse covariances.
Errors on point i are weighted by wt_mat[i] in target frame
Definition at line 293 of file msm_ref_shape_instance.cxx.
vcl_string msm_ref_shape_instance::is_a | ( | ) | const |
Name of the class.
Definition at line 329 of file msm_ref_shape_instance.cxx.
const msm_ref_shape_model& msm_ref_shape_instance::model | ( | ) | const [inline] |
Reference to current model.
Definition at line 88 of file msm_ref_shape_instance.h.
const msm_ref_shape_model* msm_ref_shape_instance::model_ptr | ( | ) | const [inline] |
Pointer to current model.
Definition at line 85 of file msm_ref_shape_instance.h.
const msm_param_limiter& msm_ref_shape_instance::param_limiter | ( | ) | const [inline] |
Current object which limits parameters.
Definition at line 65 of file msm_ref_shape_instance.h.
msm_param_limiter& msm_ref_shape_instance::param_limiter | ( | ) | [inline] |
Current object which limits parameters (non-const).
Definition at line 69 of file msm_ref_shape_instance.h.
const vnl_vector<double>& msm_ref_shape_instance::params | ( | ) | const [inline] |
Current shape parameters.
Definition at line 92 of file msm_ref_shape_instance.h.
const msm_points & msm_ref_shape_instance::points | ( | ) |
Current shape in model frame (uses lazy evaluation).
Definition at line 83 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::print_summary | ( | vcl_ostream & | os | ) | const |
Print class to os.
Definition at line 339 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::set_param_limiter | ( | const msm_param_limiter & | limiter | ) |
Define limits on parameters (clone taken).
Definition at line 54 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::set_params | ( | const vnl_vector< double > & | b | ) |
Define parameters.
Definition at line 66 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::set_shape_model | ( | const msm_ref_shape_model & | model | ) |
Set up model (retains pointer to model).
Definition at line 41 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::set_to_mean | ( | ) |
Set all shape parameters to zero.
Definition at line 74 of file msm_ref_shape_instance.cxx.
void msm_ref_shape_instance::set_use_prior | ( | bool | b | ) |
When true, use Gaussian prior on params in fit_to_points*.
Definition at line 60 of file msm_ref_shape_instance.cxx.
bool msm_ref_shape_instance::use_prior | ( | ) | const [inline] |
When true, use Gaussian prior on params in fit_to_points*.
Definition at line 73 of file msm_ref_shape_instance.h.
short msm_ref_shape_instance::version_no | ( | ) | const |
Version number for I/O.
Definition at line 320 of file msm_ref_shape_instance.cxx.
vnl_vector<double> msm_ref_shape_instance::b_ [private] |
Model parameters.
Definition at line 33 of file msm_ref_shape_instance.h.
const msm_ref_shape_model* msm_ref_shape_instance::model_ [private] |
Shape model of which this is an instance.
Definition at line 30 of file msm_ref_shape_instance.h.
mbl_cloneable_ptr<msm_param_limiter> msm_ref_shape_instance::param_limiter_ [private] |
Object which applies limits to parameters in fit_to_points*.
Definition at line 45 of file msm_ref_shape_instance.h.
msm_points msm_ref_shape_instance::points_ [private] |
Current model points.
Definition at line 36 of file msm_ref_shape_instance.h.
bool msm_ref_shape_instance::points_valid_ [private] |
True if model points up to date with b_.
Definition at line 42 of file msm_ref_shape_instance.h.
Workspace for points in fit_to_points.
Definition at line 48 of file msm_ref_shape_instance.h.
bool msm_ref_shape_instance::use_prior_ [private] |
When true, use Gaussian prior on params in fit_to_points*.
Definition at line 39 of file msm_ref_shape_instance.h.