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);
00048
00050 itkStaticConstMacro(SpaceDimension, unsigned int, 3);
00051 itkStaticConstMacro(ParametersDimension, unsigned int, 6);
00053
00055 typedef Rigid3DPerspectiveTransform Self;
00056 typedef Transform< TScalarType,
00057 itkGetStaticConstMacro(InputSpaceDimension),
00058 itkGetStaticConstMacro(OutputSpaceDimension)> Superclass;
00060
00061 typedef SmartPointer<Self> Pointer;
00062 typedef SmartPointer<const Self> ConstPointer;
00063
00065 itkTypeMacro( Rigid3DPerspectiveTransform, Transform );
00066
00068 itkNewMacro( Self );
00069
00071 typedef typename Superclass::ScalarType ScalarType;
00072
00074 typedef typename Superclass::ParametersType ParametersType;
00075
00077 typedef typename Superclass::JacobianType JacobianType;
00078
00080 typedef Matrix<TScalarType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType;
00081
00083 typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> OffsetType;
00084
00086 typedef Vector<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
00087 typedef Vector<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
00089
00091 typedef Point<TScalarType, itkGetStaticConstMacro(InputSpaceDimension)> InputPointType;
00092 typedef Point<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputPointType;
00094
00096 typedef vnl_quaternion<TScalarType> VnlQuaternionType;
00097
00099 typedef Versor<TScalarType> VersorType;
00100 typedef typename VersorType::VectorType AxisType;
00101 typedef typename VersorType::ValueType AngleType;
00102
00106 const OffsetType & GetOffset() const
00107 { return m_Offset; }
00108
00112 const VersorType & GetRotation() const
00113 { return m_Versor; }
00114
00119 void SetParameters( const ParametersType & parameters );
00120 const ParametersType & GetParameters() const;
00122
00125 void SetOffset(const OffsetType &offset)
00126 { m_Offset = offset; return; }
00127
00130 void SetRotation(const VersorType &rotation);
00131
00136 void SetRotation(const Vector<TScalarType,3> &axis, double angle);
00137
00141 void SetFocalDistance( TScalarType focalDistance )
00142 { m_FocalDistance = focalDistance; }
00143
00145 double GetFocalDistance( void ) const
00146 { return m_FocalDistance; }
00147
00151 OutputPointType TransformPoint(const InputPointType &point ) const;
00152
00154 const MatrixType & GetRotationMatrix() const {return m_RotationMatrix;}
00155
00157 void ComputeMatrix(void);
00158
00160 virtual const JacobianType & GetJacobian(const InputPointType &point ) const;
00161
00163 itkGetConstReferenceMacro(FixedOffset,OffsetType);
00164 itkSetMacro(FixedOffset,OffsetType);
00166
00168 itkSetMacro(CenterOfRotation,InputPointType);
00169 itkGetConstReferenceMacro(CenterOfRotation,InputPointType);
00171
00172
00173 protected:
00174 Rigid3DPerspectiveTransform();
00175 ~Rigid3DPerspectiveTransform();
00176 void PrintSelf(std::ostream &os, Indent indent) const;
00177
00178 private:
00179 Rigid3DPerspectiveTransform(const Self&);
00180 void operator=(const Self&);
00181
00183 OffsetType m_Offset;
00184
00186 VersorType m_Versor;
00187
00189 TScalarType m_FocalDistance;
00190
00192 MatrixType m_RotationMatrix;
00193
00194
00196 OffsetType m_FixedOffset;
00197
00199 InputPointType m_CenterOfRotation;
00200
00201
00202 };
00203
00204
00205
00206 }
00207
00208
00209 #define ITK_TEMPLATE_Rigid3DPerspectiveTransform(_, EXPORT, x, y) namespace itk { \
00210 _(1(class EXPORT Rigid3DPerspectiveTransform< ITK_TEMPLATE_1 x >)) \
00211 namespace Templates { typedef Rigid3DPerspectiveTransform< ITK_TEMPLATE_1 x > \
00212 Rigid3DPerspectiveTransform##y; } \
00213 }
00214
00215 #if ITK_TEMPLATE_EXPLICIT
00216 # include "Templates/itkRigid3DPerspectiveTransform+-.h"
00217 #endif
00218
00219 #if ITK_TEMPLATE_TXX
00220 # include "itkRigid3DPerspectiveTransform.txx"
00221 #endif
00222
00223 #endif
00224