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

itkRigid3DTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkRigid3DTransform.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/01/21 20:16:06 $
00007   Version:   $Revision: 1.34 $
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 __itkRigid3DTransform_h
00018 #define __itkRigid3DTransform_h
00019 
00020 #include <iostream>
00021 #include "itkTransform.h"
00022 #include "itkExceptionObject.h"
00023 #include "vnl/vnl_quaternion.h"
00024 #include "itkMatrix.h"
00025 #include "itkVersor.h"
00026 
00027 namespace itk
00028 {
00029 
00036 template < class TScalarType=double >    // Data type for scalars (float or double)
00037 class ITK_EXPORT Rigid3DTransform : 
00038         public Transform< TScalarType, 3, 3> // Dimensions of input and output spaces
00039 {
00040 public:
00042   typedef Rigid3DTransform Self;
00043   typedef Transform< TScalarType, 3, 3 > Superclass;
00044   typedef SmartPointer<Self>        Pointer;
00045   typedef SmartPointer<const Self>  ConstPointer;
00046   
00048   itkTypeMacro( Rigid3DTransform, Transform );
00049 
00051   itkNewMacro( Self );
00052 
00054   itkStaticConstMacro(InputSpaceDimension, unsigned int, 3);
00055   itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3);
00056   itkStaticConstMacro(ParametersDimension, unsigned int, 6);
00057 
00059   typedef typename Superclass::ScalarType  ScalarType;
00060 
00062   typedef typename Superclass::ParametersType  ParametersType;
00063 
00065   typedef typename Superclass::JacobianType  JacobianType;
00066 
00068   typedef Matrix<ScalarType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType;
00069 
00071   typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> OffsetType;
00072 
00074   typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
00075   typedef Vector<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
00076 
00078   typedef CovariantVector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputCovariantVectorType;
00079   typedef CovariantVector<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputCovariantVectorType;
00080 
00082   typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputVnlVectorType;
00083   typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVnlVectorType;
00084 
00086   typedef Point<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)>    InputPointType;
00087   typedef Point<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)>    OutputPointType;
00088 
00090   typedef vnl_quaternion<TScalarType>           VnlQuaternionType;
00091 
00093   typedef Versor<TScalarType>           VersorType;
00094 
00095 
00102    itkGetConstReferenceMacro( Offset, OffsetType );
00103 
00110    itkGetConstReferenceMacro( RotationMatrix, MatrixType );
00111 
00118    const MatrixType & GetMatrix( ) const
00119      {
00120      return this->GetRotationMatrix();
00121      }
00122 
00129   itkSetMacro( Offset, OffsetType );
00130 
00131 
00141   virtual void SetRotationMatrix(const MatrixType &matrix);
00142 
00143   virtual void SetMatrix(const MatrixType &matrix)
00144     {
00145     this->SetRotationMatrix(matrix);
00146     }
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 
00201   bool GetInverse(Self* inverse) const;
00202 
00204   virtual void SetIdentity(void);
00205 
00207   virtual const JacobianType & GetJacobian(const InputPointType  &point ) const;
00208 
00209 protected:
00210   Rigid3DTransform();
00211   ~Rigid3DTransform();
00212   
00216   void PrintSelf(std::ostream &os, Indent indent) const;
00217 
00218   Rigid3DTransform(unsigned int SpaceDimension, unsigned int ParametersDimension);
00219   // matrix representation of the rotation
00220   // Should be protected in order to be modified 
00221   // by derived classes that instantiate an interface
00222   // to rotation computation
00223   MatrixType          m_RotationMatrix;
00224   
00225   // Return the inverse matrix and recompute it only if necessary
00226   virtual MatrixType GetInverseMatrix() const;
00227 
00228   // To avoid recomputation of the inverse if not needed
00229   mutable TimeStamp   m_InverseMatrixMTime;
00230   TimeStamp           m_RotationMatrixMTime;
00231 
00232   // Offset of the transformation
00233   OffsetType          m_Offset;  
00234 
00235   // representation of the inverse rottion
00236   mutable MatrixType          m_InverseMatrix;
00237 
00238 private:
00239   Rigid3DTransform(const Self&); //purposely not implemented
00240   void operator=(const Self&); //purposely not implemented
00241  
00242   
00243 }; //class Rigid3DTransform
00244 
00245 
00246 }  // namespace itk
00247 
00248 
00249 #ifndef ITK_MANUAL_INSTANTIATION
00250 #include "itkRigid3DTransform.txx"
00251 #endif
00252 
00253 #endif /* __itkRigid3DTransform_h */

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