|
ITK
5.2.0
Insight Toolkit
|
Go to the documentation of this file.
63 template <
typename TSample>
83 IsTerminal()
const = 0;
147 template <
typename TSample>
167 GetParameters(
unsigned int &, MeasurementType &)
const override;
236 this->m_InstanceIdentifier = valueId;
263 template <
typename TSample>
290 GetParameters(
unsigned int &, MeasurementType &)
const override;
293 MeasurementVectorSizeType
296 return m_MeasurementVectorSize;
340 centroid = m_WeightedCentroid;
349 centroid = m_Centroid;
365 this->m_InstanceIdentifier = valueId;
393 template <
typename TSample>
449 return static_cast<unsigned int>(m_InstanceIdentifiers.size());
476 return m_InstanceIdentifiers[index];
485 m_InstanceIdentifiers.push_back(
id);
526 template <
typename TSample>
530 ITK_DISALLOW_COPY_AND_MOVE(
KdTree);
587 : m_FarthestNeighborIndex(0)
588 , m_Distances(cache_vector)
600 m_Identifiers.clear();
604 m_FarthestNeighborIndex = 0;
612 return m_Distances[m_FarthestNeighborIndex];
620 m_Identifiers[m_FarthestNeighborIndex] = id;
621 m_Distances[m_FarthestNeighborIndex] = distance;
623 const auto size = static_cast<unsigned int>(m_Distances.size());
624 for (
unsigned int i = 0; i < size; i++)
626 if (m_Distances[i] > farthestDistance)
628 farthestDistance = m_Distances[i];
629 m_FarthestNeighborIndex = i;
639 return m_Identifiers;
647 return m_Identifiers[index];
666 SetBucketSize(
unsigned int);
671 SetSample(
const TSample *);
683 return m_Sample->Size();
693 return m_EmptyTerminalNode;
703 this->DeleteNode(this->m_Root);
718 const MeasurementVectorType &
721 return m_Sample->GetMeasurementVector(
id);
726 AbsoluteFrequencyType
729 return m_Sample->GetFrequency(
id);
736 return m_DistanceMetric.GetPointer();
741 Search(
const MeasurementVectorType &,
unsigned int, InstanceIdentifierVectorType &)
const;
747 Search(
const MeasurementVectorType &,
unsigned int, InstanceIdentifierVectorType &, std::vector<double> &)
const;
751 Search(
const MeasurementVectorType &,
double, InstanceIdentifierVectorType &)
const;
759 BallWithinBounds(
const MeasurementVectorType &, MeasurementVectorType &, MeasurementVectorType &,
double)
const;
765 BoundsOverlapBall(
const MeasurementVectorType &, MeasurementVectorType &, MeasurementVectorType &,
double)
const;
769 DeleteNode(KdTreeNodeType *);
773 PrintTree(std::ostream &)
const;
777 PrintTree(KdTreeNodeType *,
unsigned int,
unsigned int, std::ostream & os = std::cout)
const;
782 PlotTree(std::ostream & os)
const;
786 PlotTree(KdTreeNodeType * node, std::ostream & os = std::cout)
const;
799 PrintSelf(std::ostream & os,
Indent indent)
const override;
840 #ifndef ITK_MANUAL_INSTANTIATION
841 # include "itkKdTree.hxx"
MeasurementType m_PartitionValue
void GetWeightedCentroid(CentroidType ¢roid) override
unsigned int Size() const override
InstanceIdentifier GetNeighbor(unsigned int index) const
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree.
unsigned int m_FarthestNeighborIndex
std::vector< double > & m_Distances
DistanceMetricType::Pointer m_DistanceMetric
InstanceIdentifier m_InstanceIdentifier
void AddInstanceIdentifier(InstanceIdentifier valueId) override
typename TSample::MeasurementType MeasurementType
Represent a n-dimensional size (bounds) of a n-dimensional image.
AbsoluteFrequencyType GetFrequency(InstanceIdentifier id) const
unsigned int MeasurementVectorSizeType
void GetWeightedCentroid(CentroidType &) override
typename TSample::InstanceIdentifier InstanceIdentifier
This is a subclass of the KdTreeNode.
NearestNeighbors(std::vector< double > &cache_vector)
DistanceMetricType * GetDistanceMetric()
std::pair< InstanceIdentifier, double > NeighborType
This is a subclass of the KdTreeNode.
static constexpr T min(const T &)
KdTreeNodeType * m_EmptyTerminalNode
typename TSample::InstanceIdentifier InstanceIdentifier
std::vector< InstanceIdentifier > InstanceIdentifierVectorType
unsigned int Size() const override
void GetCentroid(CentroidType &) override
const Superclass * Left() const override
typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType
Control indentation during Print() invocation.
std::vector< InstanceIdentifier > m_InstanceIdentifiers
double GetLargestDistance()
Superclass * Left() override
typename TSample::MeasurementVectorType MeasurementVectorType
Superclass * Left() override
~KdTreeTerminalNode() override
KdTreeNodeType * GetEmptyTerminalNode()
const Superclass * Right() const override
const InstanceIdentifierVectorType & GetNeighbors() const
bool IsTerminal() const override
Light weight base class for most itk classes.
void ReplaceFarthestNeighbor(InstanceIdentifier id, double distance)
void resize(unsigned int k)
void AddInstanceIdentifier(InstanceIdentifier valueId) override
unsigned int Size() const override
bool IsTerminal() const override
This class is the node that doesn't have any child node. The IsTerminal method returns true for this ...
SizeValueType Size() const
InstanceIdentifierVectorType m_Identifiers
InstanceIdentifier GetInstanceIdentifier(InstanceIdentifier) const override
const TSample * GetSample() const
unsigned int m_PartitionDimension
void GetCentroid(CentroidType ¢roid) override
void GetCentroid(CentroidType &) override
typename TSample::MeasurementType MeasurementType
void SetRoot(KdTreeNodeType *root)
const Superclass * Right() const override
MeasurementVectorSizeType m_MeasurementVectorSize
const Superclass * Left() const override
Euclidean distance function.
const Superclass * Right() const override
void GetWeightedCentroid(CentroidType &) override
typename TSample::ConstIterator ConstIterator
Define additional traits for native types such as int or float.
InstanceIdentifier GetInstanceIdentifier(InstanceIdentifier index) const override
InstanceIdentifier GetInstanceIdentifier(InstanceIdentifier) const override
void GetParameters(unsigned int &, MeasurementType &) const override
unsigned int m_PartitionDimension
Superclass * Right() override
CentroidType m_WeightedCentroid
Superclass * Right() override
typename TSample::Iterator Iterator
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Superclass * Left() override
Superclass * Right() override
bool IsTerminal() const override
Base class for most ITK classes.
KdTreeNodeType * GetRoot()
MeasurementType m_PartitionValue
const Superclass * Left() const override
const MeasurementVectorType & GetMeasurementVector(InstanceIdentifier id) const
MeasurementVectorSizeType GetMeasurementVectorSize() const
void AddInstanceIdentifier(InstanceIdentifier id) override
data structure for storing k-nearest neighbor search result (k number of Neighbors)
unsigned long SizeValueType
typename TSample::AbsoluteFrequencyType AbsoluteFrequencyType
InstanceIdentifier m_InstanceIdentifier
This class defines the interface of its derived classes.
MeasurementVectorSizeType m_MeasurementVectorSize