Public Member Functions | Static Public Member Functions
msm_zoom_aligner Class Reference

Calculate and apply translation + scale transform. More...

#include <msm_zoom_aligner.h>

Inheritance diagram for msm_zoom_aligner:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~msm_zoom_aligner ()
virtual unsigned size () const
 Return number of parameters defining the transformation.
virtual vnl_vector< double > inverse (const vnl_vector< double > &) const
 Compute parameters for inverse transformation.
virtual void apply_transform (const msm_points &points, const vnl_vector< double > &trans, msm_points &new_points) const
 Apply the transformation to the given points.
virtual double scale (const vnl_vector< double > &trans) const
 Return scaling applied by the transform with given parameters.
virtual void calc_transform_from_ref (const msm_points &ref_points, const msm_points &points2, vnl_vector< double > &trans) const
 Estimate parameter which best map ref_points to points2.
virtual void calc_transform (const msm_points &points1, const msm_points &points2, vnl_vector< double > &trans) const
 Estimate parameter which best map points1 to points2.
virtual void calc_transform_wt (const msm_points &points1, const msm_points &points2, const vnl_vector< double > &wts, vnl_vector< double > &trans) const
 Estimate parameters which map points1 to points2 allowing for weights.
virtual void calc_transform_wt_mat (const msm_points &points1, const msm_points &points2, const vcl_vector< msm_wt_mat_2d > &wt_mat, vnl_vector< double > &trans) const
 Estimate parameters which map points allowing for anisotropic wts.
virtual void transform_wt_mat (const vcl_vector< msm_wt_mat_2d > &wt_mat, const vnl_vector< double > &trans, vcl_vector< msm_wt_mat_2d > &new_wt_mat) const
 Apply transform to weight matrices (ie ignore translation component).
virtual vnl_vector< double > compose (const vnl_vector< double > &pose1, const vnl_vector< double > &pose2) const
 Returns params of pose such that pose(x) = pose1(pose2(x)).
virtual void normalise_shape (msm_points &points) const
 Apply transform to generate points in reference frame.
virtual void align_set (const vcl_vector< msm_points > &points, msm_points &ref_mean_shape, vcl_vector< vnl_vector< double > > &pose_to_ref, vnl_vector< double > &average_pose) const
 Find poses which align a set of points.
virtual vcl_string is_a () const
 Name of the class.
virtual msm_alignerclone () const
 Create a copy on the heap and return base class pointer.
void mean_of_transformed (const vcl_vector< msm_points > &points, const vcl_vector< vnl_vector< double > > &pose, msm_points &mean) const
 Compute mean of points[i] after transforming with pose[i].
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.
virtual void config_from_stream (vcl_istream &is)
 Initialise from a text stream.

Static Public Member Functions

static vcl_auto_ptr< msm_alignercreate_from_stream (vcl_istream &is)
 Create a concrete msm_aligner-derived object, from a text specification.

Detailed Description

Calculate and apply translation + scale transform.

Transformation encoded as (log(s),tx,ty). Transformation is then x'=sx+tx, y' = sy+ty.

Definition at line 15 of file msm_zoom_aligner.h.


Constructor & Destructor Documentation

virtual msm_zoom_aligner::~msm_zoom_aligner ( ) [inline, virtual]

Definition at line 19 of file msm_zoom_aligner.h.


Member Function Documentation

void msm_zoom_aligner::align_set ( const vcl_vector< msm_points > &  points,
msm_points ref_mean_shape,
vcl_vector< vnl_vector< double > > &  pose_to_ref,
vnl_vector< double > &  average_pose 
) const [virtual]

Find poses which align a set of points.

On exit ref_mean_shape is the mean shape in the reference frame, pose_to_ref[i] maps points[i] into the reference frame (ie pose is the mapping from the reference frame to the target frames).

Parameters:
average_poseSome estimate of the average mapping

On exit ref_mean_shape is the mean shape in the reference frame, pose_to_ref[i] maps points[i] into the reference frame (ie pose is the mapping from the reference frame to the target frames).

Parameters:
average_poseAverage mapping from ref to target frame

Implements msm_aligner.

Definition at line 270 of file msm_zoom_aligner.cxx.

void msm_zoom_aligner::apply_transform ( const msm_points points,
const vnl_vector< double > &  trans,
msm_points new_points 
) const [virtual]

Apply the transformation to the given points.

Implements msm_aligner.

Definition at line 26 of file msm_zoom_aligner.cxx.

void msm_aligner::b_read ( vsl_b_istream bfs) [virtual, inherited]

Load class from binary file stream.

Definition at line 46 of file msm_aligner.cxx.

void msm_aligner::b_write ( vsl_b_ostream bfs) const [virtual, inherited]

Save class to binary file stream.

Definition at line 39 of file msm_aligner.cxx.

void msm_zoom_aligner::calc_transform ( const msm_points pts1,
const msm_points pts2,
vnl_vector< double > &  trans 
) const [virtual]

Estimate parameter which best map points1 to points2.

Minimises ||points2-T(points1)||^2

Implements msm_aligner.

Definition at line 83 of file msm_zoom_aligner.cxx.

void msm_zoom_aligner::calc_transform_from_ref ( const msm_points ref_pts,
const msm_points pts2,
vnl_vector< double > &  trans 
) const [virtual]

