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 ofRadiusNeighborSearchsearch for kd-trees.
-
-
Field Summary
Fields Modifier and Type Field Description protected intnprotected double[]posprotected java.util.ArrayList<ValuePair<KDTreeNode<T>,java.lang.Double>>resultPointsprotected 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 doublegetDistance(int i)Access the Euclidean distance between the reference location as used for the last search and the ith neighbor.RealLocalizablegetPosition(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.doublegetSquareDistance(int i)Access the square Euclidean distance between the reference location as used for the last search and the ith neighbor.intnumDimensions()Gets the space's number of dimensions.intnumNeighbors()Get the number of points found within radius after aRadiusNeighborSearch.search(RealLocalizable, double, boolean).voidsearch(RealLocalizable reference, double radius, boolean sortResults)Perform neighbor search within a radius about a reference coordinate.protected voidsearchNode(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:RadiusNeighborSearchPerform 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:
searchin 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:EuclideanSpaceGets the space's number of dimensions.- Specified by:
numDimensionsin interfaceEuclideanSpace
-
searchNode
protected void searchNode(KDTreeNode<T> current, double squRadius)
-
numNeighbors
public int numNeighbors()
Description copied from interface:RadiusNeighborSearchGet the number of points found within radius after aRadiusNeighborSearch.search(RealLocalizable, double, boolean).- Specified by:
numNeighborsin 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:RadiusNeighborSearchAccess the data of the ith neighbor within radius. IfsortResultswas set to true, neighbors are ordered by square Euclidean distance to the reference. Data is accessed through aSamplerthat guarantees write access if the underlying data set is writable.- Specified by:
getSamplerin interfaceRadiusNeighborSearch<T>
-
getPosition
public RealLocalizable getPosition(int i)
Description copied from interface:RadiusNeighborSearchAccess the position of the ith neighbor within radius. IfsortResultswas set to true, neighbors are ordered by square Euclidean distance to the reference.- Specified by:
getPositionin interfaceRadiusNeighborSearch<T>
-
getSquareDistance
public double getSquareDistance(int i)
Description copied from interface:RadiusNeighborSearchAccess the square Euclidean distance between the reference location as used for the last search and the ith neighbor. IfsortResultswas set to true, neighbors are ordered by square Euclidean distance to the reference.- Specified by:
getSquareDistancein interfaceRadiusNeighborSearch<T>
-
getDistance
public double getDistance(int i)
Description copied from interface:RadiusNeighborSearchAccess the Euclidean distance between the reference location as used for the last search and the ith neighbor.- Specified by:
getDistancein interfaceRadiusNeighborSearch<T>
-
-