public class KDTree<T> extends Object implements EuclideanSpace, IterableRealInterval<T>
| Modifier and Type | Class and Description |
|---|---|
class |
KDTree.KDTreeCursor |
| Constructor and Description |
|---|
KDTree(int numPoints,
Iterable<T> values,
Iterable<L> positions) |
KDTree(IterableRealInterval<T> interval)
Construct a KDTree from the elements of the given
IterableRealInterval. |
KDTree(KDTreeData<T> data) |
KDTree(List<T> values,
List<L> positions)
Construct a KDTree from the elements in the given list.
|
| Modifier and Type | Method and Description |
|---|---|
KDTreeNode<T> |
createNode()
Create a re-usable
KDTreeNode proxy linked to this tree. |
KDTree.KDTreeCursor |
cursor()
Returns a
RealCursor that iterates with optimal speed without
calculating the location at each iteration step. |
KDTreeNode<T> |
getRoot()
Deprecated.
KDTreeNode is now a re-usable proxy (like NativeType).
To work with existing code, KDTreeNode.left(), KDTreeNode.right(), getRoot() etc create new objects in each
call, instead of re-using existing proxies.
Code using that should be rewritten to reuse proxies, if possible. |
T |
getType()
Get an instance of
T. |
KDTreeImpl |
impl()
Access to pure coordinate kD Tree implementation.
|
Object |
iterationOrder()
Returns the iteration order of this
IterableRealInterval. |
KDTree.KDTreeCursor |
iterator() |
KDTree.KDTreeCursor |
localizingCursor()
Returns a
RealLocalizable Iterator that calculates its
location at each iteration step. |
int |
numDimensions()
Gets the space's number of dimensions.
|
double |
realMax(int d)
Get the maximum in dimension d.
|
double |
realMin(int d)
Get the minimum in dimension d.
|
long |
size()
Returns the number of elements in this
Function. |
String |
toString() |
KDTreeData<T> |
treeData()
Access to underlying data for serialization.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfirstElement, localizingSpliterator, parallelStream, spliterator, streammaxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPoint, realMax, realMax, realMin, realMinpublic KDTree(List<T> values, List<L> positions)
Note that the constructor can be called with the same list for both
values == positions if T extends RealLocalizable.
values - a list of valuespositions - a list of positions corresponding to the valuespublic KDTree(IterableRealInterval<T> interval)
IterableRealInterval.interval - elements in the tree are obtained by iterating thispublic KDTree(KDTreeData<T> data)
public KDTreeData<T> treeData()
public KDTreeImpl impl()
@Deprecated public KDTreeNode<T> getRoot()
KDTreeNode is now a re-usable proxy (like NativeType).
To work with existing code, KDTreeNode.left(), KDTreeNode.right(), getRoot() etc create new objects in each
call, instead of re-using existing proxies.
Code using that should be rewritten to reuse proxies, if possible.public T getType()
IterableRealIntervalT.
It should not be assumed that the returned T instance is an
independent copy. In particular, repeated calls to getType() may
return the same instance.
The default implementation returns IterableRealInterval.firstElement(). Derived classes
may choose different implementations for improved performance.
public int numDimensions()
EuclideanSpacenumDimensions in interface EuclideanSpacepublic double realMin(int d)
RealIntervalrealMin in interface RealIntervald - dimensionpublic double realMax(int d)
RealIntervalrealMax in interface RealIntervald - dimensionpublic KDTree.KDTreeCursor cursor()
IterableRealInterval
Returns a RealCursor that iterates with optimal speed without
calculating the location at each iteration step. Localization is
performed on demand.
Use this where localization is required rarely/ not for each iteration.
cursor in interface IterableRealInterval<T>public KDTree.KDTreeCursor localizingCursor()
IterableRealInterval
Returns a RealLocalizable Iterator that calculates its
location at each iteration step. That is, localization is performed with
optimal speed.
Use this where localization is required often/ for each iteration.
localizingCursor in interface IterableRealInterval<T>public KDTree.KDTreeCursor iterator()
public long size()
IterableRealInterval
Returns the number of elements in this Function.
size in interface IterableRealInterval<T>public Object iterationOrder()
IterableRealIntervalIterableRealInterval. If the
returned object equals (Object.equals(Object)) the iteration
order of another IterableRealInterval f then they can be
copied by synchronous iteration. That is, having an Iterator on
this and another Iterator on f, moving both in synchrony
will point both of them to corresponding locations in their source
domain. In other words, this and f have the same iteration order
and means and the same number of elements.iterationOrder in interface IterableRealInterval<T>IterableRealInterval.FlatIterationOrderpublic KDTreeNode<T> createNode()
KDTreeNode proxy linked to this tree.
KDTreeNode.setNodeIndex(int) can be used to point the proxy to a
particular node in the tree.Copyright © 2009–2025 ImgLib2. All rights reserved.