Package net.imglib2.neighborsearch
Class NearestNeighborSearchOnKDTree<T>
- java.lang.Object
-
- net.imglib2.neighborsearch.NearestNeighborSearchOnKDTree<T>
-
- All Implemented Interfaces:
EuclideanSpace
,NearestNeighborSearch<T>
public class NearestNeighborSearchOnKDTree<T> extends java.lang.Object implements NearestNeighborSearch<T>
Implementation ofNearestNeighborSearch
search for kd-trees.- Author:
- Tobias Pietzsch
-
-
Field Summary
Fields Modifier and Type Field Description protected KDTreeNode<T>
bestPoint
protected double
bestSquDistance
protected int
n
protected double[]
pos
protected KDTree<T>
tree
-
Constructor Summary
Constructors Constructor Description NearestNeighborSearchOnKDTree(KDTree<T> tree)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NearestNeighborSearchOnKDTree<T>
copy()
Create a copy.double
getDistance()
Access the Euclidean distance between the reference location as used for the last search and the nearest neighbor, ordered by square Euclidean distance.RealLocalizable
getPosition()
Access the position of the nearest neighbor, ordered by square Euclidean distance.Sampler<T>
getSampler()
Access the data of the nearest neighbor.double
getSquareDistance()
Access the square Euclidean distance between the reference location as used for the last search and the nearest neighbor, ordered by square Euclidean distance.int
numDimensions()
Gets the space's number of dimensions.void
search(RealLocalizable p)
Perform nearest-neighbor search for a reference coordinate.protected void
searchNode(KDTreeNode<T> current)
-
-
-
Field Detail
-
n
protected final int n
-
pos
protected final double[] pos
-
bestPoint
protected KDTreeNode<T> bestPoint
-
bestSquDistance
protected double bestSquDistance
-
-
Method Detail
-
numDimensions
public int numDimensions()
Description copied from interface:EuclideanSpace
Gets the space's number of dimensions.- Specified by:
numDimensions
in interfaceEuclideanSpace
-
search
public void search(RealLocalizable p)
Description copied from interface:NearestNeighborSearch
Perform nearest-neighbor search for a reference coordinate.- Specified by:
search
in interfaceNearestNeighborSearch<T>
-
searchNode
protected void searchNode(KDTreeNode<T> current)
-
getSampler
public Sampler<T> getSampler()
Description copied from interface:NearestNeighborSearch
Access the data of the nearest neighbor. Data is accessed through aSampler
that guarantees write access if the underlying data set is writable.- Specified by:
getSampler
in interfaceNearestNeighborSearch<T>
-
getPosition
public RealLocalizable getPosition()
Description copied from interface:NearestNeighborSearch
Access the position of the nearest neighbor, ordered by square Euclidean distance.- Specified by:
getPosition
in interfaceNearestNeighborSearch<T>
-
getSquareDistance
public double getSquareDistance()
Description copied from interface:NearestNeighborSearch
Access the square Euclidean distance between the reference location as used for the last search and the nearest neighbor, ordered by square Euclidean distance.- Specified by:
getSquareDistance
in interfaceNearestNeighborSearch<T>
-
getDistance
public double getDistance()
Description copied from interface:NearestNeighborSearch
Access the Euclidean distance between the reference location as used for the last search and the nearest neighbor, ordered by square Euclidean distance.- Specified by:
getDistance
in interfaceNearestNeighborSearch<T>
-
copy
public NearestNeighborSearchOnKDTree<T> copy()
Description copied from interface:NearestNeighborSearch
Create a copy.- Specified by:
copy
in interfaceNearestNeighborSearch<T>
-
-