Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itk::NearestNeighborFinder< TDataSet, TPoint > Class Template Reference

Templated K-nearest neighbor search algorithm. More...

#include <itkStatNearestNeighborFinder.h>

Inheritance diagram for itk::NearestNeighborFinder:

Inheritance graph
[legend]
Collaboration diagram for itk::NearestNeighborFinder< TDataSet, TPoint >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TDataSet DataSetType
typedef TPoint PointType
typedef std::vector< PointTypeOutputType
typedef NearestNeighborFinder Self
typedef LightProcessObject Superclass
typedef SmartPointer< SelfPointer
typedef SmartPointer< const
Self
ConstPointer

Public Methods

virtual const char * GetClassName () const
void SetInputParams (int K, DataSetType *dataSet, PointType *queryPoint) throw (InvalidInputError)
OutputType GetOutput () throw (InvalidInputError)

Static Public Methods

Pointer New ()

Protected Types

typedef std::vector< NeighborTypeNeighborsType

Protected Methods

 NearestNeighborFinder ()
void GenerateData ()
NeighborsType::iterator FindReplacement (double distance)
void CopyOutput ()
double GetDistance (PointType *A, PointType *B)

Detailed Description

template<class TDataSet, class TPoint>
class itk::NearestNeighborFinder< TDataSet, TPoint >

Templated K-nearest neighbor search algorithm.

This class is templated over the dataset (set of samples) and the data-point (sample) types. Users have to use New() method to create an instance of this class. With the input parameters (number of neighbors - K, pointer to dataset, and pointer to the query point) set by SetInputParams function, it will search k number of nearest neighbors which are determined by an euclidean distance function. Users can get the vector (std) which has k number of data-point by calling GetOutput() function.

NOTE: Current implementaion expects the dataset and data-point types are containers that support ForwardIterator interface.

See also:
EuclideanDistance in itkStatDistance.h

Definition at line 44 of file itkStatNearestNeighborFinder.h.


Member Typedef Documentation

template<class TDataSet, class TPoint>
typedef SmartPointer<const Self> itk::NearestNeighborFinder< TDataSet, TPoint >::ConstPointer
 

Reimplemented from itk::LightProcessObject.

Definition at line 76 of file itkStatNearestNeighborFinder.h.

template<class TDataSet, class TPoint>
typedef TDataSet itk::NearestNeighborFinder< TDataSet, TPoint >::DataSetType
 

Save Template parameter TPoint

Definition at line 50 of file itkStatNearestNeighborFinder.h.

template<class TDataSet, class TPoint>
typedef std::vector<NeighborType> itk::NearestNeighborFinder< TDataSet, TPoint >::NeighborsType [protected]
 

typedef of a vector (std) of the Neighbor struct

This will be used for creation of temporary result of K-nearest neighbor search

Definition at line 149 of file itkStatNearestNeighborFinder.h.

template<class TDataSet, class TPoint>
typedef std::vector<PointType> itk::NearestNeighborFinder< TDataSet, TPoint >::OutputType
 

return type of the GetOutput() function

Definition at line 60 of file itkStatNearestNeighborFinder.h.

template<class TDataSet, class TPoint>
typedef SmartPointer<Self> itk::NearestNeighborFinder< TDataSet, TPoint >::Pointer
 

Smart pointer typedef support.

Reimplemented from itk::LightProcessObject.

Definition at line 75 of file itkStatNearestNeighborFinder.h.

template<class TDataSet, class TPoint>
typedef TPoint itk::NearestNeighborFinder< TDataSet, TPoint >::PointType
 

Save Template parameter TPoint

Definition at line 55 of file itkStatNearestNeighborFinder.h.

template<class TDataSet, class TPoint>
typedef NearestNeighborFinder itk::NearestNeighborFinder< TDataSet, TPoint >::Self
 

Standard "Self" typedef.

Reimplemented from itk::LightProcessObject.

Definition at line 65 of file itkStatNearestNeighborFinder.h.

template<class TDataSet, class TPoint>
typedef LightProcessObject itk::NearestNeighborFinder< TDataSet, TPoint >::Superclass
 

Standard "Superclass" typedef.

Reimplemented from itk::LightProcessObject.

Definition at line 70 of file itkStatNearestNeighborFinder.h.


Constructor & Destructor Documentation

template<class TDataSet, class TPoint>
itk::NearestNeighborFinder< TDataSet, TPoint >::NearestNeighborFinder   [protected]
 

constructor


Member Function Documentation

template<class TDataSet, class TPoint>
void itk::NearestNeighborFinder< TDataSet, TPoint >::CopyOutput   [protected]
 

Extracts only the data-point portion of the final search result from the m_Neighbors and copy them to m_Output which will be used by GetOutput() function.

It is used by GenerateData()

template<class TDataSet, class TPoint>
NeighborsType::iterator itk::NearestNeighborFinder< TDataSet, TPoint >::FindReplacement double    distance [protected]
 

With the given distance parameter, it will try to find if there is any data-point in the m_Neighbors (temporary result storage) is not closer to the query point than the distance. If any, it will return the iterator of the first such data-point. If not, it will return the iterator of the last element in the M_neighbors.

It is used by GenerateData().

template<class TDataSet, class TPoint>
void itk::NearestNeighborFinder< TDataSet, TPoint >::GenerateData   [protected, virtual]
 

Perform the actual K-nearest neighbor search.

Reimplemented from itk::LightProcessObject.

template<class TDataSet, class TPoint>
virtual const char* itk::NearestNeighborFinder< TDataSet, TPoint >::GetClassName   const [virtual]
 

Run-time type information (and related methods).

Reimplemented from itk::LightProcessObject.

template<class TDataSet, class TPoint>
double itk::NearestNeighborFinder< TDataSet, TPoint >::GetDistance PointType   A,
PointType   B
[protected]
 

Get euclidean between the data-point A and the data-point B.

template<class TDataSet, class TPoint>
OutputType itk::NearestNeighborFinder< TDataSet, TPoint >::GetOutput   throw (InvalidInputError)
 

Return result

No argument required. This will return a vector (std) of data-points which are determined as K-nearest neighbors.

If the parameters haven't been properly set by SetInputParams function, it will throw the InvalidInputError of this class.

template<class TDataSet, class TPoint>
Pointer itk::NearestNeighborFinder< TDataSet, TPoint >::New   [static]
 

Method for creation through the object factory.

Reimplemented from itk::LightProcessObject.

template<class TDataSet, class TPoint>
void itk::NearestNeighborFinder< TDataSet, TPoint >::SetInputParams int    K,
DataSetType   dataSet,
PointType   queryPoint
throw (InvalidInputError)
 

Set input paraments

User should provides the number of neighbors (K), the pointer to the dataset (samples), and the pointer to the query point which will be evaluated with every sample in the dataset which is specifed by samples parameter

This will throw InvalidInputError (of this class) exception if the K is smaller than the size of samples or the size of queryPoint is equal to or less than 0.


The documentation for this class was generated from the following file:
Generated at Wed Mar 12 01:14:34 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000