Public Member Functions | Private Member Functions | Private Attributes
mbl_thin_plate_spline_3d Class Reference

Construct thin plate spline to map 3D to 3D. More...

#include <mbl_thin_plate_spline_3d.h>

List of all members.

Public Member Functions

 mbl_thin_plate_spline_3d ()
 Dflt ctor.
virtual ~mbl_thin_plate_spline_3d ()
 Destructor.
void build (const vcl_vector< vgl_point_3d< double > > &source_pts, const vcl_vector< vgl_point_3d< double > > &dest_pts, bool compute_the_energy=false)
 Sets up internal transformation to map source_pts onto dest_pts.
void set_source_pts (const vcl_vector< vgl_point_3d< double > > &source_pts)
 Define source point positions.
void build (const vcl_vector< vgl_point_3d< double > > &dest_pts)
 Sets up internal transformation to map source_pts onto dest_pts.
vgl_point_3d< double > operator() (double x, double y, double z) const
 Return transformed version of (x,y,z).
vgl_point_3d< double > operator() (const vgl_point_3d< double > &p) const
 Return transformed version of (x,y,z).
double bendingEnergyX () const
 Bending energy of X component (zero for pure affine).
double bendingEnergyY () const
 Bending energy of Y component (zero for pure affine).
double bendingEnergyZ () const
 Bending energy of Z component (zero for pure affine).
short version_no () const
 Version number for I/O.
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.
bool operator== (const mbl_thin_plate_spline_3d &tps) const
 Comparison operator.

Private Member Functions

void build_pure_affine (const vcl_vector< vgl_point_3d< double > > &source_pts, const vcl_vector< vgl_point_3d< double > > &dest_pts)
 Build from small number of points.
void set_params (const vnl_vector< double > &W1, const vnl_vector< double > &W2, const vnl_vector< double > &W3)
 Set parameters from vectors.
void set_up_rhs (vnl_vector< double > &Bx, vnl_vector< double > &By, vnl_vector< double > &Bz, const vcl_vector< vgl_point_3d< double > > &dest_pts)
void compute_energy (vnl_vector< double > &W1, vnl_vector< double > &W2, vnl_vector< double > &W3, const vnl_matrix< double > &L)
 Compute spline-bending energy.

Private Attributes

vnl_vector< double > Wx_
vnl_vector< double > Wy_
vnl_vector< double > Wz_
double Ax0_
double AxX_
double AxY_
double AxZ_
double Ay0_
double AyX_
double AyY_
double AyZ_
double Az0_
double AzX_
double AzY_
double AzZ_
double energy_x_
double energy_y_
double energy_z_
vcl_vector< vgl_point_3d
< double > > 
src_pts_
vnl_matrix< double > L_inv_
 Used to estimate weights in set_source_points().

Detailed Description

Construct thin plate spline to map 3D to 3D.

