Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkAffineTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAffineTransform.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/04/20 18:49:35 $
00007   Version:   $Revision: 1.65 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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,         // Data type for scalars 
00107                                    //    (e.g. float or double)
00108  unsigned int NDimensions=3>       // Number of dimensions in the input space
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 }; //class AffineTransform
00312 
00313 }  // namespace itks
00314 
00315 // Define instantiation macro for this template.
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 /* __itkAffineTransform_h */
00330 

Generated at Sat Sep 2 20:06:35 2006 for ITK by doxygen 1.4.7 written by Dimitri van Heesch, © 1997-2000