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-11-28 15:53:16 $
00007   Version:   $Revision: 1.73 $
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   typedef  typename Superclass::ParametersValueType    ParametersValueType;
00098 
00100   typedef  Array2D< double >                           JacobianType;
00101 
00103   typedef Vector<TScalarType, NInputDimensions>  InputVectorType;
00104   typedef Vector<TScalarType, NOutputDimensions> OutputVectorType;
00105 
00107   typedef CovariantVector<TScalarType, NInputDimensions>  InputCovariantVectorType;
00108   typedef CovariantVector<TScalarType, NOutputDimensions> OutputCovariantVectorType;
00109 
00111   typedef vnl_vector_fixed<TScalarType, NInputDimensions>  InputVnlVectorType;
00112   typedef vnl_vector_fixed<TScalarType, NOutputDimensions> OutputVnlVectorType;
00113 
00115   typedef Point<TScalarType, NInputDimensions>  InputPointType;
00116   typedef Point<TScalarType, NOutputDimensions> OutputPointType;
00117 
00120 #if _MSC_VER <= 1300
00121   // Work-around for a visual c++ 6.0 and 7.0 bug. For details, see
00122   // http://www.itk.org/mailman/private/insight-developers/2009-April/012191.html
00123   typedef TransformBase                                InverseTransformBaseType;
00124 #else
00125   typedef Transform< 
00126     TScalarType, NOutputDimensions, NInputDimensions > InverseTransformBaseType;
00127 #endif
00128   typedef typename InverseTransformBaseType::Pointer   InverseTransformBasePointer;
00129 
00131   virtual OutputPointType TransformPoint(const InputPointType  & ) const
00132     { return OutputPointType(); } 
00133 
00135   virtual OutputVectorType    TransformVector(const InputVectorType &) const
00136     { return OutputVectorType(); }
00137 
00139   virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
00140     { return OutputVnlVectorType(); }
00141 
00143   virtual OutputCovariantVectorType TransformCovariantVector(
00144     const InputCovariantVectorType &) const
00145     { return OutputCovariantVectorType(); } 
00146 
00154   virtual void SetParameters( const ParametersType & ) 
00155     { itkExceptionMacro( << "Subclasses should override this method" ) }
00156 
00164   virtual void SetParametersByValue ( const ParametersType & p ) 
00165     { this->SetParameters ( p ); }
00166 
00168   virtual const ParametersType& GetParameters(void) const
00169     { 
00170     itkExceptionMacro( << "Subclasses should override this method" );
00171     // Next line is needed to avoid errors due to: 
00172     // "function must return a value".
00173     return this->m_Parameters; 
00174     }
00176 
00178   virtual void SetFixedParameters( const ParametersType & ) 
00179     { itkExceptionMacro( << "Subclasses should override this method" ) }
00180 
00182   virtual const ParametersType& GetFixedParameters(void) const
00183     {
00184     itkExceptionMacro( << "Subclasses should override this method" );
00185     // Next line is needed to avoid errors due to: 
00186     // "function must return a value".
00187     return this->m_FixedParameters;
00188     }
00190 
00218   virtual const JacobianType & GetJacobian(const InputPointType  &) const
00219     {
00220     itkExceptionMacro( << "Subclass should override this method" );
00221     // Next line is needed to avoid errors due to: 
00222     // "function must return a value" .
00223     return this->m_Jacobian;
00224     } 
00226 
00227 
00229   virtual unsigned int GetNumberOfParameters(void) const 
00230                       { return this->m_Parameters.Size(); }
00231 
00239   bool GetInverse(Self * itkNotUsed(inverseTransform) ) const {return false;}
00240 
00247   virtual InverseTransformBasePointer GetInverseTransform() const { return NULL; }
00248 
00250   virtual std::string GetTransformTypeAsString() const;
00251 
00265   virtual bool IsLinear() const { return false; }
00266 
00267 protected:
00268   Transform(); 
00269   Transform(unsigned int Dimension, unsigned int NumberOfParameters);
00270   virtual ~Transform() {}
00271 
00272 
00273   mutable ParametersType     m_Parameters;
00274   mutable ParametersType     m_FixedParameters;
00275   mutable JacobianType       m_Jacobian;
00276 
00277 private:
00278   Transform(const Self&); //purposely not implemented
00279   void operator=(const Self&); //purposely not implemented
00280 
00281 
00282 };
00283 
00284 } // end namespace itk
00285 
00286 // Define instantiation macro for this template.
00287 #define ITK_TEMPLATE_Transform(_, EXPORT, x, y) namespace itk { \
00288   _(3(class EXPORT Transform< ITK_TEMPLATE_3 x >)) \
00289   namespace Templates { typedef Transform< ITK_TEMPLATE_3 x > Transform##y; } \
00290   }
00291 
00292 #if ITK_TEMPLATE_EXPLICIT
00293 # include "Templates/itkTransform+-.h"
00294 #endif
00295 
00296 #if ITK_TEMPLATE_TXX
00297 # include "itkTransform.txx"
00298 #endif
00299 
00300 #endif
00301 

Generated at Mon Jul 12 2010 20:03:06 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000