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

itkDemonsRegistrationFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDemonsRegistrationFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/11 19:39:01 $
00007   Version:   $Revision: 1.15 $
00008 
00009   Copyright (c) 2002 Insight 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 _itkDemonsRegistrationFunction_h_
00018 #define _itkDemonsRegistrationFunction_h_
00019 
00020 #include "itkPDEDeformableRegistrationFunction.h"
00021 #include "itkPoint.h"
00022 #include "itkCovariantVector.h"
00023 #include "itkInterpolateImageFunction.h"
00024 #include "itkLinearInterpolateImageFunction.h"
00025 #include "itkCentralDifferenceImageFunction.h"
00026 
00027 namespace itk {
00028 
00052 template<class TFixedImage, class TMovingImage, class TDeformationField>
00053 class ITK_EXPORT DemonsRegistrationFunction : 
00054   public PDEDeformableRegistrationFunction< TFixedImage,
00055     TMovingImage, TDeformationField>
00056 {
00057 public:
00059   typedef DemonsRegistrationFunction    Self;
00060   typedef PDEDeformableRegistrationFunction< TFixedImage,
00061     TMovingImage, TDeformationField >    Superclass;
00062   typedef SmartPointer<Self> Pointer;
00063   typedef SmartPointer<const Self> ConstPointer;
00064 
00066   itkNewMacro(Self);
00067 
00069   itkTypeMacro( DemonsRegistrationFunction, 
00070     PDEDeformableRegistrationFunction );
00071 
00073   typedef typename Superclass::MovingImageType     MovingImageType;
00074   typedef typename Superclass::MovingImagePointer  MovingImagePointer;
00075 
00077   typedef typename Superclass::FixedImageType     FixedImageType;
00078   typedef typename Superclass::FixedImagePointer  FixedImagePointer;
00079   typedef typename FixedImageType::IndexType      IndexType;
00080   typedef typename FixedImageType::SizeType       SizeType;
00081   
00083   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00084   typedef typename Superclass::DeformationFieldTypePointer   
00085     DeformationFieldTypePointer;
00086 
00088   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00089 
00091   typedef typename Superclass::PixelType     PixelType;
00092   typedef typename Superclass::RadiusType    RadiusType;
00093   typedef typename Superclass::NeighborhoodType    NeighborhoodType;
00094   typedef typename Superclass::BoundaryNeighborhoodType    
00095                    BoundaryNeighborhoodType;
00096   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00097   typedef typename Superclass::TimeStepType TimeStepType;
00098 
00100   typedef double CoordRepType;
00101   typedef InterpolateImageFunction<MovingImageType,CoordRepType> InterpolatorType;
00102   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00103   typedef typename InterpolatorType::PointType       PointType;
00104   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00105     DefaultInterpolatorType;
00106 
00108   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
00109 
00111   typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
00112   typedef typename GradientCalculatorType::Pointer   GradientCalculatorPointer;
00113 
00115   void SetMovingImageInterpolator( InterpolatorType * ptr )
00116     { m_MovingImageInterpolator = ptr; }
00117 
00119   InterpolatorType * GetMovingImageInterpolator(void)
00120     { return m_MovingImageInterpolator; }
00121 
00123   virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const
00124     { return m_TimeStep; }
00125 
00128   virtual void *GetGlobalDataPointer() const
00129     {
00130     GlobalDataStruct *global = new GlobalDataStruct();
00131     return global;
00132     }
00133 
00135   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const
00136     { delete (GlobalDataStruct *) GlobalData;  }
00137 
00139   virtual void InitializeIteration();
00140 
00143   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00144                      void *globalData,
00145                      const FloatOffsetType &offset = m_ZeroOffset) const;
00146 
00149   virtual PixelType  ComputeUpdate(const BoundaryNeighborhoodType
00150                      &neighborhood, void *globalData,
00151                      const FloatOffsetType &offset = m_ZeroOffset) const;
00152 
00153 protected:
00154   DemonsRegistrationFunction();
00155   ~DemonsRegistrationFunction() {}
00156   void PrintSelf(std::ostream& os, Indent indent) const;
00157 
00159   typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
00160 
00163   struct GlobalDataStruct
00164    {
00165    FixedImageNeighborhoodIteratorType   m_FixedImageIterator;
00166    };
00167 
00168 private:
00169   DemonsRegistrationFunction(const Self&); //purposely not implemented
00170   void operator=(const Self&); //purposely not implemented
00171   
00173   const double *                  m_FixedImageSpacing;
00174   const double *                  m_FixedImageOrigin;
00175 
00177   GradientCalculatorPointer       m_FixedImageGradientCalculator;
00178 
00180   InterpolatorPointer             m_MovingImageInterpolator;
00181 
00183   TimeStepType                    m_TimeStep;
00184 
00186   double                          m_DenominatorThreshold;
00187 
00189   double                          m_IntensityDifferenceThreshold;
00190 
00191 };
00192 
00193 
00194 } // end namespace itk
00195 
00196 #ifndef ITK_MANUAL_INSTANTIATION
00197 #include "itkDemonsRegistrationFunction.txx"
00198 #endif
00199 
00200 #endif

Generated at Wed Mar 12 01:12:52 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000