18 #ifndef itkKdTreeBasedKmeansEstimator_h
19 #define itkKdTreeBasedKmeansEstimator_h
22 #include "itksys/hash_map.hxx"
76 template<
typename TKdTree >
136 itkSetMacro(MaximumIteration,
int);
137 itkGetConstMacro(MaximumIteration,
int);
142 itkSetMacro(CentroidPositionChangesThreshold,
double);
143 itkGetConstMacro(CentroidPositionChangesThreshold,
double);
153 itkGetConstMacro(CurrentIteration,
int);
154 itkGetConstMacro(CentroidPositionChanges,
double);
164 itkSetMacro(UseClusterLabels,
bool);
165 itkGetConstMacro(UseClusterLabels,
bool);
171 virtual void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
204 for (
unsigned int i = 0; i < centroids.size(); i++ )
222 centroids.resize( this->
Size() );
223 for ( i = 0; i < (
unsigned int)this->
Size(); i++ )
235 for ( i = 0; i < (
unsigned int)this->
Size(); i++ )
274 std::vector< int > & validIndexes);
285 std::vector< int > validIndexes,
339 #ifndef ITK_MANUAL_INSTANTIATION
340 #include "itkKdTreeBasedKmeansEstimator.hxx"
ParametersType m_Parameters
virtual void PrintSelf(std::ostream &os, Indent indent) const override
EuclideanDistanceMetric< ParameterType >::Pointer m_DistanceMetric
CandidateVector m_CandidateVector
Light weight base class for most itk classes.
virtual ~KdTreeBasedKmeansEstimator()
TKdTree::SampleType SampleType
TKdTree::KdTreeNodeType KdTreeNodeType
MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
Represent the size (bounds) of a n-dimensional image.
TKdTree::Pointer m_KdTree
ParameterType m_TempVertex
void GetPoint(ParameterType &point, MeasurementVectorType measurements)
double m_CentroidPositionChangesThreshold
double GetSumOfSquaredPositionChanges(InternalParametersType &previous, InternalParametersType ¤t)
SmartPointer< Self > Pointer
fast k-means algorithm implementation using k-d tree structure
void SetKdTree(TKdTree *tree)
DistanceToCentroidMembershipFunctionType::Pointer DistanceToCentroidMembershipFunctionPointer
SmartPointer< const Self > ConstPointer
unsigned int MeasurementVectorSizeType
MeasurementVectorSizeType m_MeasurementVectorSize
TKdTree::InstanceIdentifier InstanceIdentifier
void PrintPoint(ParameterType &point)
TKdTree::MeasurementType MeasurementType
std::vector< ParameterType > InternalParametersType
Candidate & operator[](int index)
KdTreeBasedKmeansEstimator()
MembershipFunctionVectorObjectPointer m_MembershipFunctionsObject
void SetCentroids(InternalParametersType ¢roids)
const MembershipFunctionVectorObjectType * GetOutput() const
Decorates any "simple" data type (data types without smart pointers) with a DataObject API...
static unsigned int GetLength()
KdTreeBasedKmeansEstimator Self
MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer
MembershipFunctionBase defines common interfaces for membership functions.
static void SetLength(T &m, const unsigned int s)
const TKdTree * GetKdTree() const
SimpleDataObjectDecorator< MembershipFunctionVectorType > MembershipFunctionVectorObjectType
void FillClusterLabels(KdTreeNodeType *node, int closestIndex)
MembershipFunctionType::ConstPointer MembershipFunctionPointer
Array< double > ParameterType
virtual ~CandidateVector()
itksys::hash_map< InstanceIdentifier, unsigned int > ClusterLabelsType
bool m_GenerateClusterLabels
int GetClosestCandidate(ParameterType &measurements, std::vector< int > &validIndexes)
void GetCentroids(InternalParametersType ¢roids)
double m_CentroidPositionChanges
std::vector< Candidate > m_Candidates
DistanceToCentroidMembershipFunction models class membership using a distance metric.
Array< double > ParametersType
Control indentation during Print() invocation.
void Filter(KdTreeNodeType *node, std::vector< int > validIndexes, MeasurementVectorType &lowerBound, MeasurementVectorType &upperBound)
DistanceToCentroidMembershipFunction< MeasurementVectorType > DistanceToCentroidMembershipFunctionType
CentroidType WeightedCentroid
TKdTree::MeasurementVectorType MeasurementVectorType
Base class for most ITK classes.
bool IsFarther(ParameterType &pointA, ParameterType &pointB, MeasurementVectorType &lowerBound, MeasurementVectorType &upperBound)
KdTreeNodeType::CentroidType CentroidType
MeasurementVectorSizeType m_MeasurementVectorSize
void CopyParameters(InternalParametersType &source, InternalParametersType &target)
ClusterLabelsType m_ClusterLabels