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

itkFastSymmetricForcesDemonsRegistrationFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFastSymmetricForcesDemonsRegistrationFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005-05-03 23:05:49 $
00007   Version:   $Revision: 1.1 $
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 _itkFastSymmetricForcesDemonsRegistrationFunction_h_
00018 #define _itkFastSymmetricForcesDemonsRegistrationFunction_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 #include "itkWarpImageFilter.h"
00027 
00028 namespace itk {
00029 
00045 template<class TFixedImage, class TMovingImage, class TDeformationField>
00046 class ITK_EXPORT FastSymmetricForcesDemonsRegistrationFunction : 
00047     public PDEDeformableRegistrationFunction< TFixedImage,
00048                                               TMovingImage, TDeformationField>
00049 {
00050 public:
00051 
00053   typedef FastSymmetricForcesDemonsRegistrationFunction    Self;
00054   typedef PDEDeformableRegistrationFunction< TFixedImage,
00055                                              TMovingImage, TDeformationField >    Superclass;
00056   typedef SmartPointer<Self> Pointer;
00057   typedef SmartPointer<const Self> ConstPointer;
00058 
00060   itkNewMacro(Self);
00061 
00063   itkTypeMacro( FastSymmetricForcesDemonsRegistrationFunction, 
00064                 PDEDeformableRegistrationFunction );
00065 
00067   typedef typename Superclass::MovingImageType     MovingImageType;
00068   typedef typename Superclass::MovingImagePointer  MovingImagePointer;
00069 
00071   typedef typename Superclass::FixedImageType     FixedImageType;
00072   typedef typename Superclass::FixedImagePointer  FixedImagePointer;
00073   typedef typename FixedImageType::IndexType      IndexType;
00074   typedef typename FixedImageType::SizeType       SizeType;
00075   typedef typename FixedImageType::SpacingType    SpacingType;
00076 
00078   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00079   typedef typename Superclass::DeformationFieldTypePointer   
00080   DeformationFieldTypePointer;
00081 
00083   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00084 
00086   typedef typename Superclass::PixelType     PixelType;
00087   typedef typename Superclass::RadiusType    RadiusType;
00088   typedef typename Superclass::NeighborhoodType    NeighborhoodType;
00089   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00090   typedef typename Superclass::TimeStepType TimeStepType;
00091 
00093   typedef double CoordRepType;
00094   typedef InterpolateImageFunction<MovingImageType,CoordRepType> InterpolatorType;
00095   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00096   typedef typename InterpolatorType::PointType       PointType;
00097   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00098   DefaultInterpolatorType;
00099 
00101   typedef WarpImageFilter<MovingImageType,MovingImageType,DeformationFieldType> WarperType;
00102   typedef typename WarperType::Pointer WarperPointer;
00103 
00105   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
00106 
00108   typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
00109   typedef typename GradientCalculatorType::Pointer   GradientCalculatorPointer;
00110 
00111   typedef CentralDifferenceImageFunction<MovingImageType> MovingGradientCalculatorType;
00112   typedef typename MovingGradientCalculatorType::Pointer   MovingGradientCalculatorPointer;
00113 
00115   void SetMovingImageInterpolator( InterpolatorType * ptr )
00116   { m_MovingImageInterpolator = ptr; m_MovingImageWarper->SetInterpolator( ptr ); }
00117 
00119   InterpolatorType * GetMovingImageInterpolator(void)
00120   { return m_MovingImageInterpolator; }
00121 
00123   virtual TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const
00124   { return m_TimeStep; }
00125 
00128   virtual void *GetGlobalDataPointer() const
00129   {
00130     GlobalDataStruct *global = new GlobalDataStruct();
00131     global->m_SumOfSquaredDifference  = 0.0;
00132     global->m_NumberOfPixelsProcessed = 0L;
00133     global->m_SumOfSquaredChange      = 0;
00134     return global;
00135   }
00137 
00139   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const;
00140 
00142   virtual void InitializeIteration();
00143 
00146   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00147                                    void *globalData,
00148                                    const FloatOffsetType &offset = FloatOffsetType(0.0));
00149 
00153   virtual double GetMetric() const
00154     { return m_Metric; }
00155 
00157   virtual const double &GetRMSChange() const
00158     { return m_RMSChange; }
00159 
00164   virtual void SetIntensityDifferenceThreshold(double);
00165   virtual double GetIntensityDifferenceThreshold() const;
00167 
00168 protected:
00169   FastSymmetricForcesDemonsRegistrationFunction();
00170   ~FastSymmetricForcesDemonsRegistrationFunction() {}
00171   void PrintSelf(std::ostream& os, Indent indent) const;
00172 
00174   typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
00175 
00178   struct GlobalDataStruct
00179   {
00180     double          m_SumOfSquaredDifference;
00181     unsigned long   m_NumberOfPixelsProcessed;
00182     double          m_SumOfSquaredChange;
00183   };
00184 
00185 private:
00186   FastSymmetricForcesDemonsRegistrationFunction(const Self&); //purposely not implemented
00187   void operator=(const Self&); //purposely not implemented
00188   
00190   SpacingType                     m_FixedImageSpacing;
00191   PointType                       m_FixedImageOrigin;
00192   double                          m_Normalizer;
00193 
00195   GradientCalculatorPointer       m_FixedImageGradientCalculator;
00196 
00198   MovingGradientCalculatorPointer m_WarpedMovingImageGradientCalculator;
00199 
00201   InterpolatorPointer             m_MovingImageInterpolator;
00202 
00204   WarperPointer                   m_MovingImageWarper;
00205 
00207   TimeStepType                    m_TimeStep;
00208 
00210   double                          m_DenominatorThreshold;
00211 
00213   double                          m_IntensityDifferenceThreshold;
00214 
00218   mutable double                  m_Metric;
00219   mutable double                  m_SumOfSquaredDifference;
00220   mutable unsigned long           m_NumberOfPixelsProcessed;
00221   mutable double                  m_RMSChange;
00222   mutable double                  m_SumOfSquaredChange;
00223 
00225   mutable SimpleFastMutexLock     m_MetricCalculationLock;
00226 
00227 };
00228 
00229 
00230 } // end namespace itk
00231 
00232 #ifndef ITK_MANUAL_INSTANTIATION
00233 #include "itkFastSymmetricForcesDemonsRegistrationFunction.txx"
00234 #endif
00235 
00236 #endif
00237 

Generated at Mon Apr 14 12:19:04 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000