T - the type of values stored in the tree.public class KDTreeData<T> extends Object
Positions are stored in either FLAT or NESTED layout. With NESTED layout, positions are stored as
a nested double[][] array where positions[d][i] is dimension
d of the i-th point. With FLAT layout, positions are
stored as a flat double[] array, where positions[d + i*n] is
dimension d of the i-th point, with n the number of
dimensions.
Values (of type T) are stored as either a 1D RandomAccessibleInterval<T>, or a List<T>. Individual values can be
accessed by valuesSupplier().get().apply(i). valueSupplier().get() returns a reusable IntFunction<T>. Here T maybe a proxy that is reused in subsequent apply(i).
values() returns all values as a 1D RandomAccessibleInterval<T>. (If data is stored as List<T>, it is
wrapped into a ListImg.)
| Constructor and Description |
|---|
KDTreeData(KDTreePositions positions,
List<T> values) |
KDTreeData(KDTreePositions positions,
List<T> values,
RealInterval boundingBox) |
KDTreeData(KDTreePositions positions,
RandomAccessibleInterval<T> values) |
KDTreeData(KDTreePositions positions,
RandomAccessibleInterval<T> values,
RealInterval boundingBox) |
| Modifier and Type | Method and Description |
|---|---|
RealInterval |
boundingBox() |
static <L extends RealLocalizable,T> |
create(int numPoints,
Iterable<T> values,
Iterable<L> positions,
boolean storeValuesAsNativeImg)
|
T |
getType() |
KDTreePositions |
positions() |
RandomAccessibleInterval<T> |
values()
Get the values as a 1D
RandomAccessibleInterval, for
serialization. |
Supplier<IntFunction<T>> |
valuesSupplier()
Get a
Supplier that return IntFunction<T> to provide
values for a given node indices. |
public KDTreeData(KDTreePositions positions, List<T> values)
public KDTreeData(KDTreePositions positions, List<T> values, RealInterval boundingBox)
public KDTreeData(KDTreePositions positions, RandomAccessibleInterval<T> values)
public KDTreeData(KDTreePositions positions, RandomAccessibleInterval<T> values, RealInterval boundingBox)
public KDTreePositions positions()
public T getType()
public RandomAccessibleInterval<T> values()
RandomAccessibleInterval, for
serialization. (If the underlying storage is a List<T>, it will
be wrapped as a ListImg.)public Supplier<IntFunction<T>> valuesSupplier()
Supplier that return IntFunction<T> to provide
values for a given node indices. If the returned IntFunction<T>
is stateful (T maybe a proxy that is reused in subsequent apply(i)} every Supplier.get() creates a new instance of the
IntFunction<T>.public RealInterval boundingBox()
public static <L extends RealLocalizable,T> KDTreeData<T> create(int numPoints, Iterable<T> values, Iterable<L> positions, boolean storeValuesAsNativeImg)
KDTreeData from the given values and positions).
(copies positions and sorts into a KDTree structure).numPoints - number of points (number of elements in values and positions).values - values associated with pointspositions - points positionsstoreValuesAsNativeImg - If true and T is a NativeType,
store values into NativeImg.
Otherwise, store values as a List<T>.Copyright © 2009–2025 ImgLib2. All rights reserved.