KWStyle - itkTranslationTransform.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkTranslationTransform.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17
18 #ifndef __itkTranslationTransform_h
19 #define __itkTranslationTransform_h
20
21 #include <iostream>
22 #include "itkTransform.h"
23 #include "itkExceptionObject.h"
24 #include "itkMatrix.h"
25
26
27 EML
28 EML
29 namespace itk
30 {
31
32 /** \brief Translation transformation of a vector space (e.g. space coordinates)
33  *
34  * The same functionality could be obtained by using the Affine tranform,
35  * but with a large difference in performace.
36  *
37  * \ingroup Transforms
38  */
39 template <
40 LEN     class TScalarType=double,          // Data type for scalars (float or double)
41     unsigned int NDimensions=3>        // Number of dimensions
42 MCM class ITK_EXPORT TranslationTransform : 
43 IND **********public Transform< TScalarType, NDimensions, NDimensions >
44 {
45 public:
46   /** Standard class typedefs. */
47   typedef TranslationTransform Self;
48 TDA   typedef Transform< TScalarType, NDimensions, NDimensions > Superclass;
49 TDA   typedef SmartPointer<Self>        Pointer;
50 TDA   typedef SmartPointer<const Self>  ConstPointer;
51       
52   /** New macro for creation of through the object factory.*/
53   itkNewMacro( Self );
54
55   /** Run-time type information (and related methods). */
56   itkTypeMacro( TranslationTransform, Transform );
57
58   /** Dimension of the domain space. */
59   itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
60   itkStaticConstMacro(ParametersDimension, unsigned int, NDimensions);
61
62   /** Standard scalar type for this class. */
63   typedef typename Superclass::ScalarType ScalarType;
64
65   /** Standard parameters container. */
66   typedef typename Superclass::ParametersType ParametersType;
67
68   /** Standard Jacobian container. */
69   typedef typename Superclass::JacobianType JacobianType;
70
71   /** Standard vector type for this class. */
72 LEN   typedef Vector<TScalarType, itkGetStaticConstMacro(SpaceDimension)> InputVectorType;
73 LEN   typedef Vector<TScalarType, itkGetStaticConstMacro(SpaceDimension)> OutputVectorType;
74
75   /** Standard covariant vector type for this class. */
76 LEN   typedef CovariantVector<TScalarType, itkGetStaticConstMacro(SpaceDimension)> InputCovariantVectorType;
77 LEN   typedef CovariantVector<TScalarType, itkGetStaticConstMacro(SpaceDimension)> OutputCovariantVectorType;
78   
79   /** Standard vnl_vector type for this class. */
80 LEN   typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(SpaceDimension)> InputVnlVectorType;
81 LEN   typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(SpaceDimension)> OutputVnlVectorType;
82   
83   /** Standard coordinate point type for this class. */
84 LEN   typedef Point<TScalarType, itkGetStaticConstMacro(SpaceDimension)> InputPointType;
85 LEN   typedef Point<TScalarType, itkGetStaticConstMacro(SpaceDimension)> OutputPointType;
86   
87   /** This method returns the value of the offset of the
88    * TranslationTransform. */
89   const OutputVectorType & GetOffset(void) const
90     { return m_Offset; }
91
92   /** This method sets the parameters for the transform
93    * value specified by the user. */
94   void SetParameters(const ParametersType & parameters);
95
96   /** Get the Transformation Parameters. */
97   virtual const ParametersType& GetParameters(void) const;
98
99   /** Set offset of an Translation Transform.
100    * This method sets the offset of an TranslationTransform to a
101    * value specified by the user. */
102   void SetOffset(const OutputVectorType &offset)
103     { m_Offset = offset; return; }
104
105   /** Compose with another TranslationTransform. */
106   void Compose(const Self * other, bool pre=0);
107
108   /** Compose affine transformation with a translation.
109    * This method modifies self to include a translation of the
110    * origin.  The translation is precomposed with self if pre is
111    * true, and postcomposed otherwise. */
112   void Translate(const OutputVectorType &offset, bool pre=0);
113
114   /** Transform by an affine transformation.
115    * This method applies the affine transform given by self to a
116    * given point or vector, returning the transformed point or
117    * vector. */
118   OutputPointType     TransformPoint(const InputPointType  &point ) const;
119   OutputVectorType    TransformVector(const InputVectorType &vector) const;
120   OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const;
121   OutputCovariantVectorType TransformCovariantVector(
122     const InputCovariantVectorType &vector) const;
123   
124   /** This method finds the point or vector that maps to a given
125    * point or vector under the affine transformation defined by
126    * self.  If no such point exists, an exception is thrown. */
127   inline InputPointType    BackTransform(const OutputPointType  &point ) const;
128   inline InputVectorType   BackTransform(const OutputVectorType &vector) const;
129 LEN   inline InputVnlVectorType BackTransform(const OutputVnlVectorType &vector) const;
130   inline InputCovariantVectorType BackTransform(
131     const OutputCovariantVectorType &vector) const;
132   
133   /** Find inverse of an affine transformation.
134    * This method creates and returns a new TranslationTransform object
135    * which is the inverse of self.  If self is not invertible,
136    * false is returned.  */
137   bool GetInverse(Self* inverse) const;
138
139   /** Compute the Jacobian Matrix of the transformation at one point */
140   virtual const JacobianType & GetJacobian(const InputPointType  &point ) const;
141
142   /** Set the parameters to the IdentityTransform */
143   void SetIdentity(void);
144
145   /** Return the number of parameters that completely define the Transfom  */
146   virtual unsigned int GetNumberOfParameters(void) const 
147 IND **********************{ return NDimensions; }
148
149
150 protected:
151   TranslationTransform();
152   ~TranslationTransform();
153   /** Print contents of an TranslationTransform. */
154   void PrintSelf(std::ostream &os, Indent indent) const;
155
156 private:
157   TranslationTransform(const Self&); //purposely not implemented
158   void operator=(const Self&); //purposely not implemented
159
160   OutputVectorType   m_Offset;       // Offset of the transformation
161
162
163 }; //class TranslationTransform
164
165
166 }  // namespace itk
167
168
169 #ifndef ITK_MANUAL_INSTANTIATION
170 #include "itkTranslationTransform.txx"
171 #endif
172
173 #endif /* __itkTranslationTransform_h */
174

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:50PM
© Kitware Inc.