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-11-29 01:38:00 $
00007   Version:   $Revision: 1.26 $
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   typedef typename Superclass::ParametersValueType  ParametersValueType;
00086 
00088   typedef typename Superclass::JacobianType  JacobianType;
00089 
00091   typedef typename Superclass::MatrixType         MatrixType;
00092   typedef typename Superclass::MatrixValueType    MatrixValueType;
00093 
00095   typedef typename Superclass::OffsetType         OffsetType;
00096   typedef typename Superclass::OffsetValueType    OffsetValueType;
00097 
00099   typedef typename Superclass::InputVectorType        InputVectorType;
00100   typedef typename Superclass::OutputVectorType       OutputVectorType;
00101   typedef typename Superclass::OutputVectorValueType  OutputVectorValueType;
00102 
00104   typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
00105   typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
00106 
00108   typedef typename Superclass::InputVnlVectorType  InputVnlVectorType;
00109   typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
00110 
00112   typedef typename Superclass::InputPointType  InputPointType;
00113   typedef typename Superclass::OutputPointType OutputPointType;
00114 
00117   typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
00118   typedef typename InverseTransformBaseType::Pointer    InverseTransformBasePointer;
00119 
00132   virtual void SetMatrix( const MatrixType & matrix );
00133 
00139   virtual void SetRotationMatrix(const MatrixType &matrix)
00140     { this->SetMatrix( matrix ); }
00141   const MatrixType & GetRotationMatrix() const
00142     { return this->GetMatrix(); }
00144 
00145 
00153   void Translate(const OffsetType &offset, bool pre=false);
00154 
00163   inline InputPointType      BackTransform(const OutputPointType  &point ) const;
00164   inline InputVectorType     BackTransform(const OutputVectorType &vector) const;
00165   inline InputVnlVectorType  BackTransform(const OutputVnlVectorType &vector) const;
00167 
00168   inline InputCovariantVectorType BackTransform(
00169                                      const OutputCovariantVectorType &vector) const;
00170 
00172   void SetAngle(TScalarType angle);
00173   itkGetConstReferenceMacro( Angle, TScalarType );
00175 
00177   void SetAngleInDegrees(TScalarType angle);
00178 
00182   void SetRotation(TScalarType angle)
00183     { this->SetAngle(angle); }
00184   virtual const TScalarType & GetRotation() const
00185     { return m_Angle; }  
00187 
00196   void SetParameters( const ParametersType & parameters );
00197 
00206   const ParametersType & GetParameters( void ) const;
00207 
00212   const JacobianType & GetJacobian(const InputPointType  &point ) const;
00213 
00218   void CloneInverseTo( Pointer & newinverse ) const;
00219 
00221   bool GetInverse(Self* inverse) const;
00222 
00224   virtual InverseTransformBasePointer GetInverseTransform() const;
00225 
00230   void CloneTo( Pointer & clone ) const;
00231 
00233   virtual void SetIdentity(void);
00234 
00235 protected:
00236   Rigid2DTransform();
00237   Rigid2DTransform( unsigned int outputSpaceDimension, 
00238                     unsigned int parametersDimension);
00239  
00240  ~Rigid2DTransform();
00241  
00245   void PrintSelf(std::ostream &os, Indent indent) const;
00246 
00250   virtual void ComputeMatrix(void);
00251 
00256   virtual void ComputeMatrixParameters(void);
00257 
00259   void SetVarAngle( TScalarType angle )
00260     { m_Angle = angle; }
00261 
00262 private:
00263   Rigid2DTransform(const Self&); //purposely not implemented
00264   void operator=(const Self&); //purposely not implemented
00265   
00266   TScalarType         m_Angle; 
00267 
00268 }; //class Rigid2DTransform
00269 
00270 
00271 // Back transform a point
00272 template<class TScalarType>
00273 inline
00274 typename Rigid2DTransform<TScalarType>::InputPointType
00275 Rigid2DTransform<TScalarType>::
00276 BackTransform(const OutputPointType &point) const 
00277 {
00278   itkWarningMacro(
00279     <<"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."
00280     );
00281   return this->GetInverseMatrix() * (point - this->GetOffset());
00282 }
00283 
00284 // Back transform a vector
00285 template<class TScalarType>
00286 inline
00287 typename Rigid2DTransform<TScalarType>::InputVectorType
00288 Rigid2DTransform<TScalarType>::
00289 BackTransform(const OutputVectorType &vect ) const 
00290 {
00291   itkWarningMacro(
00292     <<"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."
00293     );
00294   return this->GetInverseMatrix() * vect;
00295 }
00296 
00297 // Back transform a vnl_vector
00298 template<class TScalarType>
00299 inline
00300 typename Rigid2DTransform<TScalarType>::InputVnlVectorType
00301 Rigid2DTransform<TScalarType>::
00302 BackTransform(const OutputVnlVectorType &vect ) const 
00303 {
00304   itkWarningMacro(
00305     <<"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."
00306     );
00307   return this->GetInverseMatrix() * vect;
00308 }
00309 
00310 
00311 // Back Transform a CovariantVector
00312 template<class TScalarType>
00313 inline
00314 typename Rigid2DTransform<TScalarType>::InputCovariantVectorType
00315 Rigid2DTransform<TScalarType>::
00316 BackTransform(const OutputCovariantVectorType &vect) const 
00317 {
00318   itkWarningMacro(
00319     <<"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."
00320     );
00321   return this->GetMatrix() * vect;
00322 }
00323 
00324 }  // namespace itk
00325 
00326 
00327 // Define instantiation macro for this template.
00328 #define ITK_TEMPLATE_Rigid2DTransform(_, EXPORT, x, y) namespace itk { \
00329   _(1(class EXPORT Rigid2DTransform< ITK_TEMPLATE_1 x >)) \
00330   namespace Templates { typedef Rigid2DTransform< ITK_TEMPLATE_1 x > Rigid2DTransform##y; } \
00331   }
00332 
00333 #if ITK_TEMPLATE_EXPLICIT
00334 # include "Templates/itkRigid2DTransform+-.h"
00335 #endif
00336 
00337 #if ITK_TEMPLATE_TXX
00338 # include "itkRigid2DTransform.txx"
00339 #endif
00340 
00341 #endif /* __itkRigid2DTransform_h */
00342 

Generated at Fri Apr 16 19:30:57 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000