aimstil  5.0.5
AffineMap.h
Go to the documentation of this file.
1 #ifndef TIL_AFFINE_MAP_H
2 #define TIL_AFFINE_MAP_H
3 
4 // includes from TIL library
5 #include "til/til_common.h"
6 #include "til/AffineTransform.h"
7 #include "til/labels.h"
8 #include "til/Matrix3.h"
9 #include "til/numeric_array.h"
10 #include "til/traits.h"
11 
12 namespace til
13 {
14 
16  // NB: It is not clear yet how to disambiguate between world coord and
17  // voxel coords.
18  template < typename T >
19  class AffineMap : public Mapping_label, public detemplated_functor_label
20  {
21  public: // typedefs
22 
23  template < typename X >
24  struct TypeStruct
25  {
26  typedef X Type;
27  };
28 
29  typedef typename std::unary_function<numeric_array<T,3>, numeric_array<T,3> >::argument_type argument_type;
30  typedef typename std::unary_function<numeric_array<T,3>, numeric_array<T,3> >::result_type result_type;
31 
32  public: // constructors & destructor
33  AffineMap() {};
34  AffineMap(const Matrix3<T> &m, const numeric_array<T,3> &transl)
35  : m_data(m, transl) {};
36 
37  public: // set & get
38 
39  const Affine<T> & transfo() const { return m_data; }
40  Affine<T> & transfo() { return m_data; }
41 
42  public: // functions
43 
44  // removing this, because I want to have a real functor here... otherwise it
45  // starts being a mess in template expression... unless I decide to have the equivalent
46  // of std::unary/binary_function for detemplated functors...
47  /*
48  template < typename V >
49  inline
50  Vector<typename combine<T,V>::type, 3>
51  operator()(const Vector<V,3> &v) const
52  {
53  return m_data*v;
54  //return (*static_cast<Affine<T>*>(this))*v;
55  //return (*this)*v;
56  }
57  */
58 
59  template < typename X >
60  inline X
61  operator()(const X & v) const { return m_data * v; }
62 
63  //inline Vector<T,3> operator()(const Vector<T,3> & v) const { return m_data*v; }
64  //inline Point<T,3> operator()(const Point<T,3> & v) const { return m_data*v; }
65 
66  /*
67  INLINE
68  Vector<double,3>
69  operator()(const Vector<int,3> &v) const
70  {
71  return static_cast<Affine<T> >(*this)*v;
72  }
73  */
74 
75  private: // data
76 
77  Affine<T> m_data;
78  };
79 
80 }
81 
82 
83 #endif
84 
A affine mathematical object.
AffineMap(const Matrix3< T > &m, const numeric_array< T, 3 > &transl)
Definition: AffineMap.h:34
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
General macros, definitions and functions.
std::unary_function< numeric_array< T, 3 >, numeric_array< T, 3 > >::argument_type argument_type
Definition: AffineMap.h:29
Defines empty classes that serves as labels.
const Affine< T > & transfo() const
Definition: AffineMap.h:39
std::unary_function< numeric_array< T, 3 >, numeric_array< T, 3 > >::result_type result_type
Definition: AffineMap.h:30
A mathematical matrix.
Definition: Matrix3.h:90
Affine< T > & transfo()
Definition: AffineMap.h:40
X operator()(const X &v) const
Definition: AffineMap.h:61
Defines an affine coordinate transform.
Definition: AffineMap.h:19