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

itkSymmetricForcesDemonsRegistrationFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSymmetricForcesDemonsRegistrationFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/11/04 20:40:37 $
00007   Version:   $Revision: 1.5 $
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 _itkSymmetricForcesDemonsRegistrationFunction_h_
00018 #define _itkSymmetricForcesDemonsRegistrationFunction_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 
00060 template<class TFixedImage, class TMovingImage, class TDeformationField>
00061 class ITK_EXPORT SymmetricForcesDemonsRegistrationFunction : 
00062     public PDEDeformableRegistrationFunction< TFixedImage,
00063                                               TMovingImage, TDeformationField>
00064 {
00065 public:
00067   typedef SymmetricForcesDemonsRegistrationFunction    Self;
00068   typedef PDEDeformableRegistrationFunction< TFixedImage,
00069                                              TMovingImage, TDeformationField >    Superclass;
00070   typedef SmartPointer<Self> Pointer;
00071   typedef SmartPointer<const Self> ConstPointer;
00072 
00074   itkNewMacro(Self);
00075 
00077   itkTypeMacro( SymmetricForcesDemonsRegistrationFunction, 
00078                 PDEDeformableRegistrationFunction );
00079 
00081   typedef typename Superclass::MovingImageType     MovingImageType;
00082   typedef typename Superclass::MovingImagePointer  MovingImagePointer;
00083 
00085   typedef typename Superclass::FixedImageType     FixedImageType;
00086   typedef typename Superclass::FixedImagePointer  FixedImagePointer;
00087   typedef typename FixedImageType::IndexType      IndexType;
00088   typedef typename FixedImageType::SizeType       SizeType;
00089   typedef typename FixedImageType::SpacingType    SpacingType;
00090   
00092   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00093   typedef typename Superclass::DeformationFieldTypePointer   
00094   DeformationFieldTypePointer;
00095 
00097   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00098 
00100   typedef typename Superclass::PixelType     PixelType;
00101   typedef typename Superclass::RadiusType    RadiusType;
00102   typedef typename Superclass::NeighborhoodType    NeighborhoodType;
00103   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00104   typedef typename Superclass::TimeStepType TimeStepType;
00105 
00107   typedef double CoordRepType;
00108   typedef InterpolateImageFunction<MovingImageType,CoordRepType> InterpolatorType;
00109   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00110   typedef typename InterpolatorType::PointType       PointType;
00111   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00112   DefaultInterpolatorType;
00113 
00115   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
00116 
00118   typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
00119   typedef typename GradientCalculatorType::Pointer   GradientCalculatorPointer;
00120 
00122   void SetMovingImageInterpolator( InterpolatorType * ptr )
00123   { m_MovingImageInterpolator = ptr; }
00124 
00126   InterpolatorType * GetMovingImageInterpolator(void)
00127   { return m_MovingImageInterpolator; }
00128 
00130   virtual TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const
00131   { return m_TimeStep; }
00132 
00135   virtual void *GetGlobalDataPointer() const
00136   {
00137     GlobalDataStruct *global = new GlobalDataStruct();
00138     global->m_SumOfSquaredDifference  = 0.0;
00139     global->m_NumberOfPixelsProcessed = 0L;
00140     global->m_SumOfSquaredChange      = 0;
00141     return global;
00142   }
00143 
00145   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const;
00146 
00148   virtual void InitializeIteration();
00149 
00152   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00153                                    void *globalData,
00154                                    const FloatOffsetType &offset = FloatOffsetType(0.0));
00155 
00159   virtual double GetMetric() const
00160     { return m_Metric; }
00161 
00163   virtual const double &GetRMSChange() const
00164     { return m_RMSChange; }
00165 
00170   virtual void SetIntensityDifferenceThreshold(double);
00171   virtual double GetIntensityDifferenceThreshold() const;
00172 
00173 protected:
00174   SymmetricForcesDemonsRegistrationFunction();
00175   ~SymmetricForcesDemonsRegistrationFunction() {}
00176   void PrintSelf(std::ostream& os, Indent indent) const;
00177 
00179   typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
00180 
00183   struct GlobalDataStruct
00184   {
00185     double          m_SumOfSquaredDifference;
00186     unsigned long   m_NumberOfPixelsProcessed;
00187     double          m_SumOfSquaredChange;
00188   };
00189 
00190 private:
00191   SymmetricForcesDemonsRegistrationFunction(const Self&); //purposely not implemented
00192   void operator=(const Self&); //purposely not implemented
00193   
00195   SpacingType                     m_FixedImageSpacing;
00196   PointType                       m_FixedImageOrigin;
00197   double                          m_Normalizer;
00198 
00200   GradientCalculatorPointer       m_FixedImageGradientCalculator;
00201 
00203   InterpolatorPointer             m_MovingImageInterpolator;
00204 
00206   TimeStepType                    m_TimeStep;
00207 
00209   double                          m_DenominatorThreshold;
00210 
00212   double                          m_IntensityDifferenceThreshold;
00213 
00217   mutable double                  m_Metric;
00218   mutable double                  m_SumOfSquaredDifference;
00219   mutable unsigned long           m_NumberOfPixelsProcessed;
00220   mutable double                  m_RMSChange;
00221   mutable double                  m_SumOfSquaredChange;
00222 
00224   mutable SimpleFastMutexLock     m_MetricCalculationLock;
00225 
00226 };
00227 
00228 
00229 } // end namespace itk
00230 
00231 #ifndef ITK_MANUAL_INSTANTIATION
00232 #include "itkSymmetricForcesDemonsRegistrationFunction.txx"
00233 #endif
00234 
00235 #endif

Generated at Thu May 25 00:07:41 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000