00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkRigid3DPerspectiveTransform_h
00018 #define __itkRigid3DPerspectiveTransform_h
00019
00020 #include "itkExceptionObject.h"
00021 #include "vnl/vnl_quaternion.h"
00022 #include <iostream>
00023 #include "itkMatrix.h"
00024 #include "itkTransform.h"
00025 #include "itkVersor.h"
00026
00027 namespace itk
00028 {
00029
00038 template <
00039 class TScalarType=double>
00040 class ITK_EXPORT Rigid3DPerspectiveTransform :
00041 public Transform< TScalarType, 3, 2 >
00042 {
00043 public:
00045 itkStaticConstMacro(InputSpaceDimension, unsigned int, 3);
00046 itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
00047
00049 itkStaticConstMacro(SpaceDimension, unsigned int, 3);
00050 itkStaticConstMacro(ParametersDimension, unsigned int, 7);
00051
00053 typedef Rigid3DPerspectiveTransform Self;
00054 typedef Transform< TScalarType,
00055 itkGetStaticConstMacro(InputSpaceDimension),
00056 itkGetStaticConstMacro(OutputSpaceDimension)> Superclass;
00057
00058 typedef SmartPointer<Self> Pointer;
00059 typedef SmartPointer<const Self> ConstPointer;
00060
00062 itkTypeMacro( Rigid3DPerspectiveTransform, Transform );
00063
00065 itkNewMacro( Self );
00066
00068 typedef typename Superclass::ScalarType ScalarType;
00069
00071 typedef typename Superclass::ParametersType ParametersType;
00072
00074 typedef typename Superclass::JacobianType JacobianType;
00075
00077 typedef Matrix<TScalarType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType;
00078
00080 typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> OffsetType;
00081
00083 typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
00084 typedef Vector<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
00085
00087 typedef Point<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputPointType;
00088 typedef Point<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputPointType;
00089
00091 typedef vnl_quaternion<TScalarType> VnlQuaternionType;
00092
00094 typedef Versor<TScalarType> VersorType;
00095 typedef typename VersorType::VectorType AxisType;
00096 typedef typename VersorType::ValueType AngleType;
00097
00101 const OffsetType & GetOffset() const
00102 { return m_Offset; }
00103
00107 const VersorType & GetRotation() const
00108 { return m_Versor; }
00109
00114 void SetParameters( const ParametersType & parameters );
00115
00118 void SetOffset(const OffsetType &offset)
00119 { m_Offset = offset; return; }
00120
00123 void SetRotation(const VersorType &rotation);
00124
00129 void SetRotation(const Vector<TScalarType,3> &axis, double angle);
00130
00134 void SetFocalDistance( TScalarType focalDistance )
00135 { m_FocalDistance = focalDistance; }
00136
00138 double GetFocalDistance( void ) const
00139 { return m_FocalDistance; }
00140
00146 void SetHeight( TScalarType height )
00147 { m_Height = height; }
00148
00154 void SetWidth( TScalarType width )
00155 { m_Width = width; }
00156
00160 OutputPointType TransformPoint(const InputPointType &point ) const;
00161
00163 const MatrixType & GetRotationMatrix() const {return m_RotationMatrix;}
00164
00166 void ComputeMatrix(void);
00167
00169 virtual const JacobianType & GetJacobian(const InputPointType &point ) const;
00170
00172 itkGetConstMacro(ObjectToPlaneDistance,float);
00173 itkSetMacro(ObjectToPlaneDistance,float);
00174
00176 itkGetConstMacro(FixedOffset,OffsetType);
00177 itkSetMacro(FixedOffset,OffsetType);
00178
00180 itkSetMacro(CenterOfRotation,InputPointType);
00181 itkGetMacro(CenterOfRotation,InputPointType);
00182
00183
00184 protected:
00185 Rigid3DPerspectiveTransform();
00186 ~Rigid3DPerspectiveTransform();
00187 void PrintSelf(std::ostream &os, Indent indent) const;
00188
00189 private:
00190 Rigid3DPerspectiveTransform(const Self&);
00191 void operator=(const Self&);
00192
00194 OffsetType m_Offset;
00195
00197 VersorType m_Versor;
00198
00200 TScalarType m_FocalDistance;
00201
00203 TScalarType m_Height;
00204
00206 TScalarType m_Width;
00207
00209 MatrixType m_RotationMatrix;
00210
00212 float m_ObjectToPlaneDistance;
00213
00215 OffsetType m_FixedOffset;
00216
00218 InputPointType m_CenterOfRotation;
00219
00220
00221 };
00222
00223
00224
00225 }
00226
00227
00228 #ifndef ITK_MANUAL_INSTANTIATION
00229 #include "itkRigid3DPerspectiveTransform.txx"
00230 #endif
00231
00232 #endif