1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkHypersphereKernelMeanShiftModeSeeker.h,v $
Language: C++
Date: $Date: 2009-03-04 15:23:50 $
Version: $Revision: 1.9 $
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 __itkHypersphereKernelMeanShiftModeSeeker_h
#define __itkHypersphereKernelMeanShiftModeSeeker_h
#include "itkMeanShiftModeSeekerBase.h"
#include "itkFixedArray.h"
#include "itkNumericTraits.h"
namespace itk {
namespace Statistics {
/** \class HypersphereKernelMeanShiftModeSeeker
* \brief Evolves the mode using a hyperspherical kernel defined by a
* radius (which is set by SetRadius) method.
*
* <b> Recent API changes </b>
* The static const macro \c MeasurementVectorSize has been removed to allow the
* length of the measurementvector to be determined at run time. It is now obtained
* from the sample set as input. The typedef for \c MeasurementVectorSumType
* has changed from FixedArray to Array.
*
* \sa MeanShiftModeSeekerBase
*/
template< class TSample >
class HypersphereKernelMeanShiftModeSeeker :
public MeanShiftModeSeekerBase< TSample >
{
public:
/** Standard class typedefs. */
typedef HypersphereKernelMeanShiftModeSeeker Self;
typedef MeanShiftModeSeekerBase< TSample > Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Standard Macros */
itkTypeMacro(HypersphereKernelMeanShiftModeSeeker,
MeanShiftModeSeekerBase);
itkNewMacro(Self);
/** Typedefs from the superclass */
typedef typename Superclass::MeasurementVectorType MeasurementVectorType;
typedef typename Superclass::SearchResultVectorType SearchResultVectorType;
typedef typename Superclass::MeasurementType MeasurementType;
/** Type for the sum of measurements */
typedef double RealMeasurementType;
/** Type fot the sum of measurement vectors used in computing the new
* mode */
typedef Array< RealMeasurementType > MeasurementVectorSumType;
/** Sets the radius of the kernel */
void SetSearchRadius(double radius);
/** Gets the radius of the kernel */
double GetSearchRadius()
{ return m_SearchRadius; }
/** Returns the covariance matrix of the target sample data */
MeasurementVectorType Evolve(MeasurementVectorType instance);
protected:
HypersphereKernelMeanShiftModeSeeker();
virtual ~HypersphereKernelMeanShiftModeSeeker();
void PrintSelf(std::ostream& os, Indent indent) const;
/** Computes the new mode with the given query point (queryPoint). The
* new mode will be stored in the newPoint */
inline bool ComputeMode(MeasurementVectorType queryPoint,
MeasurementVectorType& newPoint);
private:
/** Radius of the kernel */
double m_SearchRadius;
/** Temporary measurement vector sum: internal use */
MeasurementVectorSumType m_TempVectorSum;
/** Temporary measurement vector: internal use */
MeasurementVectorType m_TempVector;
}; // end of class
} // end of namespace Statistics
} // end of namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkHypersphereKernelMeanShiftModeSeeker.txx"
#endif
#endif
|