Estimate parameter which best map ref_points to points2.

Minimises ||points2-T(ref_points)||^2. Takes advantage of assumed properties of ref_points (eg CoG=origin, unit size etc) to perform efficiently.

When used with a shape model of form ref_points+Pb, where the modes P have certain orthogonality properties with respect to the ref shape, this can give the optimal transformation into a tangent plane, independent of the current parameters. In this case a one-shot method can be used to compute the optimal shape and pose parameters, rather than an iterative method which is required where the orthogonality properties do not hold, or where weights are considered.

Implements msm_aligner.

Definition at line 54 of file msm_zoom_aligner.cxx.

void msm_zoom_aligner::calc_transform_wt ( const msm_points pts1,
const msm_points pts2,
const vnl_vector< double > &  wts,
vnl_vector< double > &  trans 
) const [virtual]

Estimate parameters which map points1 to points2 allowing for weights.

Minimises sum of weighted squares error in frame of pts2, ie sum w_i * ||p2_i - T(p1_i)||

Implements msm_aligner.

Definition at line 132 of file msm_zoom_aligner.cxx.

void msm_zoom_aligner::calc_transform_wt_mat ( const msm_points pts1,
const msm_points pts2,
const vcl_vector< msm_wt_mat_2d > &  wt_mat,
vnl_vector< double > &  trans 
) const [virtual]

Estimate parameters which map points allowing for anisotropic wts.

Errors on point i are weighted by wt_mat[i] in pts2 frame. i.e. error is sum (p2_i-T(p1_i)'*wt_mat[i]*(p2_i-T(p1_i)

Errors on point i are weighted by wt_mat[i] in pts2 frame. ie error is sum (p2_i-T(p1_i)'*wt_mat[i]*(p2_i-T(p1_i)

Implements msm_aligner.

Definition at line 169 of file msm_zoom_aligner.cxx.

msm_aligner * msm_zoom_aligner::clone ( ) const [virtual]

Create a copy on the heap and return base class pointer.

Implements msm_aligner.

Definition at line 327 of file msm_zoom_aligner.cxx.

vnl_vector< double > msm_zoom_aligner::compose ( const vnl_vector< double > &  pose1,
const vnl_vector< double > &  pose2 
) const [virtual]

Returns params of pose such that pose(x) = pose1(pose2(x)).

Implements msm_aligner.

Definition at line 239 of file msm_zoom_aligner.cxx.

void msm_aligner::config_from_stream ( vcl_istream &  is) [virtual, inherited]

Initialise from a text stream.

The default implementation is for attribute-less normalisers, and throws if it finds any data in the stream.

Definition at line 70 of file msm_aligner.cxx.

vcl_auto_ptr< msm_aligner > msm_aligner::create_from_stream ( vcl_istream &  is) [static, inherited]

Create a concrete msm_aligner-derived object, from a text specification.

Definition at line 84 of file msm_aligner.cxx.

vnl_vector< double > msm_zoom_aligner::inverse ( const vnl_vector< double > &  t) const [virtual]

Compute parameters for inverse transformation.

Implements msm_aligner.

Definition at line 15 of file msm_zoom_aligner.cxx.

vcl_string msm_zoom_aligner::is_a ( ) const [virtual]

Name of the class.

Implements msm_aligner.

Definition at line 321 of file msm_zoom_aligner.cxx.

void msm_aligner::mean_of_transformed ( const vcl_vector< msm_points > &  points,
const vcl_vector< vnl_vector< double > > &  pose,
msm_points mean 
) const [inherited]

Compute mean of points[i] after transforming with pose[i].

Compute mean of points after transforming with pose.

Definition at line 14 of file msm_aligner.cxx.

void msm_zoom_aligner::normalise_shape ( msm_points points) const [virtual]

Apply transform to generate points in reference frame.

Apply transform to generate points in some reference frame.

Translate so that the centre of gravity is at the origin and scale to a unit size (points.vector().magnitude()==1)

For instance, depending on transform, may translate so the centre of gravity is at the origin and scale to a unit size.

Implements msm_aligner.

Definition at line 255 of file msm_zoom_aligner.cxx.

void msm_aligner::print_summary ( vcl_ostream &  os) const [virtual, inherited]

Print class to os.

Definition at line 31 of file msm_aligner.cxx.

double msm_zoom_aligner::scale ( const vnl_vector< double > &  trans) const [virtual]

Return scaling applied by the transform with given parameters.

Implements msm_aligner.

Definition at line 35 of file msm_zoom_aligner.cxx.

virtual unsigned msm_zoom_aligner::size ( ) const [inline, virtual]

Return number of parameters defining the transformation.

Implements msm_aligner.

Definition at line 22 of file msm_zoom_aligner.h.

void msm_zoom_aligner::transform_wt_mat ( const vcl_vector< msm_wt_mat_2d > &  wt_mat,
const vnl_vector< double > &  trans,
vcl_vector< msm_wt_mat_2d > &  new_wt_mat 
) const [virtual]

Apply transform to weight matrices (ie ignore translation component).

Implements msm_aligner.

Definition at line 228 of file msm_zoom_aligner.cxx.


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