Orfeo Toolbox  3.16
itkRigid2DTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkRigid2DTransform.h,v $
5  Language: C++
6  Date: $Date: 2009-11-29 01:38:00 $
7  Version: $Revision: 1.26 $
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 #ifndef __itkRigid2DTransform_h
18 #define __itkRigid2DTransform_h
19 
20 #include <iostream>
22 #include "itkExceptionObject.h"
23 
24 namespace itk
25 {
26 
57 template < class TScalarType=double > // Data type for scalars (float or double)
59  public MatrixOffsetTransformBase< TScalarType, 2, 2> // Dimensions of input and output spaces
60 {
61 public:
67 
70 
72  itkNewMacro( Self );
73 
75  itkStaticConstMacro(InputSpaceDimension, unsigned int, 2);
76  itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
77  itkStaticConstMacro(ParametersDimension, unsigned int, 3);
78 
80  typedef typename Superclass::ScalarType ScalarType;
81 
83  typedef typename Superclass::ParametersType ParametersType;
84  typedef typename Superclass::ParametersValueType ParametersValueType;
85 
87  typedef typename Superclass::JacobianType JacobianType;
88 
91  typedef typename Superclass::MatrixValueType MatrixValueType;
92 
94  typedef typename Superclass::OffsetType OffsetType;
95  typedef typename Superclass::OffsetValueType OffsetValueType;
96 
98  typedef typename Superclass::InputVectorType InputVectorType;
99  typedef typename Superclass::OutputVectorType OutputVectorType;
100  typedef typename Superclass::OutputVectorValueType OutputVectorValueType;
101 
103  typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
104  typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
105 
107  typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
108  typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
109 
111  typedef typename Superclass::InputPointType InputPointType;
112  typedef typename Superclass::OutputPointType OutputPointType;
113 
118 
131  virtual void SetMatrix( const MatrixType & matrix );
132 
138  virtual void SetRotationMatrix(const MatrixType &matrix)
139  { this->SetMatrix( matrix ); }
140  const MatrixType & GetRotationMatrix() const
141  { return this->GetMatrix(); }
142 
143 
151  void Translate(const OffsetType &offset, bool pre=false);
152 
161  inline InputPointType BackTransform(const OutputPointType &point ) const;
162  inline InputVectorType BackTransform(const OutputVectorType &vector) const;
163  inline InputVnlVectorType BackTransform(const OutputVnlVectorType &vector) const;
164 
165  inline InputCovariantVectorType BackTransform(
166  const OutputCovariantVectorType &vector) const;
167 
169  void SetAngle(TScalarType angle);
170  itkGetConstReferenceMacro( Angle, TScalarType );
171 
173  void SetAngleInDegrees(TScalarType angle);
174 
178  void SetRotation(TScalarType angle)
179  { this->SetAngle(angle); }
180  virtual const TScalarType & GetRotation() const
181  { return m_Angle; }
182 
191  void SetParameters( const ParametersType & parameters );
192 
201  const ParametersType & GetParameters( void ) const;
202 
207  const JacobianType & GetJacobian(const InputPointType &point ) const;
208 
213  void CloneInverseTo( Pointer & newinverse ) const;
214 
216  bool GetInverse(Self* inverse) const;
217 
219  virtual InverseTransformBasePointer GetInverseTransform() const;
220 
225  void CloneTo( Pointer & clone ) const;
226 
228  virtual void SetIdentity(void);
229 
230 protected:
232  Rigid2DTransform( unsigned int outputSpaceDimension,
233  unsigned int parametersDimension);
234 
235  ~Rigid2DTransform();
236 
240  void PrintSelf(std::ostream &os, Indent indent) const;
241 
245  virtual void ComputeMatrix(void);
246 
251  virtual void ComputeMatrixParameters(void);
252 
254  void SetVarAngle( TScalarType angle )
255  { m_Angle = angle; }
256 
257 private:
258  Rigid2DTransform(const Self&); //purposely not implemented
259  void operator=(const Self&); //purposely not implemented
260 
261  TScalarType m_Angle;
262 
263 }; //class Rigid2DTransform
264 
265 
266 // Back transform a point
267 template<class TScalarType>
268 inline
271 BackTransform(const OutputPointType &point) const
272 {
273  itkWarningMacro(
274  <<"BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."
275  );
276  return this->GetInverseMatrix() * (point - this->GetOffset());
277 }
278 
279 // Back transform a vector
280 template<class TScalarType>
281 inline
284 BackTransform(const OutputVectorType &vect ) const
285 {
286  itkWarningMacro(
287  <<"BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."
288  );
289  return this->GetInverseMatrix() * vect;
290 }
291 
292 // Back transform a vnl_vector
293 template<class TScalarType>
294 inline
297 BackTransform(const OutputVnlVectorType &vect ) const
298 {
299  itkWarningMacro(
300  <<"BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."
301  );
302  return this->GetInverseMatrix() * vect;
303 }
304 
305 
306 // Back Transform a CovariantVector
307 template<class TScalarType>
308 inline
312 {
313  itkWarningMacro(
314  <<"BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."
315  );
316  return this->GetMatrix() * vect;
317 }
318 
319 } // namespace itk
320 
321 
322 // Define instantiation macro for this template.
323 #define ITK_TEMPLATE_Rigid2DTransform(_, EXPORT, x, y) namespace itk { \
324  _(1(class EXPORT Rigid2DTransform< ITK_TEMPLATE_1 x >)) \
325  namespace Templates { typedef Rigid2DTransform< ITK_TEMPLATE_1 x > Rigid2DTransform##y; } \
326  }
327 
328 #if ITK_TEMPLATE_EXPLICIT
329 # include "Templates/itkRigid2DTransform+-.h"
330 #endif
331 
332 #if ITK_TEMPLATE_TXX
333 # include "itkRigid2DTransform.txx"
334 #endif
335 
336 #endif /* __itkRigid2DTransform_h */

Generated at Sun Feb 3 2013 00:03:30 for Orfeo Toolbox with doxygen 1.8.1.1