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:
00066 
00068   typedef SymmetricForcesDemonsRegistrationFunction    Self;
00069   typedef PDEDeformableRegistrationFunction< TFixedImage,
00070                                              TMovingImage, TDeformationField >    Superclass;
00071   typedef SmartPointer<Self> Pointer;
00072   typedef SmartPointer<const Self> ConstPointer;
00073 
00075   itkNewMacro(Self);
00076 
00078   itkTypeMacro( SymmetricForcesDemonsRegistrationFunction, 
00079                 PDEDeformableRegistrationFunction );
00080 
00082   typedef typename Superclass::MovingImageType     MovingImageType;
00083   typedef typename Superclass::MovingImagePointer  MovingImagePointer;
00084 
00086   typedef typename Superclass::FixedImageType     FixedImageType;
00087   typedef typename Superclass::FixedImagePointer  FixedImagePointer;
00088   typedef typename FixedImageType::IndexType      IndexType;
00089   typedef typename FixedImageType::SizeType       SizeType;
00090   typedef typename FixedImageType::SpacingType    SpacingType;
00091 
00093   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00094   typedef typename Superclass::DeformationFieldTypePointer   
00095   DeformationFieldTypePointer;
00096 
00098   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00099 
00101   typedef typename Superclass::PixelType     PixelType;
00102   typedef typename Superclass::RadiusType    RadiusType;
00103   typedef typename Superclass::NeighborhoodType    NeighborhoodType;
00104   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00105   typedef typename Superclass::TimeStepType TimeStepType;
00106 
00108   typedef double CoordRepType;
00109   typedef InterpolateImageFunction<MovingImageType,CoordRepType> InterpolatorType;
00110   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00111   typedef typename InterpolatorType::PointType       PointType;
00112   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00113   DefaultInterpolatorType;
00114 
00116   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
00117 
00119   typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
00120   typedef typename GradientCalculatorType::Pointer   GradientCalculatorPointer;
00121 
00123   void SetMovingImageInterpolator( InterpolatorType * ptr )
00124   { m_MovingImageInterpolator = ptr; }
00125 
00127   InterpolatorType * GetMovingImageInterpolator(void)
00128   { return m_MovingImageInterpolator; }
00129 
00131   virtual TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const
00132   { return m_TimeStep; }
00133 
00136   virtual void *GetGlobalDataPointer() const
00137   {
00138     GlobalDataStruct *global = new GlobalDataStruct();
00139     global->m_SumOfSquaredDifference  = 0.0;
00140     global->m_NumberOfPixelsProcessed = 0L;
00141     global->m_SumOfSquaredChange      = 0;
00142     return global;
00143   }
00145 
00147   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const;
00148 
00150   virtual void InitializeIteration();
00151 
00154   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00155                                    void *globalData,
00156                                    const FloatOffsetType &offset = FloatOffsetType(0.0));
00157 
00161   virtual double GetMetric() const
00162     { return m_Metric; }
00163 
00165   virtual const double &GetRMSChange() const
00166     { return m_RMSChange; }
00167 
00172   virtual void SetIntensityDifferenceThreshold(double);
00173   virtual double GetIntensityDifferenceThreshold() const;
00175 
00176 protected:
00177   SymmetricForcesDemonsRegistrationFunction();
00178   ~SymmetricForcesDemonsRegistrationFunction() {}
00179   void PrintSelf(std::ostream& os, Indent indent) const;
00180 
00182   typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
00183 
00186   struct GlobalDataStruct
00187   {
00188     double          m_SumOfSquaredDifference;
00189     unsigned long   m_NumberOfPixelsProcessed;
00190     double          m_SumOfSquaredChange;
00191   };
00192 
00193 private:
00194   SymmetricForcesDemonsRegistrationFunction(const Self&); //purposely not implemented
00195   void operator=(const Self&); //purposely not implemented
00196   
00198   SpacingType                     m_FixedImageSpacing;
00199   PointType                       m_FixedImageOrigin;
00200   double                          m_Normalizer;
00201 
00203   GradientCalculatorPointer       m_FixedImageGradientCalculator;
00204 
00206   InterpolatorPointer             m_MovingImageInterpolator;
00207 
00209   TimeStepType                    m_TimeStep;
00210 
00212   double                          m_DenominatorThreshold;
00213 
00215   double                          m_IntensityDifferenceThreshold;
00216 
00220   mutable double                  m_Metric;
00221   mutable double                  m_SumOfSquaredDifference;
00222   mutable unsigned long           m_NumberOfPixelsProcessed;
00223   mutable double                  m_RMSChange;
00224   mutable double                  m_SumOfSquaredChange;
00225 
00227   mutable SimpleFastMutexLock     m_MetricCalculationLock;
00228 
00229 };
00230 
00231 
00232 } // end namespace itk
00233 
00234 #ifndef ITK_MANUAL_INSTANTIATION
00235 #include "itkSymmetricForcesDemonsRegistrationFunction.txx"
00236 #endif
00237 
00238 #endif
00239 

Generated at Tue Jul 29 22:46:41 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000