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: 2008-06-29 12:58:58 $
00007   Version:   $Revision: 1.64 $
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 
00118   virtual OutputPointType TransformPoint(const InputPointType  & ) const
00119     { return OutputPointType(); } 
00120 
00122   virtual OutputVectorType    TransformVector(const InputVectorType &) const
00123     { return OutputVectorType(); }
00124 
00126   virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
00127     { return OutputVnlVectorType(); }
00128 
00130   virtual OutputCovariantVectorType TransformCovariantVector(
00131     const InputCovariantVectorType &) const
00132     { return OutputCovariantVectorType(); } 
00133 
00141   virtual void SetParameters( const ParametersType & ) 
00142     { itkExceptionMacro( << "Subclasses should override this method" ) }
00143 
00151   virtual void SetParametersByValue ( const ParametersType & p ) 
00152     { this->SetParameters ( p ); }
00153 
00155   virtual const ParametersType& GetParameters(void) const
00156     { 
00157     itkExceptionMacro( << "Subclasses should override this method" );
00158     // Next line is needed to avoid errors due to: 
00159     // "function must return a value".
00160     return this->m_Parameters; 
00161     }
00163 
00165   virtual void SetFixedParameters( const ParametersType & ) 
00166     { itkExceptionMacro( << "Subclasses should override this method" ) }
00167 
00169   virtual const ParametersType& GetFixedParameters(void) const
00170     {
00171     itkExceptionMacro( << "Subclasses should override this method" );
00172     // Next line is needed to avoid errors due to: 
00173     // "function must return a value".
00174     return this->m_FixedParameters;
00175     }
00177 
00205   virtual const JacobianType & GetJacobian(const InputPointType  &) const
00206     {
00207     itkExceptionMacro( << "Subclass should override this method" );
00208     // Next line is needed to avoid errors due to: 
00209     // "function must return a value".
00210     return this->m_Jacobian;
00211     } 
00213 
00214 
00216   virtual unsigned int GetNumberOfParameters(void) const 
00217                       { return this->m_Parameters.Size(); }
00218 
00226   bool GetInverse(Self * inverseTransform) const {return false;}
00227 
00229   virtual std::string GetTransformTypeAsString() const;
00230 
00244   virtual bool IsLinear() const { return false; }
00245 
00246 protected:
00247   Transform(); 
00248   Transform(unsigned int Dimension, unsigned int NumberOfParameters);
00249   virtual ~Transform() {}
00250 
00251 
00252   mutable ParametersType     m_Parameters;
00253   mutable ParametersType     m_FixedParameters;
00254   mutable JacobianType       m_Jacobian;
00255 
00256 private:
00257   Transform(const Self&); //purposely not implemented
00258   void operator=(const Self&); //purposely not implemented
00259 
00260 
00261 };
00262 
00263 } // end namespace itk
00264 
00265 // Define instantiation macro for this template.
00266 #define ITK_TEMPLATE_Transform(_, EXPORT, x, y) namespace itk { \
00267   _(3(class EXPORT Transform< ITK_TEMPLATE_3 x >)) \
00268   namespace Templates { typedef Transform< ITK_TEMPLATE_3 x > Transform##y; } \
00269   }
00270 
00271 #if ITK_TEMPLATE_EXPLICIT
00272 # include "Templates/itkTransform+-.h"
00273 #endif
00274 
00275 #if ITK_TEMPLATE_TXX
00276 # include "itkTransform.txx"
00277 #endif
00278 
00279 #endif
00280 

Generated at Sat Feb 28 13:40:40 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000