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 private RadiusNeighborSearchImplimplprivate java.util.List<KDTreeNode<T>>matchesprivate KDTree<T>tree
-
Constructor Summary
Constructors Modifier Constructor Description RadiusNeighborSearchOnKDTree(KDTree<T> tree)privateRadiusNeighborSearchOnKDTree(RadiusNeighborSearchOnKDTree<T> other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RadiusNeighborSearchOnKDTree<T>copy()Create a copy.private voidfillMatches(int first, int last)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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.imglib2.neighborsearch.RadiusNeighborSearch
getDistance
-
-
-
-
Field Detail
-
impl
private final RadiusNeighborSearchImpl impl
-
matches
private final java.util.List<KDTreeNode<T>> matches
-
-
Constructor Detail
-
RadiusNeighborSearchOnKDTree
private RadiusNeighborSearchOnKDTree(RadiusNeighborSearchOnKDTree<T> other)
-
-
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.
-
fillMatches
private void fillMatches(int first, int last)
-
numDimensions
public int numDimensions()
Description copied from interface:EuclideanSpaceGets the space's number of dimensions.- Specified by:
numDimensionsin interfaceEuclideanSpace
-
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>
-
copy
public RadiusNeighborSearchOnKDTree<T> copy()
Description copied from interface:RadiusNeighborSearchCreate a copy.- Specified by:
copyin interfaceRadiusNeighborSearch<T>
-
-