00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkRigid2DTransform_h
00018 #define __itkRigid2DTransform_h
00019
00020 #include <iostream>
00021 #include "itkTransform.h"
00022 #include "itkExceptionObject.h"
00023 #include "vnl/vnl_quaternion.h"
00024 #include "itkMatrix.h"
00025
00026 namespace itk
00027 {
00028
00035 template < class TScalarType=double >
00036 class ITK_EXPORT Rigid2DTransform :
00037 public Transform< TScalarType, 2, 2>
00038 {
00039 public:
00041 typedef Rigid2DTransform Self;
00042 typedef Transform< TScalarType, 2, 2 > Superclass;
00043 typedef SmartPointer<Self> Pointer;
00044 typedef SmartPointer<const Self> ConstPointer;
00045
00047 itkTypeMacro( Rigid2DTransform, Transform );
00048
00050 itkNewMacro( Self );
00051
00053 itkStaticConstMacro(InputSpaceDimension, unsigned int, 2);
00054 itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
00055 itkStaticConstMacro(ParametersDimension, unsigned int, 4);
00056
00058 typedef typename Superclass::ScalarType ScalarType;
00059
00061 typedef typename Superclass::ParametersType ParametersType;
00062
00064 typedef typename Superclass::JacobianType JacobianType;
00065
00067 typedef Matrix<ScalarType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType;
00068
00070 typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> OffsetType;
00071
00073 typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
00074 typedef Vector<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
00075
00077 typedef CovariantVector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputCovariantVectorType;
00078 typedef CovariantVector<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputCovariantVectorType;
00079
00081 typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputVnlVectorType;
00082 typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVnlVectorType;
00083
00085 typedef Point<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputPointType;
00086 typedef Point<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputPointType;
00087
00094 itkGetConstMacro( Offset, OffsetType );
00095
00102 itkGetConstMacro( RotationMatrix, MatrixType );
00103
00104
00111 itkSetMacro( Offset, OffsetType );
00112
00113
00123 void SetRotationMatrix(const MatrixType &matrix);
00124
00125
00130 void Compose(const Self *other, bool pre=false);
00131
00132
00140 void Translate(const OffsetType &offset, bool pre=false);
00141
00142
00150 OutputPointType TransformPoint(const InputPointType &point ) const;
00151 OutputVectorType TransformVector(const InputVectorType &vector) const;
00152 OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const;
00153
00154 OutputCovariantVectorType TransformCovariantVector(
00155 const InputCovariantVectorType &vector) const;
00156
00164 inline InputPointType BackTransform(const OutputPointType &point ) const;
00165 inline InputVectorType BackTransform(const OutputVectorType &vector) const;
00166 inline InputVnlVectorType BackTransform(const OutputVnlVectorType &vector) const;
00167
00168 inline InputCovariantVectorType BackTransform(
00169 const OutputCovariantVectorType &vector) const;
00170
00174 void PrintSelf(std::ostream &os, Indent indent) const;
00175
00183 Pointer Inverse( void ) const;
00184
00186 virtual void SetIdentity(void);
00187
00189 virtual const JacobianType & GetJacobian(const InputPointType &point ) const;
00190
00191 protected:
00192 Rigid2DTransform();
00193 ~Rigid2DTransform();
00194
00195
00196
00197
00198
00199 MatrixType m_RotationMatrix;
00200
00201
00202 MatrixType m_InverseMatrix;
00203
00204 private:
00205 Rigid2DTransform(const Self&);
00206 void operator=(const Self&);
00207
00208
00209 OffsetType m_Offset;
00210
00211 };
00212
00213
00214 }
00215
00216
00217 #ifndef ITK_MANUAL_INSTANTIATION
00218 #include "itkRigid2DTransform.txx"
00219 #endif
00220
00221 #endif