rsdl_borgefors< T > Class Template Reference

#include <rsdl_borgefors.h>

List of all members.


Detailed Description

template<class T>
class rsdl_borgefors< T >

Defines functions associated with a templated borgefors distance map.

The data based on which the map is built is a vector (should be changed to any stl container type later) of any datatype with x() and y() functions defined.

The computation of the distance map is done using 3-4 chamfer distance transform.

CAVEAT: To avoid data duplication, objects are stored as pointers in the map. Classes having rsdl_borgefors as the internal data should recompute the borgefors map when define the copy constructor and operator= To enforce this, the copy constructor and the operator= of rsdl_borgefors are not implemented and are private member functions to avoid default ones being generated by the compiler.

Definition at line 35 of file rsdl_borgefors.h.


Public Member Functions

 rsdl_borgefors ()
 default constructor.
 rsdl_borgefors (int org_x, int org_y, int size_x, int size_y, iterator_type begin, iterator_type end, bool release_dist_map=false)
 constructor: constructs a distance map, with dimensions set by size_x and size_y.
void set (int org_x, int org_y, int size_x, int size_y, iterator_type begin, iterator_type end, bool release_dist_map=false)
 sets distance and index maps, with dimensions set by size_x and size_y.
void set (int org_x, int org_y, int size_x, int size_y, iterator_type begin, iterator_type end, vbl_array_2d< int > index_map, vbl_array_2d< int > *distance_map=0)
 sets all data members from the caller.
void reset ()
 resets the data members.
bool is_valid () const
 returns true if the map contains valid data.
double distance (int x, int y) const
 returns approximated distance to between (x,y) and closest object in the map.
bool in_map (int x, int y) const
 verifies if (x,y) position is valid in the map.
const_iterator_type nearest (int x, int y) const
 returns a pointer to the closest object to (x,y) in the map.
int width () const
 returns width of the map.
int height () const
 returns height of the map.
void origin (int &start_x, int &start_y) const
 returns origin of the map.
const vbl_array_2d< int > & distance_map () const
const vbl_array_2d< int > & index_map () const
bool operator== (const rsdl_borgefors< T > &rhs) const
 equality (comparison) operator.

Private Types

typedef vcl_vector< T >::iterator iterator_type
typedef vcl_vector< T >::const_iterator const_iterator_type

Private Member Functions

 rsdl_borgefors (const rsdl_borgefors< T > &old)
 copy constructor, not implemented.
rsdl_borgefors< T > & operator= (const rsdl_borgefors< T > &rhs)
 assignment operator, not implemented.
void initialize (iterator_type begin, iterator_type end)
void chamfer34 ()
void forward_chamfer ()
 Performs a forward chamfer convolution on the distance_map_ and update the index_map_ accordingly.
void backward_chamfer ()
 Performs a forward chamfer convolution on the distance_map_ and update the index_map_ accordingly.
int minimum4 (int, int, int, int) const
 Determines the minimum of four ints.
int minimum5 (int, int, int, int, int) const
 Determines the minimum of five ints.

Private Attributes

bool is_valid_
int org_x_
int org_y_
int size_x_
int size_y_
vbl_array_2d< int > distance_map_
vbl_array_2d< int > index_map_
vcl_vector< iterator_typedata_

Member Typedef Documentation

template<class T>
typedef vcl_vector<T>::iterator rsdl_borgefors< T >::iterator_type [private]

Definition at line 37 of file rsdl_borgefors.h.

template<class T>
typedef vcl_vector<T>::const_iterator rsdl_borgefors< T >::const_iterator_type [private]

Definition at line 38 of file rsdl_borgefors.h.


Constructor & Destructor Documentation

template<class T>
rsdl_borgefors< T >::rsdl_borgefors (  ) 

default constructor.

Definition at line 18 of file rsdl_borgefors.txx.

template<class T>
rsdl_borgefors< T >::rsdl_borgefors ( int  org_x,
int  org_y,
int  size_x,
int  size_y,
iterator_type  begin,
iterator_type  end,
bool  release_dist_map = false 
)

constructor: constructs a distance map, with dimensions set by size_x and size_y.

Definition at line 24 of file rsdl_borgefors.txx.

template<class T>
rsdl_borgefors< T >::rsdl_borgefors ( const rsdl_borgefors< T > &  old  )  [private]

copy constructor, not implemented.


Member Function Documentation

template<class T>
void rsdl_borgefors< T >::set ( int  org_x,
int  org_y,
int  size_x,
int  size_y,
iterator_type  begin,
iterator_type  end,
bool  release_dist_map = false 
)

sets distance and index maps, with dimensions set by size_x and size_y.

Parameters:
org_x x-coord of the top left corner
org_y y-coord of the top left corner
size_x x dimension
size_y y dimension
begin begin ptr of the data vector
end end ptr of the data vector
release_dist_map should the distance map be released?

Definition at line 36 of file rsdl_borgefors.txx.

template<class T>
void rsdl_borgefors< T >::set ( int  org_x,
int  org_y,
int  size_x,
int  size_y,
iterator_type  begin,
iterator_type  end,
vbl_array_2d< int >  index_map,
vbl_array_2d< int > *  distance_map = 0 
)

