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 template <
00105 class TScalarType=double,
00106
00107 unsigned int NDimensions=3>
00108 class AffineTransform
00109 : public MatrixOffsetTransformBase< TScalarType, NDimensions, NDimensions >
00110 {
00111 public:
00113 typedef AffineTransform Self;
00114 typedef MatrixOffsetTransformBase< TScalarType,
00115 NDimensions,
00116 NDimensions > Superclass;
00117 typedef SmartPointer<Self> Pointer;
00118 typedef SmartPointer<const Self> ConstPointer;
00119
00121 itkTypeMacro( AffineTransform, MatrixOffsetTransformBase );
00122
00124 itkNewMacro( Self );
00125
00127 itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions);
00128 itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions);
00129 itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
00130 itkStaticConstMacro(ParametersDimension, unsigned int,
00131 NDimensions*(NDimensions+1));
00132
00133
00135 typedef typename Superclass::ParametersType ParametersType;
00136 typedef typename Superclass::JacobianType JacobianType;
00137 typedef typename Superclass::ScalarType ScalarType;
00138 typedef typename Superclass::InputPointType InputPointType;
00139 typedef typename Superclass::OutputPointType OutputPointType;
00140 typedef typename Superclass::InputVectorType InputVectorType;
00141 typedef typename Superclass::OutputVectorType OutputVectorType;
00142 typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
00143 typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
00144 typedef typename Superclass::InputCovariantVectorType
00145 InputCovariantVectorType;
00146 typedef typename Superclass::OutputCovariantVectorType
00147 OutputCovariantVectorType;
00148 typedef typename Superclass::MatrixType MatrixType;
00149 typedef typename Superclass::InverseMatrixType InverseMatrixType;
00150 typedef typename Superclass::CenterType CenterType;
00151 typedef typename Superclass::OffsetType OffsetType;
00152 typedef typename Superclass::TranslationType TranslationType;
00153
00160 void Translate(const OutputVectorType &offset, bool pre=0);
00161
00173 void Scale(const OutputVectorType &factor, bool pre=0);
00174 void Scale(const TScalarType &factor, bool pre=0);
00175
00191 void Rotate(int axis1, int axis2, TScalarType angle, bool pre=0);
00192
00206 void Rotate2D(TScalarType angle, bool pre=0);
00207
00221 void Rotate3D(const OutputVectorType &axis, TScalarType angle, bool pre=0);
00222
00234 void Shear(int axis1, int axis2, TScalarType coef, bool pre=0);
00235
00244 inline InputPointType BackTransform(const OutputPointType &point ) const;
00245 inline InputVectorType BackTransform(const OutputVectorType &vector) const;
00246 inline InputVnlVectorType BackTransform(
00247 const OutputVnlVectorType &vector) const;
00248 inline InputCovariantVectorType BackTransform(
00249 const OutputCovariantVectorType &vector) const;
00250
00260 InputPointType BackTransformPoint(const OutputPointType &point) const;
00261
00273 ScalarType Metric(const Self * other) const;
00274
00278 ScalarType Metric(void) const;
00279
00280 protected:
00288 AffineTransform(const MatrixType &matrix,
00289 const OutputVectorType &offset);
00290 AffineTransform(unsigned int outputDims,
00291 unsigned int paramDims);
00292 AffineTransform();
00293
00295 virtual ~AffineTransform();
00296
00298 void PrintSelf(std::ostream &s, Indent indent) const;
00299
00300 private:
00301
00302 AffineTransform(const Self & other);
00303 const Self & operator=( const Self & );
00304
00305 };
00306
00307 }
00308
00309
00310 #ifndef ITK_MANUAL_INSTANTIATION
00311 #include "itkAffineTransform.txx"
00312 #endif
00313
00314 #endif
00315
00316
00317
00318
00319