Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
rgrl_spline Class Reference

A tensor-product B-spline in 4D can be written in. More...

#include <rgrl_spline.h>

Inheritance diagram for rgrl_spline:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 rgrl_spline ()
 Constructor.
 rgrl_spline (vnl_vector< unsigned > const &m)
 rgrl_spline (vnl_vector< unsigned > const &m, vnl_vector< double > const &c)
 ~rgrl_spline ()
 Destructor.
void set_control_points (vnl_vector< double > const &c)
 Set controls points.
vnl_vector< double > const & get_control_points () const
vnl_vector< double > & get_control_points ()
double f_x (vnl_vector< double > const &x) const
 The spline value.
vnl_vector< double > jacobian (vnl_vector< double > const &x) const
void basis_response (vnl_vector< double > const &point, vnl_vector< double > &br) const
 The basis responses at $(x,y,z)$.
void thin_plate_regularization (vnl_matrix< double > &regularization) const
unsigned num_of_control_points () const
rgrl_spline_sptr refinement (vnl_vector< unsigned > const &new_m) const
 Generate a refined B-spline that produces the same surface.
 rgrl_type_macro (rgrl_spline, rgrl_object)
virtual bool is_type (const vcl_type_info &type) const
void set_debug_flag (unsigned int debugFlag) const
 Set the value of the debug flag. A non-zero value turns debugging on.
unsigned int debug_flag () const
 Get the value of the debug flag.
void set_warning (bool) const
 Set the flag for warning messages.
bool warning () const
 Get the warning flag.
unsigned int add_observer (rgrl_event_sptr event, rgrl_command_sptr)
 Allow people to add/remove/invoke observers (callbacks) to any rgrl object.
rgrl_command_sptr get_command (unsigned int tag)
 Get the command associated with the given tag.
void invoke_event (const rgrl_event &)
 Call execute(.) on all the rgrl_commands observing this event id.
void invoke_event (const rgrl_event &) const
 Call execute(.) on all the rgrl_commands observing this event id.
void remove_observer (unsigned int tag)
 Remove the observer with this tag value.
bool has_observer (const rgrl_event &event) const
 Return true if an observer is registered for this event.
void ref ()
void unref ()
int get_references () const
bool is_referenced () const

Static Public Member Functions

static const vcl_type_info & type_id ()

Private Types

typedef double(* func_type )(int i, double u)

Private Member Functions

double element_1d_thin_plate (unsigned i, unsigned j) const
double element_2d_thin_plate (unsigned i, unsigned j) const
double element_3d_thin_plate (unsigned i, unsigned j) const
void basis_response_helper (vnl_vector< double > const &point, vnl_vector< double > &br, func_type func) const

Private Attributes

vnl_vector< unsigned > m_
vnl_vector< double > c_

Friends

class test_rgrl_spline
vcl_ostream & operator<< (vcl_ostream &os, rgrl_spline const &spline)
vcl_istream & operator>> (vcl_istream &is, rgrl_spline &spline)

Detailed Description

A tensor-product B-spline in 4D can be written in.

\[ \mathbf{Q}_{ijk}(u,v,w) = \sum_{r=0}^{3} \sum_{s=0}^{3} \sum_{t=0}^{3}V_{i+r,j+s,k+t} b_r(u) b_s(v) b_t(w) \]

where

   i=\ceil{x}-1,  i=\ceil{y}-1, i=\ceil{z}-1,
   

and $u=x-i$, $v=y-j$ $w=z-k$ are local parameters ranging in $[0,1)$ and

\[ b_{3}(u) = \frac{1}{6}u^3 \]

\[ b_{2}(u) = \frac{1}{6}(-3u^3+3u^2+3u+1) \]

\[ b_{1}(u) = \frac{1}{6}(3u^3-6u^2+4) \]

\[ b_{0}(u) = \frac{1}{6}(1-u)^3 \]

or can be expressed in

\[ \mathbf{Q}_(x,y,z)= \sum_{i=-1}^{m+1} \sum_{j=-1}^{n+1} \sum_{k=-1}^{l+1}V_{ijk} B_i(x) B_j(y) B_k(z) \]

The control vertex $V_{0,0,0}$ is located at $(0,0,0)$.

Definition at line 45 of file rgrl_spline.h.


Member Typedef Documentation

typedef double(* rgrl_spline::func_type)(int i, double u) [private]

Definition at line 122 of file rgrl_spline.h.


Constructor & Destructor Documentation

rgrl_spline::rgrl_spline ( ) [inline]

Constructor.

Definition at line 50 of file rgrl_spline.h.

rgrl_spline::rgrl_spline ( vnl_vector< unsigned > const &  m)

Definition at line 27 of file rgrl_spline.cxx.

rgrl_spline::rgrl_spline ( vnl_vector< unsigned > const &  m,
vnl_vector< double > const &  c 
)

Definition at line 38 of file rgrl_spline.cxx.

rgrl_spline::~rgrl_spline ( ) [inline]

Destructor.

Definition at line 70 of file rgrl_spline.h.


Member Function Documentation

unsigned int rgrl_object::add_observer ( rgrl_event_sptr  event,
rgrl_command_sptr  cmd 
) [inherited]

Allow people to add/remove/invoke observers (callbacks) to any rgrl object.

This is an implementation of the subject/observer design pattern. An observer is added by specifying an event to respond to and an rgrl_command to execute. It returns an unsigned long tag which can be used later to remove the event or retrieve the command.

Definition at line 47 of file rgrl_object.cxx.

