⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 itkmeanshiftmodeseekerbase.h

📁 InsightToolkit-1.4.0(有大量的优化算法程序)
💻 H
字号:
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile: itkMeanShiftModeSeekerBase.h,v $
  Language:  C++
  Date:      $Date: 2003/09/10 14:29:46 $
  Version:   $Revision: 1.5 $

  Copyright (c) Insight Software Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#ifndef __itkMeanShiftModeSeekerBase_h
#define __itkMeanShiftModeSeekerBase_h

#include "itkObject.h"
#include "itkVector.h"
#include "itkMatrix.h"
#include "itkNumericTraits.h"
#include "itkMeanShiftModeCacheMethod.h"

namespace itk{ 
namespace Statistics{
  
/** \class MeanShiftModeSeekerBase
 * \brief Evolves the mode. This is the base class for any mean shift
 * mode seeking algorithm classes.
 *
 * Any subclass of this class should implement the ComputeMode
 * method. That is the only one requirement. To use this class, user
 * should plug in the input sample using SetInputSample, then call
 * Evolve function with a measurement vector (query point).
 *
 * There are some operational options. Users can set a cache method to
 * accelates the evolving process. If the cache method already has a
 * pair of a query point and its new mode point, the ComputeMode uses
 * the cached value insteady recalculating the mode. By setting the
 * maximum iteration number (SetMaximumIteration method), when the
 * evolving process exceedes, the process will stop and return the
 * current mode point as the result. With this option turned off (by
 * setting it to 0 or leave it alone after instantiating this class), the
 * evolving process runs until it converges.
 *
 * \sa MeanShiftModeCacheMethod, SampleMeanShiftBlurringFilter,
 * SampleSelectiveMeanShiftBlurringFilter, SampleMeanShiftClusteringFilter
 */

template< class TSample >
class MeanShiftModeSeekerBase :
    public Object
{
public:
  /** Standard class typedefs. */
  typedef MeanShiftModeSeekerBase Self;
  typedef Object Superclass ;
  typedef SmartPointer<Self> Pointer;

  /** Standard Macros */
  itkTypeMacro(MeanShiftModeSeekerBase, Object);
  itkNewMacro(Self) ;
  
  itkStaticConstMacro(MeasurementVectorSize, unsigned int,
                      TSample::MeasurementVectorSize) ;

  /** Typedefs from the TSample template argument */
  typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
  typedef typename TSample::MeasurementType MeasurementType ;
  typedef typename TSample::InstanceIdentifier InstanceIdentifier ;

  typedef std::vector< InstanceIdentifier > SearchResultVectorType ;
  typedef MeanShiftModeCacheMethod< MeasurementVectorType > CacheMethodType ;

  void SetInputSample(TSample* sample) ;

  TSample* GetInputSample()
  { return m_InputSample.GetPointer() ; }

  void SetMaximumIteration(unsigned int number)
  { m_MaximumIteration = number ; }

  unsigned int GetMaximumIteration()
  { return m_MaximumIteration ; }

  void SetCacheMethod(CacheMethodType* method) ;

  CacheMethodType* GetCacheMethod()
  { return m_CacheMethod.GetPointer() ; }

  /** Returns the covariance matrix of the target sample data */ 
  MeasurementVectorType Evolve(MeasurementVectorType instance) ;

protected:
  MeanShiftModeSeekerBase() ;
  virtual ~MeanShiftModeSeekerBase() ;
  void PrintSelf(std::ostream& os, Indent indent) const;

  virtual bool ComputeMode(MeasurementVectorType queryPoint,
                           MeasurementVectorType& newPoint) = 0 ;

  
private:
  typename TSample::Pointer m_InputSample ;
  unsigned int m_MaximumIteration ;
  typename CacheMethodType::Pointer m_CacheMethod ;
} ; // end of class
    
} // end of namespace Statistics 
} // end of namespace itk 

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMeanShiftModeSeekerBase.txx"
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -