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
|
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkSampleMeanShiftClusteringFilter.h,v $
Language: C++
Date: $Date: 2009-03-04 19:29:54 $
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 __itkSampleMeanShiftClusteringFilter_h
#define __itkSampleMeanShiftClusteringFilter_h
#include <vector>
#include "itkSampleAlgorithmBase.h"
namespace itk {
namespace Statistics {
/** \class SampleMeanShiftClusteringFilter
* \brief This filter create a cluster map from an input sample.
*
* The clustering process is done by linking measurement vectors whose
* distance is below the threshold value set by the SetThreshold
* method. However, if the resulting cluster size is below the minimum
* number of measurement vectors set by the MinimumClusterSize
* method. Such measurement vectors are clustered together and
* labelled zero.
*
* \sa SampleMeanShiftBlurringFilter, SampleSelectiveMeanShiftBlurringFilter
*/
template< class TSample >
class SampleMeanShiftClusteringFilter :
public SampleAlgorithmBase< TSample >
{
public:
/** Standard class typedefs. */
typedef SampleMeanShiftClusteringFilter Self;
typedef SampleAlgorithmBase< TSample > Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Standard Macros */
itkTypeMacro(SampleMeanShiftClusteringFilter,
SampleAlgorithmBase);
itkNewMacro(Self);
typedef typename TSample::MeasurementVectorType MeasurementVectorType;
typedef typename TSample::MeasurementType MeasurementType;
typedef typename TSample::InstanceIdentifier InstanceIdentifier;
typedef std::vector< InstanceIdentifier > SearchResultVectorType;
typedef std::vector< int > ClusterLabelsType;
itkSetMacro(Threshold, double);
itkGetMacro(Threshold, double);
itkSetMacro(MinimumClusterSize, unsigned long);
itkGetMacro(MinimumClusterSize, unsigned long);
ClusterLabelsType& GetOutput()
{ return m_Output; }
protected:
SampleMeanShiftClusteringFilter();
virtual ~SampleMeanShiftClusteringFilter();
void PrintSelf(std::ostream& os, Indent indent) const;
void GenerateData();
private:
double m_Threshold;
ClusterLabelsType m_Output;
MeasurementVectorType m_TempQueryPoint;
SearchResultVectorType m_TempSearchResult;
unsigned long m_MinimumClusterSize;
}; // end of class
} // end of namespace Statistics
} // end of namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkSampleMeanShiftClusteringFilter.txx"
#endif
#endif
|