Package net.imglib2.neighborsearch
Class RadiusNeighborSearchOnKDTree<T>
- java.lang.Object
-
- net.imglib2.neighborsearch.RadiusNeighborSearchOnKDTree<T>
-
- All Implemented Interfaces:
EuclideanSpace
,RadiusNeighborSearch<T>
public class RadiusNeighborSearchOnKDTree<T> extends java.lang.Object implements RadiusNeighborSearch<T>
Implementation ofRadiusNeighborSearch
search for kd-trees.- Author:
- Tobias Pietzsch
-
-
Field Summary
Fields Modifier and Type Field Description protected int
n
protected double[]
pos
protected java.util.ArrayList<ValuePair<KDTreeNode<T>,java.lang.Double>>
resultPoints
protected KDTree<T>
tree
-
Constructor Summary
Constructors Constructor Description RadiusNeighborSearchOnKDTree(KDTree<T> tree)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getDistance(int i)
Access the Euclidean distance between the reference location as used for the last search and the ith neighbor.RealLocalizable
getPosition(int i)
Access the position of the ith neighbor within radius.Sampler<T>
getSampler(int i)
Access the data of the ith neighbor within radius.double
getSquareDistance(int i)
Access the square Euclidean distance between the reference location as used for the last search and the ith neighbor.int
numDimensions()
Gets the space's number of dimensions.int
numNeighbors()
Get the number of points found within radius after aRadiusNeighborSearch.search(RealLocalizable, double, boolean)
.void
search(RealLocalizable reference, double radius, boolean sortResults)
Perform neighbor search within a radius about a reference coordinate.protected void
searchNode(KDTreeNode<T> current, double squRadius)
-
-
-
Field Detail
-
n
protected final int n
-
pos
protected final double[] pos
-
resultPoints
protected java.util.ArrayList<ValuePair<KDTreeNode<T>,java.lang.Double>> resultPoints
-
-
Method Detail
-
search
public void search(RealLocalizable reference, double radius, boolean sortResults)
Description copied from interface:RadiusNeighborSearch
Perform neighbor search within a radius about a reference coordinate. A point is considered within radius if its distance to the reference is smaller or equal the radius.- Specified by:
search
in interfaceRadiusNeighborSearch<T>
- Parameters:
reference
- the reference coordinate.radius
- the radius about the reference coordinate that should be searched for neighbors.sortResults
- whether the results should be ordered by ascending distances to reference.
-
numDimensions
public int numDimensions()
Description copied from interface:EuclideanSpace
Gets the space's number of dimensions.- Specified by:
numDimensions
in interfaceEuclideanSpace
-
searchNode
protected void searchNode(KDTreeNode<T> current, double squRadius)
-
numNeighbors
public int numNeighbors()
Description copied from interface:RadiusNeighborSearch
Get the number of points found within radius after aRadiusNeighborSearch.search(RealLocalizable, double, boolean)
.- Specified by:
numNeighbors
in interfaceRadiusNeighborSearch<T>
- Returns:
- the number of points found within radius after a
RadiusNeighborSearch.search(RealLocalizable, double, boolean)
.
-
getSampler
public Sampler<T> getSampler(int i)
Description copied from interface:RadiusNeighborSearch
Access the data of the ith neighbor within radius. IfsortResults
was set to true, neighbors are ordered by square Euclidean distance to the reference. Data is accessed through aSampler
that guarantees write access if the underlying data set is writable.- Specified by:
getSampler
in interfaceRadiusNeighborSearch<T>
-
getPosition
public RealLocalizable getPosition(int i)
Description copied from interface:RadiusNeighborSearch
Access the position of the ith neighbor within radius. IfsortResults
was set to true, neighbors are ordered by square Euclidean distance to the reference.- Specified by:
getPosition
in interfaceRadiusNeighborSearch<T>
-
getSquareDistance
public double getSquareDistance(int i)
Description copied from interface:RadiusNeighborSearch
Access the square Euclidean distance between the reference location as used for the last search and the ith neighbor. IfsortResults
was set to true, neighbors are ordered by square Euclidean distance to the reference.- Specified by:
getSquareDistance
in interfaceRadiusNeighborSearch<T>
-
getDistance
public double getDistance(int i)
Description copied from interface:RadiusNeighborSearch
Access the Euclidean distance between the reference location as used for the last search and the ith neighbor.- Specified by:
getDistance
in interfaceRadiusNeighborSearch<T>
-
-