Class KDTreeData<T>
java.lang.Object
net.imglib2.kdtree.KDTreeData<T>
- Type Parameters:
T- the type of values stored in the tree.
Stores the KDTree data, that is, positions and values.
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.)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RealIntervalprivate final KDTreePositionsprivate final Tprivate final RandomAccessibleInterval<T> private final Supplier<IntFunction<T>> -
Constructor Summary
ConstructorsConstructorDescriptionKDTreeData(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) -
Method Summary
Modifier and TypeMethodDescriptionstatic <L extends RealLocalizable, T>
KDTreeData<T> getType()values()Get the values as a 1DRandomAccessibleInterval, for serialization.Get aSupplierthat returnIntFunction<T>to provide values for a given node indices.
-
Field Details
-
positions
-
valuesImg
-
valuesSupplier
-
type
-
boundingBox
-
-
Constructor Details
-
KDTreeData
-
KDTreeData
-
KDTreeData
-
KDTreeData
public KDTreeData(KDTreePositions positions, RandomAccessibleInterval<T> values, RealInterval boundingBox)
-
-
Method Details
-
positions
-
getType
-
values
Get the values as a 1DRandomAccessibleInterval, for serialization. (If the underlying storage is aList<T>, it will be wrapped as aListImg.) -
valuesSupplier
Get aSupplierthat returnIntFunction<T>to provide values for a given node indices. If the returnedIntFunction<T>is stateful (Tmaybe a proxy that is reused in subsequentapply(i)} everySupplier.get()creates a new instance of theIntFunction<T>. -
boundingBox
-
create
public static <L extends RealLocalizable, T> KDTreeData<T> create(int numPoints, Iterable<T> values, Iterable<L> positions, boolean storeValuesAsNativeImg) CreateKDTreeDatafrom the givenvaluesandpositions). (copiespositionsand sorts into a KDTree structure).- Parameters:
numPoints- number of points (number of elements invaluesandpositions).values- values associated with pointspositions- points positionsstoreValuesAsNativeImg- IftrueandTis aNativeType, store values intoNativeImg. Otherwise, store values as aList<T>.
-