Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkRigid2DTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkRigid2DTransform.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-09 09:23:21 $
00007   Version:   $Revision: 1.23 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkRigid2DTransform_h
00018 #define __itkRigid2DTransform_h
00019 
00020 #include <iostream>
00021 #include "itkMatrixOffsetTransformBase.h"
00022 #include "itkExceptionObject.h"
00023 
00024 namespace itk
00025 {
00026 
00057 template < class TScalarType=double >    // Data type for scalars (float or double)
00058 class ITK_EXPORT Rigid2DTransform : 
00059         public MatrixOffsetTransformBase< TScalarType, 2, 2> // Dimensions of input and output spaces
00060 {
00061 public:
00063   typedef Rigid2DTransform                               Self;
00064   typedef MatrixOffsetTransformBase< TScalarType, 2, 2 > Superclass;
00065   typedef SmartPointer<Self>                             Pointer;
00066   typedef SmartPointer<const Self>                       ConstPointer;
00067 
00069   itkTypeMacro( Rigid2DTransform, MatrixOffsetTransformBase );
00070 
00072   itkNewMacro( Self );
00073 
00075   itkStaticConstMacro(InputSpaceDimension, unsigned int, 2);
00076   itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
00077   itkStaticConstMacro(ParametersDimension, unsigned int, 3);
00079 
00081   typedef typename Superclass::ScalarType  ScalarType;
00082 
00084   typedef typename Superclass::ParametersType  ParametersType;
00085 
00087   typedef typename Superclass::JacobianType  JacobianType;
00088 
00090   typedef typename Superclass::MatrixType MatrixType;
00091 
00093   typedef typename Superclass::OffsetType OffsetType;
00094 
00096   typedef typename Superclass::InputVectorType  InputVectorType;
00097   typedef typename Superclass::OutputVectorType OutputVectorType;
00098 
00100   typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
00101   typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
00102 
00104   typedef typename Superclass::InputVnlVectorType  InputVnlVectorType;
00105   typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
00106 
00108   typedef typename Superclass::InputPointType  InputPointType;
00109   typedef typename Superclass::OutputPointType OutputPointType;
00110 
00113   typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
00114   typedef typename InverseTransformBaseType::Pointer    InverseTransformBasePointer;
00115 
00128   virtual void SetMatrix( const MatrixType & matrix );
00129 
00135   virtual void SetRotationMatrix(const MatrixType &matrix)
00136     { this->SetMatrix( matrix ); }
00137   const MatrixType & GetRotationMatrix() const
00138     { return this->GetMatrix(); }
00140 
00141 
00149   void Translate(const OffsetType &offset, bool pre=false);
00150 
00159   inline InputPointType      BackTransform(const OutputPointType  &point ) const;
00160   inline InputVectorType     BackTransform(const OutputVectorType &vector) const;
00161   inline InputVnlVectorType  BackTransform(const OutputVnlVectorType &vector) const;
00163 
00164   inline InputCovariantVectorType BackTransform(
00165                                      const OutputCovariantVectorType &vector) const;
00166 
00168   void SetAngle(TScalarType angle);
00169   itkGetConstReferenceMacro( Angle, TScalarType );
00171 
00173   void SetAngleInDegrees(TScalarType angle);
00174 
00178   void SetRotation(TScalarType angle)
00179     { this->SetAngle(angle); }
00180   virtual const TScalarType & GetRotation() const
00181     { return m_Angle; }  
00183 
00192   void SetParameters( const ParametersType & parameters );
00193 
00202   const ParametersType & GetParameters( void ) const;
00203 
00208   const JacobianType & GetJacobian(const InputPointType  &point ) const;
00209 
00214   void CloneInverseTo( Pointer & newinverse ) const;
00215 
00217   bool GetInverse(Self* inverse) const;
00218 
00220   virtual InverseTransformBasePointer GetInverseTransform() const;
00221 
00226   void CloneTo( Pointer & clone ) const;
00227 
00229   virtual void SetIdentity(void);
00230 
00231 protected:
00232   Rigid2DTransform();
00233   Rigid2DTransform( unsigned int outputSpaceDimension, 
00234                     unsigned int parametersDimension);
00235  
00236  ~Rigid2DTransform();
00237  
00241   void PrintSelf(std::ostream &os, Indent indent) const;
00242 
00246   virtual void ComputeMatrix(void);
00247 
00252   virtual void ComputeMatrixParameters(void);
00253 
00255   void SetVarAngle( TScalarType angle )
00256     { m_Angle = angle; }
00257 
00258 private:
00259   Rigid2DTransform(const Self&); //purposely not implemented
00260   void operator=(const Self&); //purposely not implemented
00261   
00262   TScalarType         m_Angle; 
00263 
00264 }; //class Rigid2DTransform
00265 
00266 
00267 // Back transform a point
00268 template<class TScalarType>
00269 inline
00270 typename Rigid2DTransform<TScalarType>::InputPointType
00271 Rigid2DTransform<TScalarType>::
00272 BackTransform(const OutputPointType &point) const 
00273 {
00274   itkWarningMacro(
00275     <<"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."
00276     );
00277   return this->GetInverseMatrix() * (point - this->GetOffset());
00278 }
00279 
00280 // Back transform a vector
00281 template<class TScalarType>
00282 inline
00283 typename Rigid2DTransform<TScalarType>::InputVectorType
00284 Rigid2DTransform<TScalarType>::
00285 BackTransform(const OutputVectorType &vect ) const 
00286 {
00287   itkWarningMacro(
00288     <<"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."
00289     );
00290   return this->GetInverseMatrix() * vect;
00291 }
00292 
00293 // Back transform a vnl_vector
00294 template<class TScalarType>
00295 inline
00296 typename Rigid2DTransform<TScalarType>::InputVnlVectorType
00297 Rigid2DTransform<TScalarType>::
00298 BackTransform(const OutputVnlVectorType &vect ) const 
00299 {
00300   itkWarningMacro(
00301     <<"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."
00302     );
00303   return this->GetInverseMatrix() * vect;
00304 }
00305 
00306 
00307 // Back Transform a CovariantVector
00308 template<class TScalarType>
00309 inline
00310 typename Rigid2DTransform<TScalarType>::InputCovariantVectorType
00311 Rigid2DTransform<TScalarType>::
00312 BackTransform(const OutputCovariantVectorType &vect) const 
00313 {
00314   itkWarningMacro(
00315     <<"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."
00316     );
00317   return this->GetMatrix() * vect;
00318 }
00319 
00320 }  // namespace itk
00321 
00322 
00323 // Define instantiation macro for this template.
00324 #define ITK_TEMPLATE_Rigid2DTransform(_, EXPORT, x, y) namespace itk { \
00325   _(1(class EXPORT Rigid2DTransform< ITK_TEMPLATE_1 x >)) \
00326   namespace Templates { typedef Rigid2DTransform< ITK_TEMPLATE_1 x > Rigid2DTransform##y; } \
00327   }
00328 
00329 #if ITK_TEMPLATE_EXPLICIT
00330 # include "Templates/itkRigid2DTransform+-.h"
00331 #endif
00332 
00333 #if ITK_TEMPLATE_TXX
00334 # include "itkRigid2DTransform.txx"
00335 #endif
00336 
00337 #endif /* __itkRigid2DTransform_h */
00338 

Generated at Tue Sep 15 04:41:41 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000