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
Proxy for a node in a KDTree. A KDTreeNode has coordinates and a value. It
provides the coordinates via the
RealLocalizable interface. It
provides the value via Sampler.get().-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()get()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.final doubleGet the position alonggetSplitDimension()where this node divides the space.final intGet the dimension along which this node divides the space.getType()Get an instance ofT.left()Deprecated.intGet thenodeIndexwhich this proxy currently refers to.intGets the space's number of dimensions.right()Deprecated.KDTreeNodeis now a re-usable proxy (likeNativeType).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.final floatsquDistanceTo(float[] p) Compute the squared distance from p to this node.final doubleCompute the squared distance from p to this node.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RealLocalizable
getFloatPosition, localize, localize, localize, positionAsDoubleArray, positionAsRealPoint
-
Field Details
-
tree
-
nodeIndex
private int nodeIndex -
values
-
-
Constructor Details
-
KDTreeNode
-
-
Method Details
-
setNodeIndex
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.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.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
-
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
- 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
Compute the squared distance from p to this node.
-
KDTreeNodeis now a re-usable proxy (likeNativeType).