00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMeanShiftModeSeekerBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/07/26 15:55:02 $ 00007 Version: $Revision: 1.9 $ 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 __itkMeanShiftModeSeekerBase_h 00019 #define __itkMeanShiftModeSeekerBase_h 00020 00021 #include "itkObject.h" 00022 #include "itkVector.h" 00023 #include "itkMatrix.h" 00024 #include "itkNumericTraits.h" 00025 #include "itkMeanShiftModeCacheMethod.h" 00026 00027 namespace itk{ 00028 namespace Statistics{ 00029 00059 template< class TSample > 00060 class MeanShiftModeSeekerBase : 00061 public Object 00062 { 00063 public: 00065 typedef MeanShiftModeSeekerBase Self; 00066 typedef Object Superclass ; 00067 typedef SmartPointer<Self> Pointer; 00068 typedef SmartPointer<const Self> ConstPointer; 00069 00071 itkTypeMacro(MeanShiftModeSeekerBase, Object); 00072 00074 typedef typename TSample::MeasurementVectorType MeasurementVectorType ; 00075 typedef typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType ; 00076 typedef typename TSample::MeasurementType MeasurementType ; 00077 typedef typename TSample::InstanceIdentifier InstanceIdentifier ; 00078 00079 typedef std::vector< InstanceIdentifier > SearchResultVectorType ; 00080 typedef MeanShiftModeCacheMethod< MeasurementVectorType > CacheMethodType ; 00081 00082 void SetInputSample(const TSample* sample) ; 00083 00084 const TSample* GetInputSample() const 00085 { return m_InputSample.GetPointer() ; } 00086 00087 void SetMaximumIteration(unsigned int number) 00088 { m_MaximumIteration = number ; } 00089 00090 unsigned int GetMaximumIteration() 00091 { return m_MaximumIteration ; } 00092 00093 void SetCacheMethod(CacheMethodType* method) ; 00094 00095 CacheMethodType* GetCacheMethod() 00096 { return m_CacheMethod.GetPointer() ; } 00097 00099 MeasurementVectorType Evolve(MeasurementVectorType instance) ; 00100 00102 virtual MeasurementVectorSizeType GetMeasurementVectorSize() const 00103 { 00104 if( m_InputSample.GetPointer() ) 00105 { 00106 return m_InputSample.GetPointer()->GetMeasurementVectorSize(); 00107 } 00108 else 00109 { 00110 return 0; 00111 } 00112 } 00114 00115 protected: 00116 MeanShiftModeSeekerBase() ; 00117 virtual ~MeanShiftModeSeekerBase() ; 00118 void PrintSelf(std::ostream& os, Indent indent) const; 00119 00120 virtual bool ComputeMode(MeasurementVectorType queryPoint, 00121 MeasurementVectorType& newPoint) = 0 ; 00122 00123 00124 private: 00125 typename TSample::ConstPointer m_InputSample ; 00126 unsigned int m_MaximumIteration ; 00127 typename CacheMethodType::Pointer m_CacheMethod ; 00128 } ; // end of class 00129 00130 } // end of namespace Statistics 00131 } // end of namespace itk 00132 00133 #ifndef ITK_MANUAL_INSTANTIATION 00134 #include "itkMeanShiftModeSeekerBase.txx" 00135 #endif 00136 00137 #endif 00138 00139