Package net.imglib2.kdtree
Class KNearestNeighborSearchImpl
- java.lang.Object
-
- net.imglib2.kdtree.KNearestNeighborSearchImpl
-
public class KNearestNeighborSearchImpl extends java.lang.Objectk-nearest-neighbor search onKDTreeImpl. Results are node indices.
-
-
Field Summary
Fields Modifier and Type Field Description private int[]awayChildsprivate double[]axisDiffsprivate int[]bestIndexprivate double[]bestSquDistanceprivate intkprivate intnumDimensionsprivate intnumPointsprivate double[]posprivate KDTreeImpltree
-
Constructor Summary
Constructors Constructor Description KNearestNeighborSearchImpl(KDTreeImpl tree, int k)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intbestIndex(int i)doublebestSquDistance(int i)KNearestNeighborSearchImplcopy()private voidinsert(double squDistance, int index)Insert index into list of best nodes.intk()voidsearch(RealLocalizable p)
-
-
-
Field Detail
-
tree
private final KDTreeImpl tree
-
numDimensions
private final int numDimensions
-
numPoints
private final int numPoints
-
pos
private final double[] pos
-
k
private final int k
-
bestSquDistance
private final double[] bestSquDistance
-
bestIndex
private final int[] bestIndex
-
axisDiffs
private final double[] axisDiffs
-
awayChilds
private final int[] awayChilds
-
-
Constructor Detail
-
KNearestNeighborSearchImpl
public KNearestNeighborSearchImpl(KDTreeImpl tree, int k)
-
-
Method Detail
-
insert
private void insert(double squDistance, int index)Insert index into list of best nodes. Also checks whether index will be inserted at all, that is, whether squDistance < bestSquDistance[k-1]
-
search
public void search(RealLocalizable p)
-
k
public int k()
-
bestIndex
public int bestIndex(int i)
-
bestSquDistance
public double bestSquDistance(int i)
-
copy
public KNearestNeighborSearchImpl copy()
-
-