00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 >
00037 class ITK_EXPORT Rigid3DTransform :
00038 public Transform< TScalarType, 3, 3>
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 itkGetConstMacro( Offset, OffsetType );
00103
00110 itkGetConstMacro( RotationMatrix, MatrixType );
00111
00112
00119 itkSetMacro( Offset, OffsetType );
00120
00121
00131 void SetRotationMatrix(const MatrixType &matrix);
00132
00133
00138 void Compose(const Self *other, bool pre=false);
00139
00140
00148 void Translate(const OffsetType &offset, bool pre=false);
00149
00150
00158 OutputPointType TransformPoint(const InputPointType &point ) const;
00159 OutputVectorType TransformVector(const InputVectorType &vector) const;
00160 OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const;
00161
00162 OutputCovariantVectorType TransformCovariantVector(
00163 const InputCovariantVectorType &vector) const;
00164
00172 inline InputPointType BackTransform(const OutputPointType &point ) const;
00173 inline InputVectorType BackTransform(const OutputVectorType &vector) const;
00174 inline InputVnlVectorType BackTransform(const OutputVnlVectorType &vector) const;
00175
00176 inline InputCovariantVectorType BackTransform(
00177 const OutputCovariantVectorType &vector) const;
00178
00182 void PrintSelf(std::ostream &os, Indent indent) const;
00183
00191 Pointer Inverse( void ) const;
00192
00194 void SetIdentity(void);
00195
00197 virtual const JacobianType & GetJacobian(const InputPointType &point ) const;
00198
00199 protected:
00200 Rigid3DTransform();
00201 ~Rigid3DTransform();
00202
00203 Rigid3DTransform(unsigned int SpaceDimension, unsigned int ParametersDimension);
00204
00205
00206
00207
00208 MatrixType m_RotationMatrix;
00209
00210
00211 MatrixType m_InverseMatrix;
00212
00213 private:
00214 Rigid3DTransform(const Self&);
00215 void operator=(const Self&);
00216
00217
00218 OffsetType m_Offset;
00219
00220 };
00221
00222
00223 }
00224
00225
00226 #ifndef ITK_MANUAL_INSTANTIATION
00227 #include "itkRigid3DTransform.txx"
00228 #endif
00229
00230 #endif