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

itkTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkTransform.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-10 16:47:58 $
00007   Version:   $Revision: 1.69 $
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 #ifndef __itkTransform_h
00018 #define __itkTransform_h
00019 
00020 #include "itkTransformBase.h"
00021 #include "itkPoint.h"
00022 #include "itkVector.h"
00023 #include "itkCovariantVector.h"
00024 #include "vnl/vnl_vector_fixed.h"
00025 #include "itkArray.h"
00026 #include "itkArray2D.h"
00027 
00028 #include "itkObjectFactory.h"
00029 
00030 
00031 namespace itk
00032 {
00033   
00063 template <class TScalarType,
00064           unsigned int NInputDimensions=3, 
00065           unsigned int NOutputDimensions=3>
00066 class ITK_EXPORT  Transform  : public TransformBase
00067 {
00068 public:
00070   typedef Transform                   Self;
00071   typedef TransformBase               Superclass;
00072   typedef SmartPointer< Self >        Pointer;
00073   typedef SmartPointer< const Self >  ConstPointer;
00074 
00076   itkNewMacro(Self);
00077 
00079   itkTypeMacro( Transform, TransformBase );
00080 
00082   itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
00083   itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
00085 
00087   unsigned int GetInputSpaceDimension(void) const {return NInputDimensions;}
00088 
00090   unsigned int GetOutputSpaceDimension(void) const {return NOutputDimensions;}
00091 
00093   typedef  TScalarType     ScalarType;
00094 
00096   typedef  typename Superclass::ParametersType         ParametersType;
00097 
00099   typedef  Array2D< double >                           JacobianType;
00100 
00102   typedef Vector<TScalarType, NInputDimensions>  InputVectorType;
00103   typedef Vector<TScalarType, NOutputDimensions> OutputVectorType;
00104 
00106   typedef CovariantVector<TScalarType, NInputDimensions>  InputCovariantVectorType;
00107   typedef CovariantVector<TScalarType, NOutputDimensions> OutputCovariantVectorType;
00108 
00110   typedef vnl_vector_fixed<TScalarType, NInputDimensions>  InputVnlVectorType;
00111   typedef vnl_vector_fixed<TScalarType, NOutputDimensions> OutputVnlVectorType;
00112 
00114   typedef Point<TScalarType, NInputDimensions>  InputPointType;
00115   typedef Point<TScalarType, NOutputDimensions> OutputPointType;
00116 
00119 #if defined(_MSC_VER)
00120   typedef TransformBase                                InverseTransformBaseType;
00121 #else
00122   typedef Transform< 
00123     TScalarType, NOutputDimensions, NInputDimensions > InverseTransformBaseType;
00124 #endif
00125   typedef typename InverseTransformBaseType::Pointer   InverseTransformBasePointer;
00126 
00128   virtual OutputPointType TransformPoint(const InputPointType  & ) const
00129     { return OutputPointType(); } 
00130 
00132   virtual OutputVectorType    TransformVector(const InputVectorType &) const
00133     { return OutputVectorType(); }
00134 
00136   virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
00137     { return OutputVnlVectorType(); }
00138 
00140   virtual OutputCovariantVectorType TransformCovariantVector(
00141     const InputCovariantVectorType &) const
00142     { return OutputCovariantVectorType(); } 
00143 
00151   virtual void SetParameters( const ParametersType & ) 
00152     { itkExceptionMacro( << "Subclasses should override this method" ) }
00153 
00161   virtual void SetParametersByValue ( const ParametersType & p ) 
00162     { this->SetParameters ( p ); }
00163 
00165   virtual const ParametersType& GetParameters(void) const
00166     { 
00167     itkExceptionMacro( << "Subclasses should override this method" );
00168     // Next line is needed to avoid errors due to: 
00169     // "function must return a value".
00170     return this->m_Parameters; 
00171     }
00173 
00175   virtual void SetFixedParameters( const ParametersType & ) 
00176     { itkExceptionMacro( << "Subclasses should override this method" ) }
00177 
00179   virtual const ParametersType& GetFixedParameters(void) const
00180     {
00181     itkExceptionMacro( << "Subclasses should override this method" );
00182     // Next line is needed to avoid errors due to: 
00183     // "function must return a value".
00184     return this->m_FixedParameters;
00185     }
00187 
00215   virtual const JacobianType & GetJacobian(const InputPointType  &) const
00216     {
00217     itkExceptionMacro( << "Subclass should override this method" );
00218     // Next line is needed to avoid errors due to: 
00219     // "function must return a value" .
00220     return this->m_Jacobian;
00221     } 
00223 
00224 
00226   virtual unsigned int GetNumberOfParameters(void) const 
00227                       { return this->m_Parameters.Size(); }
00228 
00236   bool GetInverse(Self * inverseTransform) const {return false;}
00237 
00244   virtual InverseTransformBasePointer GetInverseTransform() const { return NULL; }
00245 
00247   virtual std::string GetTransformTypeAsString() const;
00248 
00262   virtual bool IsLinear() const { return false; }
00263 
00264 protected:
00265   Transform(); 
00266   Transform(unsigned int Dimension, unsigned int NumberOfParameters);
00267   virtual ~Transform() {}
00268 
00269 
00270   mutable ParametersType     m_Parameters;
00271   mutable ParametersType     m_FixedParameters;
00272   mutable JacobianType       m_Jacobian;
00273 
00274 private:
00275   Transform(const Self&); //purposely not implemented
00276   void operator=(const Self&); //purposely not implemented
00277 
00278 
00279 };
00280 
00281 } // end namespace itk
00282 
00283 // Define instantiation macro for this template.
00284 #define ITK_TEMPLATE_Transform(_, EXPORT, x, y) namespace itk { \
00285   _(3(class EXPORT Transform< ITK_TEMPLATE_3 x >)) \
00286   namespace Templates { typedef Transform< ITK_TEMPLATE_3 x > Transform##y; } \
00287   }
00288 
00289 #if ITK_TEMPLATE_EXPLICIT
00290 # include "Templates/itkTransform+-.h"
00291 #endif
00292 
00293 #if ITK_TEMPLATE_TXX
00294 # include "itkTransform.txx"
00295 #endif
00296 
00297 #endif
00298 

Generated at Thu May 28 11:48:20 2009 for ITK by doxygen 1.5.5 written by Dimitri van Heesch, © 1997-2000