void rgrl_spline::basis_response ( vnl_vector< double > const &  point,
vnl_vector< double > &  br 
) const

The basis responses at $(x,y,z)$.

It returns a 1 by $(m_[0]+3)*(m_[1]+3)*(m_[2]+3)$ vector which contains [ $B_{-1}(x)*B_{-1}(y)*B_{-1}(z)$,..., $B_{m_[0]+1}(x)B_{m_[1]+1}(y)B_{m_[2]+1}(z)$], in the same order as in c_

Definition at line 178 of file rgrl_spline.cxx.

void rgrl_spline::basis_response_helper ( vnl_vector< double > const &  point,
vnl_vector< double > &  br,
func_type  func 
) const [private]

Definition at line 185 of file rgrl_spline.cxx.

unsigned int rgrl_object::debug_flag ( ) const [inherited]

Get the value of the debug flag.

Definition at line 26 of file rgrl_object.cxx.

double rgrl_spline::element_1d_thin_plate ( unsigned  i,
unsigned  j 
) const [private]

Definition at line 248 of file rgrl_spline.cxx.

double rgrl_spline::element_2d_thin_plate ( unsigned  i,
unsigned  j 
) const [private]

Definition at line 266 of file rgrl_spline.cxx.

double rgrl_spline::element_3d_thin_plate ( unsigned  i,
unsigned  j 
) const [private]

Definition at line 306 of file rgrl_spline.cxx.

double rgrl_spline::f_x ( vnl_vector< double > const &  x) const

The spline value.

\[ f(\overline{u},y,z) = \sum_{i=-1}^{m[0]_+1} \sum_{j=-1}^{m[1]_+1} \sum_{k=-1}^{m_[2]+1} V_{ijk} * B_i(x) * B_j(y) * B_k(z)\]

Definition at line 66 of file rgrl_spline.cxx.

rgrl_command_sptr rgrl_object::get_command ( unsigned int  tag) [inherited]

Get the command associated with the given tag.

Definition at line 57 of file rgrl_object.cxx.

vnl_vector< double > const& rgrl_spline::get_control_points ( ) const [inline]

Definition at line 74 of file rgrl_spline.h.

vnl_vector< double >& rgrl_spline::get_control_points ( ) [inline]

Definition at line 75 of file rgrl_spline.h.

bool rgrl_object::has_observer ( const rgrl_event event) const [inherited]

Return true if an observer is registered for this event.

Definition at line 107 of file rgrl_object.cxx.

void rgrl_object::invoke_event ( const rgrl_event event) [inherited]

Call execute(.) on all the rgrl_commands observing this event id.

Definition at line 69 of file rgrl_object.cxx.

void rgrl_object::invoke_event ( const rgrl_event event) const [inherited]

Call execute(.) on all the rgrl_commands observing this event id.

The actions triggered by this call doesn't modify this object.

Definition at line 83 of file rgrl_object.cxx.

virtual bool rgrl_object::is_type ( const vcl_type_info &  type) const [inline, virtual, inherited]

Reimplemented in rgrl_scale_estimator.

Definition at line 66 of file rgrl_object.h.

vnl_vector< double > rgrl_spline::jacobian ( vnl_vector< double > const &  x) const

Definition at line 90 of file rgrl_spline.cxx.

unsigned rgrl_spline::num_of_control_points ( ) const [inline]

Definition at line 95 of file rgrl_spline.h.

rgrl_spline_sptr rgrl_spline::refinement ( vnl_vector< unsigned > const &  new_m) const

Generate a refined B-spline that produces the same surface.

Definition at line 671 of file rgrl_spline.cxx.

void rgrl_object::remove_observer ( unsigned int  tag) [inherited]

Remove the observer with this tag value.

Definition at line 97 of file rgrl_object.cxx.

rgrl_spline::rgrl_type_macro ( rgrl_spline  ,
rgrl_object   
)
void rgrl_spline::set_control_points ( vnl_vector< double > const &  c)

Set controls points.

Definition at line 49 of file rgrl_spline.cxx.

void rgrl_object::set_debug_flag ( unsigned int  debugFlag) const [inherited]

Set the value of the debug flag. A non-zero value turns debugging on.

Definition at line 19 of file rgrl_object.cxx.

void rgrl_object::set_warning ( bool  flag) const [inherited]

Set the flag for warning messages.

Definition at line 33 of file rgrl_object.cxx.

void rgrl_spline::thin_plate_regularization ( vnl_matrix< double > &  regularization) const

Definition at line 362 of file rgrl_spline.cxx.

static const vcl_type_info& rgrl_object::type_id ( ) [inline, static, inherited]

Reimplemented in rgrl_scale_estimator.

Definition at line 63 of file rgrl_object.h.

bool rgrl_object::warning ( ) const [inherited]

Get the warning flag.

Definition at line 40 of file rgrl_object.cxx.


Friends And Related Function Documentation

vcl_ostream& operator<< ( vcl_ostream &  os,
rgrl_spline const &  spline 
) [friend]

Definition at line 842 of file rgrl_spline.cxx.

vcl_istream& operator>> ( vcl_istream &  is,
rgrl_spline spline 
) [friend]

Definition at line 857 of file rgrl_spline.cxx.

friend class test_rgrl_spline [friend]

Definition at line 98 of file rgrl_spline.h.


Member Data Documentation

vnl_vector<double> rgrl_spline::c_ [private]

Definition at line 137 of file rgrl_spline.h.

vnl_vector< unsigned > rgrl_spline::m_ [private]

Definition at line 127 of file rgrl_spline.h.


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