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: 2004/06/25 14:10:18 $
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 #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 
00080   typedef typename Superclass::FixedImageType     FixedImageType;
00081   typedef typename Superclass::FixedImagePointer  FixedImagePointer;
00082   typedef typename FixedImageType::IndexType      IndexType;
00083   typedef typename FixedImageType::SizeType       SizeType;
00084   typedef typename FixedImageType::SpacingType    SpacingType;
00085 
00087   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00088   typedef typename Superclass::DeformationFieldTypePointer
00089   DeformationFieldTypePointer;
00090 
00092   itkStaticConstMacro(ImageDimension, unsigned 
00093 int,Superclass::ImageDimension);
00094 
00096   typedef typename Superclass::PixelType     PixelType;
00097   typedef typename Superclass::RadiusType    RadiusType;
00098   typedef typename Superclass::NeighborhoodType    NeighborhoodType;
00099   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00100   typedef typename Superclass::TimeStepType TimeStepType;
00101 
00103   typedef double CoordRepType;
00104   typedef InterpolateImageFunction<MovingImageType,CoordRepType> 
00105 InterpolatorType;
00106   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00107   typedef typename InterpolatorType::PointType       PointType;
00108   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00109       DefaultInterpolatorType;
00110 
00111   
00113   typedef Vector<double,itkGetStaticConstMacro(ImageDimension)> VectorType;
00114   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)>
00115       CovariantVectorType;
00116 
00118   typedef SmoothingRecursiveGaussianImageFilter<MovingImageType>
00119       MovingImageSmoothingFilterType;
00120   typedef typename MovingImageSmoothingFilterType::Pointer
00121       MovingImageSmoothingFilterPointer;
00122   
00124   void SetMovingImageInterpolator( InterpolatorType * ptr )
00125   { m_MovingImageInterpolator = ptr; }
00126 
00128   InterpolatorType * GetMovingImageInterpolator(void)
00129   { return m_MovingImageInterpolator; }
00130 
00133   virtual TimeStepType ComputeGlobalTimeStep(void * GlobalData) const;
00134 
00137   virtual void *GetGlobalDataPointer() const
00138   {
00139     GlobalDataStruct *global = new GlobalDataStruct();
00140     global->m_SumOfSquaredDifference  = 0.0;
00141     global->m_NumberOfPixelsProcessed = 0L;
00142     global->m_SumOfSquaredChange      = 0;
00143     global->m_MaxL1Norm            = NumericTraits<double>::NonpositiveMin();
00144     return global;
00145   }
00146 
00148   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const;
00149 
00151   virtual void InitializeIteration();
00152 
00155   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00156                                    void *globalData,
00157                                    const FloatOffsetType &offset = 
00158 FloatOffsetType(0.0));
00159 
00163   virtual double GetMetric() const
00164     { return m_Metric; }
00165 
00167   virtual double GetRMSChange() const
00168     { return m_RMSChange; }
00169 
00176   virtual void SetAlpha(double);
00177   virtual double GetAlpha() const;
00178   
00183   virtual void SetIntensityDifferenceThreshold(double);
00184   virtual double GetIntensityDifferenceThreshold() const;
00185 
00188   virtual void SetGradientMagnitudeThreshold(double);
00189   virtual double GetGradientMagnitudeThreshold() const;
00190 
00193   virtual void SetGradientSmoothingStandardDeviations(double);
00194   virtual double GetGradientSmoothingStandardDeviations() const;
00195   
00196 protected:
00197   LevelSetMotionRegistrationFunction();
00198   ~LevelSetMotionRegistrationFunction() {}
00199   void PrintSelf(std::ostream& os, Indent indent) const;
00200 
00202   typedef ConstNeighborhoodIterator<FixedImageType>
00203         FixedImageNeighborhoodIteratorType;
00204 
00207   struct GlobalDataStruct
00208   {
00209     double          m_SumOfSquaredDifference;
00210     unsigned long   m_NumberOfPixelsProcessed;
00211     double          m_SumOfSquaredChange;
00212     double          m_MaxL1Norm;
00213   };
00214 
00215 private:
00216   LevelSetMotionRegistrationFunction(const Self&); //purposely not implemented
00217   void operator=(const Self&); //purposely not implemented
00218 
00220   SpacingType                     m_FixedImageSpacing;
00221   PointType                       m_FixedImageOrigin;
00222 
00224   MovingImageSmoothingFilterPointer          m_MovingImageSmoothingFilter;
00225   
00227   InterpolatorPointer             m_MovingImageInterpolator;
00228   InterpolatorPointer             m_SmoothMovingImageInterpolator;
00229 
00232   double                          m_Alpha;
00233   
00235   double                          m_GradientMagnitudeThreshold;
00236 
00238   double                          m_IntensityDifferenceThreshold;
00239 
00241   double                          m_MovingPixelSize;
00242 
00244   double                          m_GradientSmoothingStandardDeviations;
00245   
00249   mutable double                  m_Metric;
00250   mutable double                  m_SumOfSquaredDifference;
00251   mutable unsigned long           m_NumberOfPixelsProcessed;
00252   mutable double                  m_RMSChange;
00253   mutable double                  m_SumOfSquaredChange;
00254 
00256   mutable SimpleFastMutexLock     m_MetricCalculationLock;
00257 
00258 };
00259 
00260 
00261 } // end namespace itk
00262 
00263 #ifndef ITK_MANUAL_INSTANTIATION
00264 #include "itkLevelSetMotionRegistrationFunction.txx"
00265 #endif
00266 
00267 #endif
00268 

Generated at Wed Mar 30 00:02:24 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000