18#ifndef itkKdTreeBasedKmeansEstimator_h
19#define itkKdTreeBasedKmeansEstimator_h
22#include <unordered_map>
73template <
typename TKdTree>
129 itkSetMacro(MaximumIteration,
int);
130 itkGetConstMacro(MaximumIteration,
int);
135 itkSetMacro(CentroidPositionChangesThreshold,
double);
136 itkGetConstMacro(CentroidPositionChangesThreshold,
double);
148 itkGetConstMacro(CurrentIteration,
int);
149 itkGetConstMacro(CentroidPositionChanges,
double);
160 itkSetMacro(UseClusterLabels,
bool);
161 itkGetConstMacro(UseClusterLabels,
bool);
162 itkBooleanMacro(UseClusterLabels);
207 for (
unsigned int i = 0; i < centroids.size(); ++i)
223 centroids.resize(this->
Size());
224 for (
unsigned int i = 0; i < static_cast<unsigned int>(this->
Size()); ++i)
236 for (
unsigned int i = 0; i < static_cast<unsigned int>(this->
Size()); ++i)
289 std::vector<int> validIndexes,
348#ifndef ITK_MANUAL_INSTANTIATION
349# include "itkKdTreeBasedKmeansEstimator.hxx"
Array class with size defined at construction time.
Control indentation during Print() invocation.
static void SetLength(T &m, const unsigned int s)
static unsigned int GetLength(const T &)
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
SmartPointer< Self > Pointer
Implements transparent reference counting.
DistanceToCentroidMembershipFunction models class membership using a distance metric.
SmartPointer< Self > Pointer
SmartPointer< Self > Pointer
void SetCentroids(InternalParametersType ¢roids)
CandidateVector()=default
MeasurementVectorSizeType m_MeasurementVectorSize
std::vector< Candidate > m_Candidates
void GetCentroids(InternalParametersType ¢roids)
virtual ~CandidateVector()=default
Candidate & operator[](int index)
typename TKdTree::InstanceIdentifier InstanceIdentifier
double m_CentroidPositionChangesThreshold
ParameterType m_TempVertex
typename TKdTree::SampleType SampleType
void CopyParameters(InternalParametersType &source, ParametersType &target)
EuclideanDistanceMetric< ParameterType >::Pointer m_DistanceMetric
MembershipFunctionVectorObjectPointer m_MembershipFunctionsObject
typename MembershipFunctionType::ConstPointer MembershipFunctionPointer
KdTreeBasedKmeansEstimator()
CandidateVector m_CandidateVector
SimpleDataObjectDecorator< MembershipFunctionVectorType > MembershipFunctionVectorObjectType
SmartPointer< Self > Pointer
int GetClosestCandidate(ParameterType &measurements, std::vector< int > &validIndexes)
ParametersType m_Parameters
std::vector< ParameterType > InternalParametersType
ClusterLabelsType m_ClusterLabels
void CopyParameters(InternalParametersType &source, InternalParametersType &target)
bool m_GenerateClusterLabels
MeasurementVectorSizeType m_MeasurementVectorSize
const MembershipFunctionVectorObjectType * GetOutput() const
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
void PrintPoint(ParameterType &point)
typename MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer
bool IsFarther(ParameterType &pointA, ParameterType &pointB, MeasurementVectorType &lowerBound, MeasurementVectorType &upperBound)
void FillClusterLabels(KdTreeNodeType *node, int closestIndex)
void CopyParameters(ParametersType &source, InternalParametersType &target)
void Filter(KdTreeNodeType *node, std::vector< int > validIndexes, MeasurementVectorType &lowerBound, MeasurementVectorType &upperBound)
const TKdTree * GetKdTree() const
typename TKdTree::MeasurementType MeasurementType
std::unordered_map< InstanceIdentifier, unsigned int > ClusterLabelsType
typename DistanceToCentroidMembershipFunctionType::Pointer DistanceToCentroidMembershipFunctionPointer
SmartPointer< const Self > ConstPointer
~KdTreeBasedKmeansEstimator() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
double GetSumOfSquaredPositionChanges(InternalParametersType &previous, InternalParametersType ¤t)
double m_CentroidPositionChanges
typename KdTreeNodeType::CentroidType CentroidType
Array< double > ParametersType
MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType
TreeType::Pointer m_KdTree
Array< double > ParameterType
typename TKdTree::KdTreeNodeType KdTreeNodeType
void SetKdTree(TKdTree *tree)
typename TKdTree::MeasurementVectorType MeasurementVectorType
DistanceToCentroidMembershipFunction< MeasurementVectorType > DistanceToCentroidMembershipFunctionType
void GetPoint(ParameterType &point, MeasurementVectorType measurements)
KdTreeBasedKmeansEstimator Self
unsigned int MeasurementVectorSizeType
MembershipFunctionBase defines common interfaces for membership functions.
SmartPointer< const Self > ConstPointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
CentroidType WeightedCentroid