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: 2005/01/22 13:24:15 $
00007   Version:   $Revision: 1.15 $
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 "itkTransform.h"
00022 #include "itkExceptionObject.h"
00023 #include "itkMatrix.h"
00024 
00025 namespace itk
00026 {
00027 
00034 template < class TScalarType=double >    // Data type for scalars (float or double)
00035 class ITK_EXPORT Rigid2DTransform : 
00036         public Transform< TScalarType, 2, 2> // Dimensions of input and output spaces
00037 {
00038 public:
00040   typedef Rigid2DTransform Self;
00041   typedef Transform< TScalarType, 2, 2 > Superclass;
00042   typedef SmartPointer<Self>        Pointer;
00043   typedef SmartPointer<const Self>  ConstPointer;
00044   
00046   itkTypeMacro( Rigid2DTransform, Transform );
00047 
00049   itkNewMacro( Self );
00050 
00052   itkStaticConstMacro(InputSpaceDimension, unsigned int, 2);
00053   itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
00054   itkStaticConstMacro(ParametersDimension, unsigned int, 4);
00055 
00057   typedef typename Superclass::ScalarType  ScalarType;
00058 
00060   typedef typename Superclass::ParametersType  ParametersType;
00061 
00063   typedef typename Superclass::JacobianType  JacobianType;
00064 
00066   typedef Matrix<ScalarType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType;
00067 
00069   typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> OffsetType;
00070 
00072   typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
00073   typedef Vector<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
00074 
00076   typedef CovariantVector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputCovariantVectorType;
00077   typedef CovariantVector<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputCovariantVectorType;
00078 
00080   typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputVnlVectorType;
00081   typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVnlVectorType;
00082 
00084   typedef Point<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)>    InputPointType;
00085   typedef Point<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)>    OutputPointType;
00086 
00093    itkGetConstReferenceMacro( Offset, OffsetType );
00094 
00101    itkGetConstReferenceMacro( RotationMatrix, MatrixType );
00102 
00109    const MatrixType & GetMatrix( )
00110      {
00111      return this->GetRotationMatrix();
00112      }
00113 
00114 
00121   itkSetMacro( Offset, OffsetType );
00122 
00123 
00133   virtual void SetRotationMatrix(const MatrixType &matrix);
00134 
00144   void SetMatrix(const MatrixType &matrix)
00145     {
00146     this->SetRotationMatrix(matrix);
00147     }
00148 
00153   virtual void Compose(const Self *other, bool pre=false);
00154 
00155 
00163   void Translate(const OffsetType &offset, bool pre=false);
00164 
00165 
00173   OutputPointType     TransformPoint(const InputPointType  &point ) const;
00174   OutputVectorType    TransformVector(const InputVectorType &vector) const;
00175   OutputVnlVectorType    TransformVector(const InputVnlVectorType &vector) const;
00176 
00177   OutputCovariantVectorType TransformCovariantVector(
00178                                  const InputCovariantVectorType &vector) const;
00179 
00187   inline InputPointType      BackTransform(const OutputPointType  &point ) const;
00188   inline InputVectorType     BackTransform(const OutputVectorType &vector) const;
00189   inline InputVnlVectorType  BackTransform(const OutputVnlVectorType &vector) const;
00190 
00191   inline InputCovariantVectorType BackTransform(
00192                                      const OutputCovariantVectorType &vector) const;
00193 
00194 
00202   bool GetInverse(Self* inverse) const;
00203 
00205   virtual void SetIdentity(void);
00206 
00208   virtual const JacobianType & GetJacobian(const InputPointType  &point ) const;
00209 
00210 
00211 protected:
00212   Rigid2DTransform();
00213   ~Rigid2DTransform();
00214 
00215   Rigid2DTransform(unsigned int outputSpaceDimension, unsigned int parametersDimension);
00219   void PrintSelf(std::ostream &os, Indent indent) const;
00220 
00221 
00222   // matrix representation of the rotation
00223   // Should be protected in order to be modified 
00224   // by derived classes that instantiate an interface
00225   // to rotation computation
00226   MatrixType          m_RotationMatrix;   
00227 
00228   // representation of the inverse rotation
00229   mutable MatrixType    m_InverseMatrix;
00230 
00231   // Return the inverse matrix and recompute it only if necessary
00232   MatrixType GetInverseMatrix() const;
00233 
00234   // To avoid recomputation of the inverse if not needed
00235   mutable TimeStamp   m_InverseMatrixMTime;
00236   TimeStamp           m_RotationMatrixMTime;
00237 
00238 private:
00239   Rigid2DTransform(const Self&); //purposely not implemented
00240   void operator=(const Self&); //purposely not implemented
00241 
00242   // Offset of the transformation
00243   OffsetType          m_Offset;   
00244 
00245 }; //class Rigid2DTransform
00246 
00247 
00248 }  // namespace itk
00249 
00250 
00251 #ifndef ITK_MANUAL_INSTANTIATION
00252 #include "itkRigid2DTransform.txx"
00253 #endif
00254 
00255 #endif /* __itkRigid2DTransform_h */

Generated at Wed Mar 30 00:09:10 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000