I.e. does some mapping (x',y',z') = f(x,y,z). (See Booksteins work, e.g. IPMI 1993) The warp is `guided' by a set of landmarks p(0) .. p(n-1) in the source plane which are to be mapped to a (possibly deformed) set q(0)..q(n-1) in the destination. Thus the mapping is constrained so that f(p(i)) = q(i) for i = 0..n-1. The points are given to the build() function to set up the object.

If one wishes to map a set of source points to multiple target points, use set_source_pts(src_pts); then build(target_pts); for each target set.

 vcl_vector<vgl_point_3d<double> > src_pts(n_points),dest_pts(n_points);

 // Fill src_pts and dest_pts
 .....

 // Construct spline object
 mbl_thin_plate_spline_3d tps;
 tps.build(src_pts,dest_pts);

 // Apply to point p:
 vgl_point_3d<double> p(1,2,3);
 vgl_point_3d<double> new_p = tps(p);

Definition at line 42 of file mbl_thin_plate_spline_3d.h.


Constructor & Destructor Documentation

mbl_thin_plate_spline_3d::mbl_thin_plate_spline_3d ( )

Dflt ctor.

Definition at line 27 of file mbl_thin_plate_spline_3d.cxx.

mbl_thin_plate_spline_3d::~mbl_thin_plate_spline_3d ( ) [virtual]

Destructor.

Definition at line 40 of file mbl_thin_plate_spline_3d.cxx.


Member Function Documentation

void mbl_thin_plate_spline_3d::b_read ( vsl_b_istream bfs)

Load class from binary file stream.

Definition at line 463 of file mbl_thin_plate_spline_3d.cxx.

void mbl_thin_plate_spline_3d::b_write ( vsl_b_ostream bfs) const

Save class to binary file stream.

Definition at line 441 of file mbl_thin_plate_spline_3d.cxx.

double mbl_thin_plate_spline_3d::bendingEnergyX ( ) const [inline]

Bending energy of X component (zero for pure affine).

A measure of total amount of non-linear deformation

Definition at line 105 of file mbl_thin_plate_spline_3d.h.

double mbl_thin_plate_spline_3d::bendingEnergyY ( ) const [inline]

Bending energy of Y component (zero for pure affine).

A measure of total amount of non-linear deformation

Definition at line 109 of file mbl_thin_plate_spline_3d.h.

double mbl_thin_plate_spline_3d::bendingEnergyZ ( ) const [inline]

Bending energy of Z component (zero for pure affine).

A measure of total amount of non-linear deformation

Definition at line 113 of file mbl_thin_plate_spline_3d.h.

void mbl_thin_plate_spline_3d::build ( const vcl_vector< vgl_point_3d< double > > &  source_pts,
const vcl_vector< vgl_point_3d< double > > &  dest_pts,
bool  compute_the_energy = false 
)

Sets up internal transformation to map source_pts onto dest_pts.

Definition at line 271 of file mbl_thin_plate_spline_3d.cxx.

void mbl_thin_plate_spline_3d::build ( const vcl_vector< vgl_point_3d< double > > &  dest_pts)

Sets up internal transformation to map source_pts onto dest_pts.

Definition at line 345 of file mbl_thin_plate_spline_3d.cxx.

void mbl_thin_plate_spline_3d::build_pure_affine ( const vcl_vector< vgl_point_3d< double > > &  source_pts,
const vcl_vector< vgl_point_3d< double > > &  dest_pts 
) [private]

Build from small number of points.

Definition at line 123 of file mbl_thin_plate_spline_3d.cxx.

void mbl_thin_plate_spline_3d::compute_energy ( vnl_vector< double > &  W1,
vnl_vector< double > &  W2,
vnl_vector< double > &  W3,
const vnl_matrix< double > &  L 
) [private]

Compute spline-bending energy.

Definition at line 212 of file mbl_thin_plate_spline_3d.cxx.

vgl_point_3d< double > mbl_thin_plate_spline_3d::operator() ( double  x,
double  y,
double  z 
) const

Return transformed version of (x,y,z).

Definition at line 377 of file mbl_thin_plate_spline_3d.cxx.

vgl_point_3d<double> mbl_thin_plate_spline_3d::operator() ( const vgl_point_3d< double > &  p) const [inline]

Return transformed version of (x,y,z).

Definition at line 100 of file mbl_thin_plate_spline_3d.h.

bool mbl_thin_plate_spline_3d::operator== ( const mbl_thin_plate_spline_3d tps) const

Comparison operator.

Definition at line 494 of file mbl_thin_plate_spline_3d.cxx.

void mbl_thin_plate_spline_3d::print_summary ( vcl_ostream &  os) const

Print class to os.

Definition at line 419 of file mbl_thin_plate_spline_3d.cxx.

void mbl_thin_plate_spline_3d::set_params ( const vnl_vector< double > &  W1,
const vnl_vector< double > &  W2,
const vnl_vector< double > &  W3 
) [private]

Set parameters from vectors.

Definition at line 172 of file mbl_thin_plate_spline_3d.cxx.

void mbl_thin_plate_spline_3d::set_source_pts ( const vcl_vector< vgl_point_3d< double > > &  source_pts)

Define source point positions.

Performs pre-computations so that build(dest_points) can be called multiple times efficiently

Definition at line 321 of file mbl_thin_plate_spline_3d.cxx.

void mbl_thin_plate_spline_3d::set_up_rhs ( vnl_vector< double > &  Bx,
vnl_vector< double > &  By,
vnl_vector< double > &  Bz,
const vcl_vector< vgl_point_3d< double > > &  dest_pts 
) [private]

Definition at line 242 of file mbl_thin_plate_spline_3d.cxx.

short mbl_thin_plate_spline_3d::version_no ( ) const

Version number for I/O.

Definition at line 408 of file mbl_thin_plate_spline_3d.cxx.


Member Data Documentation

Definition at line 45 of file mbl_thin_plate_spline_3d.h.

Definition at line 45 of file mbl_thin_plate_spline_3d.h.

Definition at line 45 of file mbl_thin_plate_spline_3d.h.

Definition at line 45 of file mbl_thin_plate_spline_3d.h.

Definition at line 46 of file mbl_thin_plate_spline_3d.h.

Definition at line 46 of file mbl_thin_plate_spline_3d.h.

Definition at line 46 of file mbl_thin_plate_spline_3d.h.

Definition at line 46 of file mbl_thin_plate_spline_3d.h.

Definition at line 47 of file mbl_thin_plate_spline_3d.h.

Definition at line 47 of file mbl_thin_plate_spline_3d.h.

Definition at line 47 of file mbl_thin_plate_spline_3d.h.

Definition at line 47 of file mbl_thin_plate_spline_3d.h.

Definition at line 48 of file mbl_thin_plate_spline_3d.h.

Definition at line 48 of file mbl_thin_plate_spline_3d.h.

Definition at line 48 of file mbl_thin_plate_spline_3d.h.

Used to estimate weights in set_source_points().

Definition at line 53 of file mbl_thin_plate_spline_3d.h.

vcl_vector<vgl_point_3d<double> > mbl_thin_plate_spline_3d::src_pts_ [private]

Definition at line 50 of file mbl_thin_plate_spline_3d.h.

Definition at line 44 of file mbl_thin_plate_spline_3d.h.

Definition at line 44 of file mbl_thin_plate_spline_3d.h.

Definition at line 44 of file mbl_thin_plate_spline_3d.h.


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