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 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
00220
00221
00222
00223 MatrixType m_RotationMatrix;
00224
00225
00226 virtual MatrixType GetInverseMatrix() const;
00227
00228
00229 mutable TimeStamp m_InverseMatrixMTime;
00230 TimeStamp m_RotationMatrixMTime;
00231
00232
00233 OffsetType m_Offset;
00234
00235
00236 mutable MatrixType m_InverseMatrix;
00237
00238 private:
00239 Rigid3DTransform(const Self&);
00240 void operator=(const Self&);
00241
00242
00243 };
00244
00245
00246 }
00247
00248
00249 #ifndef ITK_MANUAL_INSTANTIATION
00250 #include "itkRigid3DTransform.txx"
00251 #endif
00252
00253 #endif