00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkAffineTransform_h
00019 #define __itkAffineTransform_h
00020
00021 #include <iostream>
00022
00023 #include "itkMatrix.h"
00024 #include "itkMatrixOffsetTransformBase.h"
00025 #include "itkExceptionObject.h"
00026 #include "itkMacro.h"
00027
00028 namespace itk
00029 {
00030
00031
00104
00105 template <
00106 class TScalarType=double,
00107
00108 unsigned int NDimensions=3>
00109 class AffineTransform
00110 : public MatrixOffsetTransformBase< TScalarType, NDimensions, NDimensions >
00111 {
00112 public:
00114 typedef AffineTransform Self;
00115 typedef MatrixOffsetTransformBase< TScalarType,
00116 NDimensions,
00117 NDimensions > Superclass;
00118 typedef SmartPointer<Self> Pointer;
00119 typedef SmartPointer<const Self> ConstPointer;
00120
00122 itkTypeMacro( AffineTransform, MatrixOffsetTransformBase );
00123
00125 itkNewMacro( Self );
00126
00128 itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions);
00129 itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions);
00130 itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
00131 itkStaticConstMacro(ParametersDimension, unsigned int,
00132 NDimensions*(NDimensions+1));
00134
00135
00137 typedef typename Superclass::ParametersType ParametersType;
00138 typedef typename Superclass::JacobianType JacobianType;
00139 typedef typename Superclass::ScalarType ScalarType;
00140 typedef typename Superclass::InputPointType InputPointType;
00141 typedef typename Superclass::OutputPointType OutputPointType;
00142 typedef typename Superclass::InputVectorType InputVectorType;
00143 typedef typename Superclass::OutputVectorType OutputVectorType;
00144 typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
00145 typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
00146 typedef typename Superclass::InputCovariantVectorType
00147 InputCovariantVectorType;
00148 typedef typename Superclass::OutputCovariantVectorType
00149 OutputCovariantVectorType;
00150 typedef typename Superclass::MatrixType MatrixType;
00151 typedef typename Superclass::InverseMatrixType InverseMatrixType;
00152 typedef typename Superclass::CenterType CenterType;
00153 typedef typename Superclass::OffsetType OffsetType;
00154 typedef typename Superclass::TranslationType TranslationType;
00155
00162 void Translate(const OutputVectorType &offset, bool pre=0);
00163
00175 void Scale(const OutputVectorType &factor, bool pre=0);
00176 void Scale(const TScalarType &factor, bool pre=0);
00178
00194 void Rotate(int axis1, int axis2, TScalarType angle, bool pre=0);
00196
00210 void Rotate2D(TScalarType angle, bool pre=0);
00211
00225 void Rotate3D(const OutputVectorType &axis, TScalarType angle, bool pre=0);
00226
00238 void Shear(int axis1, int axis2, TScalarType coef, bool pre=0);
00239
00248 inline InputPointType BackTransform(const OutputPointType &point ) const;
00249 inline InputVectorType BackTransform(const OutputVectorType &vector) const;
00250 inline InputVnlVectorType BackTransform(
00251 const OutputVnlVectorType &vector) const;
00252 inline InputCovariantVectorType BackTransform(
00253 const OutputCovariantVectorType &vector) const;
00255
00265 InputPointType BackTransformPoint(const OutputPointType &point) const;
00266
00278 ScalarType Metric(const Self * other) const;
00279
00283 ScalarType Metric(void) const;
00284
00285 protected:
00293 AffineTransform(const MatrixType &matrix,
00294 const OutputVectorType &offset);
00295 AffineTransform(unsigned int outputDims,
00296 unsigned int paramDims);
00297 AffineTransform();
00299
00301 virtual ~AffineTransform();
00302
00304 void PrintSelf(std::ostream &s, Indent indent) const;
00305
00306 private:
00307
00308 AffineTransform(const Self & other);
00309 const Self & operator=( const Self & );
00310
00311 };
00312
00313 }
00314
00315
00316 #define ITK_TEMPLATE_AffineTransform(_, EXPORT, x, y) namespace itk { \
00317 _(2(class EXPORT AffineTransform< ITK_TEMPLATE_2 x >)) \
00318 namespace Templates { typedef AffineTransform< ITK_TEMPLATE_2 x > AffineTransform##y; } \
00319 }
00320
00321 #if ITK_TEMPLATE_EXPLICIT
00322 # include "Templates/itkAffineTransform+-.h"
00323 #endif
00324
00325 #if ITK_TEMPLATE_TXX
00326 # include "itkAffineTransform.txx"
00327 #endif
00328
00329 #endif
00330