sets all data members from the caller.

Parameters:
org_x x-coord of the top left corner
org_y y-coord of the top left corner
size_x x dimension
size_y y dimension
begin begin ptr of the data vector
end end ptr of the data vector
index_map index map
distance_map distance map

Definition at line 52 of file rsdl_borgefors.txx.

template<class T>
void rsdl_borgefors< T >::reset (  ) 

resets the data members.

Definition at line 87 of file rsdl_borgefors.txx.

template<class T>
bool rsdl_borgefors< T >::is_valid (  )  const [inline]

returns true if the map contains valid data.

Definition at line 74 of file rsdl_borgefors.h.

template<class T>
double rsdl_borgefors< T >::distance ( int  x,
int  y 
) const

returns approximated distance to between (x,y) and closest object in the map.

If (x,y) is out of range, -1 is returned instead.

Definition at line 110 of file rsdl_borgefors.txx.

template<class T>
bool rsdl_borgefors< T >::in_map ( int  x,
int  y 
) const

verifies if (x,y) position is valid in the map.

Definition at line 98 of file rsdl_borgefors.txx.

template<class T>
rsdl_borgefors< T >::const_iterator_type rsdl_borgefors< T >::nearest ( int  x,
int  y 
) const

returns a pointer to the closest object to (x,y) in the map.

It aborts if (x,y) not in map. Should always check in_map(x,y) first.

Definition at line 123 of file rsdl_borgefors.txx.

template<class T>
int rsdl_borgefors< T >::width (  )  const [inline]

returns width of the map.

Definition at line 85 of file rsdl_borgefors.h.

template<class T>
int rsdl_borgefors< T >::height (  )  const [inline]

returns height of the map.

Definition at line 87 of file rsdl_borgefors.h.

template<class T>
void rsdl_borgefors< T >::origin ( int &  start_x,
int &  start_y 
) const

returns origin of the map.

Definition at line 133 of file rsdl_borgefors.txx.

template<class T>
const vbl_array_2d<int>& rsdl_borgefors< T >::distance_map (  )  const [inline]

Definition at line 92 of file rsdl_borgefors.h.

template<class T>
const vbl_array_2d<int>& rsdl_borgefors< T >::index_map (  )  const [inline]

Definition at line 93 of file rsdl_borgefors.h.

template<class T>
bool rsdl_borgefors< T >::operator== ( const rsdl_borgefors< T > &  rhs  )  const

equality (comparison) operator.

Definition at line 141 of file rsdl_borgefors.txx.

template<class T>
rsdl_borgefors<T>& rsdl_borgefors< T >::operator= ( const rsdl_borgefors< T > &  rhs  )  [private]

assignment operator, not implemented.

template<class T>
void rsdl_borgefors< T >::initialize ( iterator_type  begin,
iterator_type  end 
) [private]

Definition at line 150 of file rsdl_borgefors.txx.

template<class T>
void rsdl_borgefors< T >::chamfer34 (  )  [private]

Definition at line 199 of file rsdl_borgefors.txx.

template<class T>
void rsdl_borgefors< T >::forward_chamfer (  )  [private]

Performs a forward chamfer convolution on the distance_map_ and update the index_map_ accordingly.

Definition at line 245 of file rsdl_borgefors.txx.

template<class T>
void rsdl_borgefors< T >::backward_chamfer (  )  [private]

Performs a forward chamfer convolution on the distance_map_ and update the index_map_ accordingly.

Definition at line 321 of file rsdl_borgefors.txx.

template<class T>
int rsdl_borgefors< T >::minimum4 ( int  ,
int  ,
int  ,
int   
) const [inline, private]

Determines the minimum of four ints.

Definition at line 229 of file rsdl_borgefors.txx.

template<class T>
int rsdl_borgefors< T >::minimum5 ( int  ,
int  ,
int  ,
int  ,
int   
) const [inline, private]

Determines the minimum of five ints.

Definition at line 211 of file rsdl_borgefors.txx.


Member Data Documentation

template<class T>
bool rsdl_borgefors< T >::is_valid_ [private]

Definition at line 112 of file rsdl_borgefors.h.

template<class T>
int rsdl_borgefors< T >::org_x_ [private]

Definition at line 113 of file rsdl_borgefors.h.

template<class T>
int rsdl_borgefors< T >::org_y_ [private]

Definition at line 113 of file rsdl_borgefors.h.

template<class T>
int rsdl_borgefors< T >::size_x_ [private]

Definition at line 113 of file rsdl_borgefors.h.

template<class T>
int rsdl_borgefors< T >::size_y_ [private]

Definition at line 113 of file rsdl_borgefors.h.

template<class T>
vbl_array_2d<int> rsdl_borgefors< T >::distance_map_ [private]

Definition at line 114 of file rsdl_borgefors.h.

template<class T>
vbl_array_2d<int> rsdl_borgefors< T >::index_map_ [private]

Definition at line 115 of file rsdl_borgefors.h.

template<class T>
vcl_vector<iterator_type> rsdl_borgefors< T >::data_ [private]

Definition at line 116 of file rsdl_borgefors.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 8 05:26:58 2010 for contrib/rpl/rsdl by  doxygen 1.5.1