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: 2009-01-24 20:02:58 $
00007   Version:   $Revision: 1.4 $
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:
00060 
00062   typedef LevelSetMotionRegistrationFunction    Self;
00063   typedef PDEDeformableRegistrationFunction< TFixedImage,
00064                                              TMovingImage, TDeformationField 
00065  >
00066                                                 Superclass;
00067   typedef SmartPointer<Self>                    Pointer;
00068   typedef SmartPointer<const Self>              ConstPointer;
00069 
00071   itkNewMacro(Self);
00072 
00074   itkTypeMacro( LevelSetMotionRegistrationFunction,
00075                 PDEDeformableRegistrationFunction );
00076 
00078   typedef typename Superclass::MovingImageType     MovingImageType;
00079   typedef typename Superclass::MovingImagePointer  MovingImagePointer;
00080   typedef typename MovingImageType::SpacingType    MovingSpacingType;
00081 
00083   typedef typename Superclass::FixedImageType     FixedImageType;
00084   typedef typename Superclass::FixedImagePointer  FixedImagePointer;
00085   typedef typename FixedImageType::IndexType      IndexType;
00086   typedef typename FixedImageType::SizeType       SizeType;
00087   typedef typename FixedImageType::SpacingType    SpacingType;
00088 
00090   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00091   typedef typename Superclass::DeformationFieldTypePointer
00092   DeformationFieldTypePointer;
00093 
00095   itkStaticConstMacro(ImageDimension, unsigned 
00096 int,Superclass::ImageDimension);
00097 
00099   typedef typename Superclass::PixelType        PixelType;
00100   typedef typename Superclass::RadiusType       RadiusType;
00101   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00102   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00103   typedef typename Superclass::TimeStepType     TimeStepType;
00104 
00106   typedef double                                     CoordRepType;
00107   typedef InterpolateImageFunction<MovingImageType,CoordRepType> 
00108                                                      InterpolatorType;
00109   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00110   typedef typename InterpolatorType::PointType       PointType;
00111   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00112                                                      DefaultInterpolatorType;
00113 
00115   typedef Vector<double,itkGetStaticConstMacro(ImageDimension)> VectorType;
00116   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)>
00117       CovariantVectorType;
00119 
00121   typedef SmoothingRecursiveGaussianImageFilter<MovingImageType>
00122       MovingImageSmoothingFilterType;
00123   typedef typename MovingImageSmoothingFilterType::Pointer
00124       MovingImageSmoothingFilterPointer;
00125 
00127   void SetMovingImageInterpolator( InterpolatorType * ptr )
00128   { m_MovingImageInterpolator = ptr; }
00129 
00131   InterpolatorType * GetMovingImageInterpolator(void)
00132   { return m_MovingImageInterpolator; }
00133 
00136   virtual TimeStepType ComputeGlobalTimeStep(void * GlobalData) const;
00137 
00140   virtual void *GetGlobalDataPointer() const
00141     {
00142     GlobalDataStruct *global = new GlobalDataStruct();
00143     global->m_SumOfSquaredDifference  = 0.0;
00144     global->m_NumberOfPixelsProcessed = 0L;
00145     global->m_SumOfSquaredChange      = 0;
00146     global->m_MaxL1Norm            = NumericTraits<double>::NonpositiveMin();
00147     return global;
00148     }
00150 
00152   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const;
00153 
00155   virtual void InitializeIteration();
00156 
00159   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00160                                    void *globalData,
00161                                    const FloatOffsetType &offset = 
00162 FloatOffsetType(0.0));
00163 
00167   virtual double GetMetric() const
00168     { return m_Metric; }
00169 
00171   virtual double GetRMSChange() const
00172     { return m_RMSChange; }
00173 
00180   virtual void SetAlpha(double);
00181   virtual double GetAlpha() const;
00183 
00188   virtual void SetIntensityDifferenceThreshold(double);
00189   virtual double GetIntensityDifferenceThreshold() const;
00191 
00194   virtual void SetGradientMagnitudeThreshold(double);
00195   virtual double GetGradientMagnitudeThreshold() const;
00197 
00200   virtual void SetGradientSmoothingStandardDeviations(double);
00201   virtual double GetGradientSmoothingStandardDeviations() const;
00203 
00204 protected:
00205   LevelSetMotionRegistrationFunction();
00206   ~LevelSetMotionRegistrationFunction() {}
00207   void PrintSelf(std::ostream& os, Indent indent) const;
00208 
00210   typedef ConstNeighborhoodIterator<FixedImageType>
00211         FixedImageNeighborhoodIteratorType;
00212 
00215   struct GlobalDataStruct
00216     {
00217     double          m_SumOfSquaredDifference;
00218     unsigned long   m_NumberOfPixelsProcessed;
00219     double          m_SumOfSquaredChange;
00220     double          m_MaxL1Norm;
00221     };
00222 
00223 private:
00224   LevelSetMotionRegistrationFunction(const Self&); //purposely not implemented
00225   void operator=(const Self&); //purposely not implemented
00226 
00228   SpacingType                     m_FixedImageSpacing;
00229   PointType                       m_FixedImageOrigin;
00230 
00232   MovingImageSmoothingFilterPointer          m_MovingImageSmoothingFilter;
00233 
00235   InterpolatorPointer             m_MovingImageInterpolator;
00236   InterpolatorPointer             m_SmoothMovingImageInterpolator;
00237 
00240   double                          m_Alpha;
00241 
00243   double                          m_GradientMagnitudeThreshold;
00244 
00246   double                          m_IntensityDifferenceThreshold;
00247 
00249   double                          m_GradientSmoothingStandardDeviations;
00250 
00254   mutable double                  m_Metric;
00255   mutable double                  m_SumOfSquaredDifference;
00256   mutable unsigned long           m_NumberOfPixelsProcessed;
00257   mutable double                  m_RMSChange;
00258   mutable double                  m_SumOfSquaredChange;
00259 
00261   mutable SimpleFastMutexLock     m_MetricCalculationLock;
00262 
00263 };
00264 
00265 
00266 } // end namespace itk
00267 
00268 #ifndef ITK_MANUAL_INSTANTIATION
00269 #include "itkLevelSetMotionRegistrationFunction.txx"
00270 #endif
00271 
00272 #endif
00273 

Generated at Tue Sep 15 03:51:09 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000