Public Member Functions | Private Attributes
msm_shape_instance Class Reference

Representation of an instance of a shape model. More...

#include <msm_shape_instance.h>

List of all members.

Public Member Functions

 msm_shape_instance ()
 msm_shape_instance (const msm_shape_model &model)
 Set up model (retains pointer to model).
 ~msm_shape_instance ()
void set_shape_model (const msm_shape_model &model)
 Set up model (retains pointer to model).
const msm_shape_modelmodel_ptr () const
 Pointer to current shape model.
const msm_shape_modelmodel () const
 Reference to current model.
const vnl_vector< double > & pose () const
 Current pose parameters.
const vnl_vector< double > & params () const
 Current shape parameters.
void set_pose (const vnl_vector< double > &pose)
 Define current pose.
void set_params (const vnl_vector< double > &b)
 Define parameters.
void set_to_mean ()
 Set all shape parameters to zero (pose unchanged).
const msm_pointspoints ()
 Current shape (uses lazy evaluation).
double approx_points_scale () const
 Returns approximate scale of points.
const msm_pointsmodel_points ()
 Current shape in model frame (uses lazy evaluation).
msm_ref_shape_instanceref_shape ()
 Shape in reference frame.
void fit_to_points (const msm_points &points, double pt_var=0)
 Finds parameters and pose to best match to points.
void fit_to_points_wt (const msm_points &points, const vnl_vector< double > &wts)
 Finds parameters and pose 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 and pose 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_shape_modelmodel_
 Shape model of which this is an instance.
msm_ref_shape_instance ref_shape_
 Shape in reference frame.
vnl_vector< double > pose_
 Global transformation parameters.
msm_points points_
 Current points in world frame (transformed model pts).
bool points_valid_
 True if points up to date with b_ and pose_.
msm_points tmp_points_
 Workspace for points in fit_to_points.

Detailed Description

Representation of an instance of a shape model.

Contains shape model parameters and the parameters of the global (model to world) transformation. 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).

points() and model_points() use lazy evaluation

Definition at line 24 of file msm_shape_instance.h.


Constructor & Destructor Documentation

msm_shape_instance::msm_shape_instance ( )

Definition at line 22 of file msm_shape_instance.cxx.

msm_shape_instance::msm_shape_instance ( const msm_shape_model model)

Set up model (retains pointer to model).

Definition at line 28 of file msm_shape_instance.cxx.

msm_shape_instance::~msm_shape_instance ( )

Definition at line 37 of file msm_shape_instance.cxx.


Member Function Documentation

double msm_shape_instance::approx_points_scale ( ) const

Returns approximate scale of points.

Actually returns scale of mean after applying current pose

Definition at line 89 of file msm_shape_instance.cxx.

void msm_shape_instance::b_read ( vsl_b_istream bfs)

Load class from binary file stream.

Definition at line 289 of file msm_shape_instance.cxx.

void msm_shape_instance::b_write ( vsl_b_ostream bfs) const

Save class to binary file stream.

Definition at line 277 of file msm_shape_instance.cxx.

void msm_shape_instance::fit_to_points ( const msm_points pts,
double  res_var = 0 
)

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+pv), where pv is the pt_var scaled to the reference frame.

Parameters:
pt_varVariance on each point

All points equally weighted. If res_var>0, and use_prior(), then effect of Gaussian prior is to scale parameters by mode_var/(mode_var+rv), where rv is the res_var scaled to the reference frame.

Definition at line 102 of file msm_shape_instance.cxx.

void msm_shape_instance::fit_to_points_wt ( const msm_points pts,
const vnl_vector< double > &  wts 
)

Finds parameters and pose to best match to points.

Errors on point i are weighted by wts[i]. wts[i] is treated as the inverse of the error variance of point i, in the target frame.

Errors on point i are weighted by wts[i]

Definition at line 155 of file msm_shape_instance.cxx.

void msm_shape_instance::fit_to_points_wt_mat ( const msm_points pts,
const vcl_vector< msm_wt_mat_2d > &  wt_mat 
)

Finds parameters and pose to best match to points.

Errors on point i are weighted by wt_mat[i] in target frame

Definition at line 202 of file msm_shape_instance.cxx.

vcl_string msm_shape_instance::is_a ( ) const

Name of the class.

Definition at line 258 of file msm_shape_instance.cxx.

const msm_shape_model& msm_shape_instance::model ( ) const [inline]

Reference to current model.

Definition at line 64 of file msm_shape_instance.h.

const msm_points& msm_shape_instance::model_points ( ) [inline]

Current shape in model frame (uses lazy evaluation).

Definition at line 91 of file msm_shape_instance.h.

const msm_shape_model* msm_shape_instance::model_ptr ( ) const [inline]

Pointer to current shape model.

Definition at line 60 of file msm_shape_instance.h.

const vnl_vector<double>& msm_shape_instance::params ( ) const [inline]

Current shape parameters.

Definition at line 71 of file msm_shape_instance.h.

const msm_points & msm_shape_instance::points ( )

Current shape (uses lazy evaluation).

Definition at line 76 of file msm_shape_instance.cxx.

const vnl_vector<double>& msm_shape_instance::pose ( ) const [inline]

Current pose parameters.

Definition at line 68 of file msm_shape_instance.h.

void msm_shape_instance::print_summary ( vcl_ostream &  os) const

Print class to os.

Definition at line 268 of file msm_shape_instance.cxx.

msm_ref_shape_instance& msm_shape_instance::ref_shape ( ) [inline]

Shape in reference frame.

Definition at line 95 of file msm_shape_instance.h.

void msm_shape_instance::set_params ( const vnl_vector< double > &  b)

Define parameters.

Definition at line 60 of file msm_shape_instance.cxx.

void msm_shape_instance::set_pose ( const vnl_vector< double > &  pose)

Define current pose.

Definition at line 52 of file msm_shape_instance.cxx.

void msm_shape_instance::set_shape_model ( const msm_shape_model model)

Set up model (retains pointer to model).

Definition at line 42 of file msm_shape_instance.cxx.

void msm_shape_instance::set_to_mean ( )

Set all shape parameters to zero (pose unchanged).

Set all shape parameters to zero.

Definition at line 68 of file msm_shape_instance.cxx.

short msm_shape_instance::version_no ( ) const

Version number for I/O.

Definition at line 249 of file msm_shape_instance.cxx.


Member Data Documentation

Shape model of which this is an instance.

Definition at line 28 of file msm_shape_instance.h.

Current points in world frame (transformed model pts).

Definition at line 37 of file msm_shape_instance.h.

True if points up to date with b_ and pose_.

Definition at line 40 of file msm_shape_instance.h.

Global transformation parameters.

Definition at line 34 of file msm_shape_instance.h.

Shape in reference frame.

Definition at line 31 of file msm_shape_instance.h.

Workspace for points in fit_to_points.

Definition at line 43 of file msm_shape_instance.h.


The documentation for this class was generated from the following files: