Package net.imglib2
Class KDTreeNode<T>
- java.lang.Object
-
- net.imglib2.KDTreeNode<T>
-
- Type Parameters:
T- value type.
- All Implemented Interfaces:
EuclideanSpace,RealLocalizable,Sampler<T>,Typed<T>
- Direct Known Subclasses:
KDTree.KDTreeCursor
public class KDTreeNode<T> extends java.lang.Object implements RealLocalizable, Sampler<T>
Proxy for a node in a KDTree. A KDTreeNode has coordinates and a value. It provides the coordinates via theRealLocalizableinterface. It provides the value viaSampler.get().
-
-
Constructor Summary
Constructors Constructor Description KDTreeNode(KDTree<T> tree)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description KDTreeNode<T>copy()Tget()Access the actual T instance providing access to a pixel, sub-pixel or integral region value theSamplerpoints at.doublegetDoublePosition(int d)Return the current position in a given dimension.doublegetSplitCoordinate()Get the position alonggetSplitDimension()where this node divides the space.intgetSplitDimension()Get the dimension along which this node divides the space.TgetType()Get an instance ofT.KDTreeNode<T>left()Deprecated.KDTreeNodeis now a re-usable proxy (likeNativeType).intnodeIndex()Get thenodeIndexwhich this proxy currently refers to.intnumDimensions()Gets the space's number of dimensions.KDTreeNode<T>right()Deprecated.KDTreeNodeis now a re-usable proxy (likeNativeType).KDTreeNode<T>setNodeIndex(int nodeIndex)Make this proxy refer to the givennodeIndexin the associated tree.doublesquDistanceTo(double[] p)Compute the squared distance from p to this node.floatsquDistanceTo(float[] p)Compute the squared distance from p to this node.doublesquDistanceTo(RealLocalizable p)Compute the squared distance from p to this node.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.imglib2.RealLocalizable
getFloatPosition, localize, localize, localize, positionAsDoubleArray, positionAsRealPoint
-
-
-
-
Method Detail
-
setNodeIndex
public KDTreeNode<T> setNodeIndex(int nodeIndex)
Make this proxy refer to the givennodeIndexin the associated tree.- Returns:
this
-
nodeIndex
public int nodeIndex()
Get thenodeIndexwhich this proxy currently refers to.
-
left
@Deprecated public KDTreeNode<T> left()
Deprecated.KDTreeNodeis now a re-usable proxy (likeNativeType). To work with existing code,left(),right(),KDTree.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.Left child of this node. All nodes x in the left subtree havex.pos[splitDimension] <= this.pos[splitDimension].
-
right
@Deprecated public KDTreeNode<T> right()
Deprecated.KDTreeNodeis now a re-usable proxy (likeNativeType). To work with existing code,left(),right(),KDTree.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.Right child of this node. All nodes x in the right subtree havex.pos[splitDimension] >= this.pos[splitDimension].
-
getSplitDimension
public final int getSplitDimension()
Get the dimension along which this node divides the space.- Returns:
- splitting dimension.
-
getSplitCoordinate
public final double getSplitCoordinate()
Get the position alonggetSplitDimension()where this node divides the space.- Returns:
- splitting position.
-
numDimensions
public int numDimensions()
Description copied from interface:EuclideanSpaceGets the space's number of dimensions.- Specified by:
numDimensionsin interfaceEuclideanSpace
-
getDoublePosition
public double getDoublePosition(int d)
Description copied from interface:RealLocalizableReturn the current position in a given dimension.- Specified by:
getDoublePositionin interfaceRealLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
get
public T get()
Description copied from interface:SamplerAccess the actual T instance providing access to a pixel, sub-pixel or integral region value theSamplerpoints at.
-
getType
public T getType()
Description copied from interface:TypedGet an instance ofT.It should not be assumed that the returned
Tinstance is an independent copy. In particular, repeated calls togetType()may return the same instance.
-
copy
public KDTreeNode<T> copy()
- Specified by:
copyin interfaceSampler<T>- Returns:
- - A new
Samplerin the same state accessing the same values. It does NOT copy T, just the state of theSampler. Otherwise use T.copy() if available. Sampler.copy().get() == Sampler.get(), i.e. both hold the same value, not necessarily the same instance (this is the case for anArrayCursorfor example)
-
squDistanceTo
public final float squDistanceTo(float[] p)
Compute the squared distance from p to this node.
-
squDistanceTo
public double squDistanceTo(double[] p)
Compute the squared distance from p to this node.
-
squDistanceTo
public final double squDistanceTo(RealLocalizable p)
Compute the squared distance from p to this node.
-
-