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

itkMeanShiftModeCacheMethod.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMeanShiftModeCacheMethod.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/09/10 14:29:46 $
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 
00018 #ifndef __itkMeanShiftModeCacheMethod_h
00019 #define __itkMeanShiftModeCacheMethod_h
00020 
00021 #include <map>
00022 #include "itkMacro.h"
00023 #include "itkObject.h"
00024 
00025 namespace itk{ 
00026 namespace Statistics{
00027   
00049 template< class TMeasurementVector >
00050 class MeanShiftModeCacheMethod :
00051     public Object
00052 {
00053 public:
00055   typedef MeanShiftModeCacheMethod Self;
00056   typedef Object Superclass ;
00057   typedef SmartPointer<Self> Pointer;
00058 
00060   itkTypeMacro(MeanShiftModeCacheMethod, Object);
00061   itkNewMacro(Self) ;
00062   
00063   typedef TMeasurementVector MeasurementVectorType ;
00064 
00065   itkStaticConstMacro(MeasurementVectorSize, unsigned int, 
00066                       MeasurementVectorType::Length) ;
00067 
00068   struct LessMeasurementVector
00069   {
00070     bool operator()(const MeasurementVectorType& mv1, 
00071                     const MeasurementVectorType& mv2) const
00072     {
00073       for ( unsigned int i = 0 ; 
00074             i < itkGetStaticConstMacro( MeasurementVectorSize ) ;
00075             ++i )
00076         {
00077         if (mv1[i] < mv2[i])
00078           {
00079           return true ;
00080           }
00081         }
00082       return false ;
00083     }
00084   } ; // end of struct
00085 
00086   typedef std::map< MeasurementVectorType, MeasurementVectorType, LessMeasurementVector > CacheTableType ;
00087 
00088   void SetMaximumConsecutiveFailures(unsigned int number)
00089   { m_MaximumConsecutiveFailures = number ; }
00090 
00091   unsigned int GetMaximumConsecutiveFailures()
00092   { return m_MaximumConsecutiveFailures ; }
00093   
00094   void SetHitRatioThreshold(float threshold)
00095   { m_HitRatioThreshold = threshold ; }
00096 
00097   void SetMaximumEntries(unsigned int number)
00098   { m_MaximumEntries = number ; }
00099 
00100   unsigned int GetMaximumEntries()
00101   { return m_MaximumEntries ; }
00102 
00103   bool SetMeasurementVector(MeasurementVectorType& source, 
00104                             MeasurementVectorType& target) ;
00105 
00106   bool GetMeasurementVector(MeasurementVectorType& source,
00107                             MeasurementVectorType& target) ;
00108 
00109   bool IsFull() ;
00110 
00111   void DestroyCacheTable() ;
00112 
00113 protected:
00114   MeanShiftModeCacheMethod() ;
00115   virtual ~MeanShiftModeCacheMethod() ;
00116   void PrintSelf(std::ostream& os, Indent indent) const;
00117 
00118 private:
00119   unsigned int m_MaximumEntries ;
00120   float m_HitRatioThreshold ;
00121   unsigned int m_MaximumConsecutiveFailures ;
00122 
00123   unsigned int m_NumberOfRequests ;
00124   unsigned int m_ConsecutiveFailures ;
00125   unsigned int m_HitsSuccess ;
00126 
00127   unsigned long m_TotalHitsSuccess ;
00128   unsigned long m_TotalHitsFailure ;
00129 
00130   unsigned long m_TotalTableSize ;
00131   unsigned int m_TimesOfRebuilding ;
00132 
00133   unsigned int m_TimesOfRebuildingByHitRatio ;
00134   unsigned int m_TimesOfRebuildingByConsecutiveFailures ;
00135 
00136   CacheTableType m_CacheTable ;
00137 } ; // end of class
00138     
00139 } // end of namespace Statistics 
00140 } // end of namespace itk 
00141 
00142 #ifndef ITK_MANUAL_INSTANTIATION
00143 #include "itkMeanShiftModeCacheMethod.txx"
00144 #endif
00145 
00146 #endif
00147 

Generated at Tue Sep 16 11:32:04 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000