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

itkLevelSetMotionRegistrationFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLevelSetMotionRegistrationFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/04/29 15:58:31 $
00007   Version:   $Revision: 1.3 $
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 _itkLevelSetMotionRegistrationFunction_h_
00018 #define _itkLevelSetMotionRegistrationFunction_h_
00019 
00020 #include "itkPDEDeformableRegistrationFunction.h"
00021 #include "itkPoint.h"
00022 #include "itkVector.h"
00023 #include "itkCovariantVector.h"
00024 #include "itkInterpolateImageFunction.h"
00025 #include "itkLinearInterpolateImageFunction.h"
00026 #include "itkSmoothingRecursiveGaussianImageFilter.h"
00027 
00028 namespace itk {
00029 
00053 template<class TFixedImage, class TMovingImage, class TDeformationField>
00054 class ITK_EXPORT LevelSetMotionRegistrationFunction :
00055     public PDEDeformableRegistrationFunction< TFixedImage,
00056                                               TMovingImage, 
00057 TDeformationField>
00058 {
00059 public:
00061   typedef LevelSetMotionRegistrationFunction    Self;
00062   typedef PDEDeformableRegistrationFunction< TFixedImage,
00063                                              TMovingImage, TDeformationField 
00064  >    Superclass;
00065   typedef SmartPointer<Self> Pointer;
00066   typedef SmartPointer<const Self> ConstPointer;
00067 
00069   itkNewMacro(Self);
00070 
00072   itkTypeMacro( LevelSetMotionRegistrationFunction,
00073                 PDEDeformableRegistrationFunction );
00074 
00076   typedef typename Superclass::MovingImageType     MovingImageType;
00077   typedef typename Superclass::MovingImagePointer  MovingImagePointer;
00078   typedef typename MovingImageType::SpacingType    MovingSpacingType;
00079 
00081   typedef typename Superclass::FixedImageType     FixedImageType;
00082   typedef typename Superclass::FixedImagePointer  FixedImagePointer;
00083   typedef typename FixedImageType::IndexType      IndexType;
00084   typedef typename FixedImageType::SizeType       SizeType;
00085   typedef typename FixedImageType::SpacingType    SpacingType;
00086 
00088   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00089   typedef typename Superclass::DeformationFieldTypePointer
00090   DeformationFieldTypePointer;
00091 
00093   itkStaticConstMacro(ImageDimension, unsigned 
00094 int,Superclass::ImageDimension);
00095 
00097   typedef typename Superclass::PixelType     PixelType;
00098   typedef typename Superclass::RadiusType    RadiusType;
00099   typedef typename Superclass::NeighborhoodType    NeighborhoodType;
00100   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00101   typedef typename Superclass::TimeStepType TimeStepType;
00102 
00104   typedef double CoordRepType;
00105   typedef InterpolateImageFunction<MovingImageType,CoordRepType> 
00106 InterpolatorType;
00107   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00108   typedef typename InterpolatorType::PointType       PointType;
00109   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00110       DefaultInterpolatorType;
00111 
00112   
00114   typedef Vector<double,itkGetStaticConstMacro(ImageDimension)> VectorType;
00115   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)>
00116       CovariantVectorType;
00117 
00119   typedef SmoothingRecursiveGaussianImageFilter<MovingImageType>
00120       MovingImageSmoothingFilterType;
00121   typedef typename MovingImageSmoothingFilterType::Pointer
00122       MovingImageSmoothingFilterPointer;
00123   
00125   void SetMovingImageInterpolator( InterpolatorType * ptr )
00126   { m_MovingImageInterpolator = ptr; }
00127 
00129   InterpolatorType * GetMovingImageInterpolator(void)
00130   { return m_MovingImageInterpolator; }
00131 
00134   virtual TimeStepType ComputeGlobalTimeStep(void * GlobalData) const;
00135 
00138   virtual void *GetGlobalDataPointer() const
00139   {
00140     GlobalDataStruct *global = new GlobalDataStruct();
00141     global->m_SumOfSquaredDifference  = 0.0;
00142     global->m_NumberOfPixelsProcessed = 0L;
00143     global->m_SumOfSquaredChange      = 0;
00144     global->m_MaxL1Norm            = NumericTraits<double>::NonpositiveMin();
00145     return global;
00146   }
00147 
00149   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const;
00150 
00152   virtual void InitializeIteration();
00153 
00156   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00157                                    void *globalData,
00158                                    const FloatOffsetType &offset = 
00159 FloatOffsetType(0.0));
00160 
00164   virtual double GetMetric() const
00165     { return m_Metric; }
00166 
00168   virtual double GetRMSChange() const
00169     { return m_RMSChange; }
00170 
00177   virtual void SetAlpha(double);
00178   virtual double GetAlpha() const;
00179   
00184   virtual void SetIntensityDifferenceThreshold(double);
00185   virtual double GetIntensityDifferenceThreshold() const;
00186 
00189   virtual void SetGradientMagnitudeThreshold(double);
00190   virtual double GetGradientMagnitudeThreshold() const;
00191 
00194   virtual void SetGradientSmoothingStandardDeviations(double);
00195   virtual double GetGradientSmoothingStandardDeviations() const;
00196   
00197 protected:
00198   LevelSetMotionRegistrationFunction();
00199   ~LevelSetMotionRegistrationFunction() {}
00200   void PrintSelf(std::ostream& os, Indent indent) const;
00201 
00203   typedef ConstNeighborhoodIterator<FixedImageType>
00204         FixedImageNeighborhoodIteratorType;
00205 
00208   struct GlobalDataStruct
00209   {
00210     double          m_SumOfSquaredDifference;
00211     unsigned long   m_NumberOfPixelsProcessed;
00212     double          m_SumOfSquaredChange;
00213     double          m_MaxL1Norm;
00214   };
00215 
00216 private:
00217   LevelSetMotionRegistrationFunction(const Self&); //purposely not implemented
00218   void operator=(const Self&); //purposely not implemented
00219 
00221   SpacingType                     m_FixedImageSpacing;
00222   PointType                       m_FixedImageOrigin;
00223 
00225   MovingImageSmoothingFilterPointer          m_MovingImageSmoothingFilter;
00226   
00228   InterpolatorPointer             m_MovingImageInterpolator;
00229   InterpolatorPointer             m_SmoothMovingImageInterpolator;
00230 
00233   double                          m_Alpha;
00234   
00236   double                          m_GradientMagnitudeThreshold;
00237 
00239   double                          m_IntensityDifferenceThreshold;
00240 
00242   double                          m_GradientSmoothingStandardDeviations;
00243   
00247   mutable double                  m_Metric;
00248   mutable double                  m_SumOfSquaredDifference;
00249   mutable unsigned long           m_NumberOfPixelsProcessed;
00250   mutable double                  m_RMSChange;
00251   mutable double                  m_SumOfSquaredChange;
00252 
00254   mutable SimpleFastMutexLock     m_MetricCalculationLock;
00255 
00256 };
00257 
00258 
00259 } // end namespace itk
00260 
00261 #ifndef ITK_MANUAL_INSTANTIATION
00262 #include "itkLevelSetMotionRegistrationFunction.txx"
00263 #endif
00264 
00265 #endif
00266 

Generated at Wed May 24 23:35:41 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000