ITK  6.0.0
Insight Toolkit
Public Member Functions | Private Attributes | List of all members
itk::Statistics::KdTree< TSample >::NearestNeighbors Class Reference

#include <itkKdTree.h>

Detailed Description

template<typename TSample>
class itk::Statistics::KdTree< TSample >::NearestNeighbors

data structure for storing k-nearest neighbor search result (k number of Neighbors)

This class stores the instance identifiers and the distance values of k-nearest neighbors. We can also query the farthest neighbor's distance from the query point using the GetLargestDistance method.

Definition at line 581 of file itkKdTree.h.

+ Collaboration diagram for itk::Statistics::KdTree< TSample >::NearestNeighbors:

Public Member Functions

double GetLargestDistance ()
 
InstanceIdentifier GetNeighbor (unsigned int index) const
 
const InstanceIdentifierVectorTypeGetNeighbors () const
 
 NearestNeighbors ()=delete
 
 NearestNeighbors (std::vector< double > &cache_vector)
 
 ~NearestNeighbors ()=default
 
void resize (unsigned int k)
 
void ReplaceFarthestNeighbor (InstanceIdentifier id, double distance)
 

Private Attributes

std::vector< double > & m_Distances
 
unsigned int m_FarthestNeighborIndex
 
InstanceIdentifierVectorType m_Identifiers
 

Constructor & Destructor Documentation

◆ NearestNeighbors() [1/2]

template<typename TSample >
itk::Statistics::KdTree< TSample >::NearestNeighbors::NearestNeighbors ( std::vector< double > &  cache_vector)
inline

Constructor

Definition at line 586 of file itkKdTree.h.

◆ NearestNeighbors() [2/2]

template<typename TSample >
itk::Statistics::KdTree< TSample >::NearestNeighbors::NearestNeighbors ( )
delete

◆ ~NearestNeighbors()

template<typename TSample >
itk::Statistics::KdTree< TSample >::NearestNeighbors::~NearestNeighbors ( )
default

Destructor

Member Function Documentation

◆ GetLargestDistance()

template<typename TSample >
double itk::Statistics::KdTree< TSample >::NearestNeighbors::GetLargestDistance ( )
inline

Returns the distance of the farthest neighbor from the query point

Definition at line 610 of file itkKdTree.h.

◆ GetNeighbor()

template<typename TSample >
InstanceIdentifier itk::Statistics::KdTree< TSample >::NearestNeighbors::GetNeighbor ( unsigned int  index) const
inline

Returns the instance identifier of the index-th neighbor among k-neighbors

Definition at line 645 of file itkKdTree.h.

◆ GetNeighbors()

template<typename TSample >
const InstanceIdentifierVectorType& itk::Statistics::KdTree< TSample >::NearestNeighbors::GetNeighbors ( ) const
inline

Returns the vector of k-neighbors' instance identifiers

Definition at line 637 of file itkKdTree.h.

◆ ReplaceFarthestNeighbor()

template<typename TSample >
void itk::Statistics::KdTree< TSample >::NearestNeighbors::ReplaceFarthestNeighbor ( InstanceIdentifier  id,
double  distance 
)
inline

Replaces the farthest neighbor's instance identifier and distance value with the id and the distance

Definition at line 618 of file itkKdTree.h.

References itk::NumericTraits< T >::min().

◆ resize()

template<typename TSample >
void itk::Statistics::KdTree< TSample >::NearestNeighbors::resize ( unsigned int  k)
inline

Initialize the internal instance identifier and distance holders with the size, k

Definition at line 598 of file itkKdTree.h.

Member Data Documentation

◆ m_Distances

template<typename TSample >
std::vector<double>& itk::Statistics::KdTree< TSample >::NearestNeighbors::m_Distances
private

External storage for the distance values of k-neighbors from the query point. This is a reference to external vector to avoid unnecessary memory copying.

Definition at line 660 of file itkKdTree.h.

◆ m_FarthestNeighborIndex

template<typename TSample >
unsigned int itk::Statistics::KdTree< TSample >::NearestNeighbors::m_FarthestNeighborIndex
private

The index of the farthest neighbor among k-neighbors

Definition at line 652 of file itkKdTree.h.

◆ m_Identifiers

template<typename TSample >
InstanceIdentifierVectorType itk::Statistics::KdTree< TSample >::NearestNeighbors::m_Identifiers
private

Storage for the instance identifiers of k-neighbors

Definition at line 655 of file itkKdTree.h.


The documentation for this class was generated from the following file: