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

itkESMDemonsRegistrationFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkESMDemonsRegistrationFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-07-04 22:54:43 $
00007   Version:   $Revision: 1.2 $
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 
00018 #ifndef __itkESMDemonsRegistrationFunction_h
00019 #define __itkESMDemonsRegistrationFunction_h
00020 
00021 #include "itkPDEDeformableRegistrationFunction.h"
00022 #include "itkPoint.h"
00023 #include "itkCovariantVector.h"
00024 #include "itkInterpolateImageFunction.h"
00025 #include "itkLinearInterpolateImageFunction.h"
00026 #include "itkCentralDifferenceImageFunction.h"
00027 #include "itkWarpImageFilter.h"
00028 
00029 namespace itk {
00030 
00062 template<class TFixedImage, class TMovingImage, class TDeformationField>
00063 class ITK_EXPORT ESMDemonsRegistrationFunction : 
00064     public PDEDeformableRegistrationFunction< TFixedImage,
00065                                               TMovingImage, TDeformationField>
00066 {
00067 public:
00068 
00070   typedef ESMDemonsRegistrationFunction               Self;
00071   typedef PDEDeformableRegistrationFunction< 
00072     TFixedImage, TMovingImage, TDeformationField >    Superclass;
00073   typedef SmartPointer<Self>                          Pointer;
00074   typedef SmartPointer<const Self>                    ConstPointer;
00075 
00077   itkNewMacro(Self);
00078 
00080   itkTypeMacro( ESMDemonsRegistrationFunction, 
00081                 PDEDeformableRegistrationFunction );
00082 
00084   typedef typename Superclass::MovingImageType      MovingImageType;
00085   typedef typename Superclass::MovingImagePointer   MovingImagePointer;
00086   typedef typename MovingImageType::PixelType       MovingPixelType;
00087 
00089   typedef typename Superclass::FixedImageType       FixedImageType;
00090   typedef typename Superclass::FixedImagePointer    FixedImagePointer;
00091   typedef typename FixedImageType::IndexType        IndexType;
00092   typedef typename FixedImageType::SizeType         SizeType;
00093   typedef typename FixedImageType::SpacingType      SpacingType;
00094 
00096   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00097   typedef typename Superclass::DeformationFieldTypePointer   
00098   DeformationFieldTypePointer;
00099 
00101   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00102 
00104   typedef typename Superclass::PixelType            PixelType;
00105   typedef typename Superclass::RadiusType           RadiusType;
00106   typedef typename Superclass::NeighborhoodType     NeighborhoodType;
00107   typedef typename Superclass::FloatOffsetType      FloatOffsetType;
00108   typedef typename Superclass::TimeStepType         TimeStepType;
00109 
00111   typedef double                                    CoordRepType;
00112   typedef InterpolateImageFunction<
00113     MovingImageType,CoordRepType>                   InterpolatorType;
00114   typedef typename InterpolatorType::Pointer        InterpolatorPointer;
00115   typedef typename InterpolatorType::PointType      PointType;
00116   typedef LinearInterpolateImageFunction<
00117     MovingImageType,CoordRepType>                   DefaultInterpolatorType;
00118 
00120   typedef WarpImageFilter<
00121     MovingImageType,
00122     MovingImageType,DeformationFieldType>           WarperType;
00123   typedef typename WarperType::Pointer              WarperPointer;
00124 
00126   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
00127 
00129   typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
00130   typedef typename GradientCalculatorType::Pointer   GradientCalculatorPointer;
00131 
00133   typedef CentralDifferenceImageFunction<MovingImageType,CoordRepType>
00134       MovingImageGradientCalculatorType;
00135   typedef typename MovingImageGradientCalculatorType::Pointer
00136       MovingImageGradientCalculatorPointer;
00137 
00139   void SetMovingImageInterpolator( InterpolatorType * ptr )
00140   { m_MovingImageInterpolator = ptr; m_MovingImageWarper->SetInterpolator( ptr ); }
00141 
00143   InterpolatorType * GetMovingImageInterpolator(void)
00144   { return m_MovingImageInterpolator; }
00145 
00147   virtual TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const
00148   { return m_TimeStep; }
00149 
00152   virtual void *GetGlobalDataPointer() const
00153     {
00154     GlobalDataStruct *global = new GlobalDataStruct();
00155     global->m_SumOfSquaredDifference  = 0.0;
00156     global->m_NumberOfPixelsProcessed = 0L;
00157     global->m_SumOfSquaredChange      = 0;
00158     return global;
00159     }
00161 
00163   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const;
00164 
00166   virtual void InitializeIteration();
00167 
00170   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00171                                    void *globalData,
00172                                    const FloatOffsetType &offset = FloatOffsetType(0.0));
00173 
00177   virtual double GetMetric() const
00178     { return m_Metric; }
00179 
00181   virtual const double &GetRMSChange() const
00182     { return m_RMSChange; }
00183 
00188   virtual void SetIntensityDifferenceThreshold(double);
00189   virtual double GetIntensityDifferenceThreshold() const;
00191 
00195   virtual void SetMaximumUpdateStepLength(double sm)
00196     {
00197     this->m_MaximumUpdateStepLength =sm;
00198     }
00199   virtual double GetMaximumUpdateStepLength() const 
00200     {
00201     return this->m_MaximumUpdateStepLength;
00202     }
00204 
00206   enum GradientType {
00207      Symmetric=0,
00208      Fixed,
00209      WarpedMoving,
00210      MappedMoving
00211   };
00212 
00214   virtual void SetUseGradientType( GradientType gtype )
00215     { m_UseGradientType = gtype; }
00216   virtual GradientType GetUseGradientType() const
00217     { return m_UseGradientType; }
00219 
00220 protected:
00221   ESMDemonsRegistrationFunction();
00222   ~ESMDemonsRegistrationFunction() {}
00223   void PrintSelf(std::ostream& os, Indent indent) const;
00224 
00226   typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
00227 
00230   struct GlobalDataStruct
00231     {
00232     double          m_SumOfSquaredDifference;
00233     unsigned long   m_NumberOfPixelsProcessed;
00234     double          m_SumOfSquaredChange;
00235     };
00236 
00237 private:
00238   ESMDemonsRegistrationFunction(const Self&); //purposely not implemented
00239   void operator=(const Self&); //purposely not implemented
00240   
00242   SpacingType                     m_FixedImageSpacing;
00243   PointType                       m_FixedImageOrigin;
00244   double                          m_Normalizer;
00245 
00247   GradientCalculatorPointer       m_FixedImageGradientCalculator;
00248 
00250   MovingImageGradientCalculatorPointer m_MappedMovingImageGradientCalculator;
00251 
00252   GradientType                    m_UseGradientType;
00253 
00255   InterpolatorPointer             m_MovingImageInterpolator;
00256 
00258   WarperPointer                   m_MovingImageWarper;
00259 
00261   TimeStepType                    m_TimeStep;
00262 
00264   double                          m_DenominatorThreshold;
00265 
00267   double                          m_IntensityDifferenceThreshold;
00268 
00270   double                          m_MaximumUpdateStepLength;
00271 
00275   mutable double                  m_Metric;
00276   mutable double                  m_SumOfSquaredDifference;
00277   mutable unsigned long           m_NumberOfPixelsProcessed;
00278   mutable double                  m_RMSChange;
00279   mutable double                  m_SumOfSquaredChange;
00280 
00282   mutable SimpleFastMutexLock     m_MetricCalculationLock;
00283 
00284 };
00285 
00286 
00287 } // end namespace itk
00288 
00289 #ifndef ITK_MANUAL_INSTANTIATION
00290 #include "itkESMDemonsRegistrationFunction.txx"
00291 #endif
00292 
00293 #endif
00294 

Generated at Tue Jul 29 19:52:16 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000