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: 2003/12/09 17:07:54 $
00007   Version:   $Revision: 1.23 $
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 _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   typedef typename FixedImageType::SpacingType    SpacingType;
00082   
00084   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00085   typedef typename Superclass::DeformationFieldTypePointer   
00086   DeformationFieldTypePointer;
00087 
00089   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00090 
00092   typedef typename Superclass::PixelType     PixelType;
00093   typedef typename Superclass::RadiusType    RadiusType;
00094   typedef typename Superclass::NeighborhoodType    NeighborhoodType;
00095   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00096   typedef typename Superclass::TimeStepType TimeStepType;
00097 
00099   typedef double CoordRepType;
00100   typedef InterpolateImageFunction<MovingImageType,CoordRepType> InterpolatorType;
00101   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00102   typedef typename InterpolatorType::PointType       PointType;
00103   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00104   DefaultInterpolatorType;
00105 
00107   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
00108 
00110   typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
00111   typedef typename GradientCalculatorType::Pointer   GradientCalculatorPointer;
00112 
00114   void SetMovingImageInterpolator( InterpolatorType * ptr )
00115   { m_MovingImageInterpolator = ptr; }
00116 
00118   InterpolatorType * GetMovingImageInterpolator(void)
00119   { return m_MovingImageInterpolator; }
00120 
00122   virtual TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const
00123   { return m_TimeStep; }
00124 
00127   virtual void *GetGlobalDataPointer() const
00128   {
00129     GlobalDataStruct *global = new GlobalDataStruct();
00130     return global;
00131   }
00132 
00134   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const
00135   { delete (GlobalDataStruct *) GlobalData;  }
00136 
00138   virtual void InitializeIteration();
00139 
00142   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00143                                    void *globalData,
00144                                    const FloatOffsetType &offset = FloatOffsetType(0.0));
00145 
00146 protected:
00147   DemonsRegistrationFunction();
00148   ~DemonsRegistrationFunction() {}
00149   void PrintSelf(std::ostream& os, Indent indent) const;
00150 
00152   typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
00153 
00156   struct GlobalDataStruct
00157   {
00158     FixedImageNeighborhoodIteratorType   m_FixedImageIterator;
00159   };
00160 
00161 private:
00162   DemonsRegistrationFunction(const Self&); //purposely not implemented
00163   void operator=(const Self&); //purposely not implemented
00164   
00166   SpacingType                     m_FixedImageSpacing;
00167   PointType                       m_FixedImageOrigin;
00168 
00170   GradientCalculatorPointer       m_FixedImageGradientCalculator;
00171 
00173   InterpolatorPointer             m_MovingImageInterpolator;
00174 
00176   TimeStepType                    m_TimeStep;
00177 
00179   double                          m_DenominatorThreshold;
00180 
00182   double                          m_IntensityDifferenceThreshold;
00183 
00184 };
00185 
00186 
00187 } // end namespace itk
00188 
00189 #ifndef ITK_MANUAL_INSTANTIATION
00190 #include "itkDemonsRegistrationFunction.txx"
00191 #endif
00192 
00193 #endif

Generated at Sun Jan 25 13:19:32 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000