public final class FlatCollections extends Object
Collections.
This is useful when you want to pass an ImgLib2 IterableInterval or
RandomAccessibleInterval to an API that works with Java
Collection objects, such as Google Guava's Quantiles.
| Constructor and Description |
|---|
FlatCollections() |
| Modifier and Type | Method and Description |
|---|---|
static Collection<BigInteger> |
bigIntegerCollection(IterableInterval<? extends IntegerType<?>> image)
Wraps an
IntegerType iterable image as a collection. |
static List<BigInteger> |
bigIntegerList(RandomAccessibleInterval<? extends IntegerType<?>> image)
Wraps a
IntegerType random-accessible image as a list. |
static Collection<Boolean> |
booleanCollection(IterableInterval<? extends BooleanType<?>> image)
Wraps a
BooleanType iterable image as a collection. |
static List<Boolean> |
booleanList(RandomAccessibleInterval<? extends BooleanType<?>> image)
Wraps a
BooleanType random-accessible image as a list. |
static <T,E> Collection<E> |
collection(IterableInterval<T> image,
Function<T,E> converter)
Wraps an
IterableInterval as a Collection. |
static Collection<Double> |
doubleCollection(IterableInterval<? extends RealType<?>> image)
Wraps a
RealType iterable image as a collection. |
static List<Double> |
doubleList(RandomAccessibleInterval<? extends RealType<?>> image)
Wraps a
RealType random-accessible image as a list. |
static Collection<Float> |
floatCollection(IterableInterval<? extends RealType<?>> image)
Wraps a
RealType iterable image as a collection. |
static List<Float> |
floatList(RandomAccessibleInterval<? extends RealType<?>> image)
Wraps a
RealType random-accessible image as a list. |
static Collection<Integer> |
integerCollection(IterableInterval<? extends IntegerType<?>> image)
Wraps an
IntegerType iterable image as a collection. |
static List<Integer> |
integerList(RandomAccessibleInterval<? extends IntegerType<?>> image)
Wraps an
IntegerType random-accessible image as a list. |
static <T,E> List<E> |
list(RandomAccessibleInterval<T> image,
Function<T,E> converter)
Wraps a
RandomAccessibleInterval as a List. |
static Collection<Long> |
longCollection(IterableInterval<? extends IntegerType<?>> image)
Wraps an
IntegerType iterable image as a collection. |
static List<Long> |
longList(RandomAccessibleInterval<? extends IntegerType<?>> image)
Wraps an
IntegerType random-accessible image as a list. |
public static <T,E> Collection<E> collection(IterableInterval<T> image, Function<T,E> converter)
IterableInterval as a Collection. The wrapped
collection is read-only, throwing UnsupportedOperationException
if the caller attempts to mutate it.
With this method, and unlike
list(RandomAccessibleInterval, Function), the iteration
order of the wrapped collection will match that of the source
image. It is best not to make any assumptions about the iteration
order of the collection—only that each element of the wrapped image
will appear once in the iteration.
image - The IterableInterval to wrap as a Java collection.converter - Conversion function to use for accessing elements of the
collection. This function will be transparently called on the
corresponding source sample from the ImgLib2 image.Collection of the converted type.public static Collection<Boolean> booleanCollection(IterableInterval<? extends BooleanType<?>> image)
BooleanType iterable image as a collection.
Warning: Don't make any assumption on the iteration order, only that each pixel will appear once. Performance may be low as the collection uses boxed types.
image - The IterableInterval to wrap as a Java collection.Collection with Boolean elements.collection(IterableInterval, Function)public static Collection<Double> doubleCollection(IterableInterval<? extends RealType<?>> image)
RealType iterable image as a collection.
Warning: Don't make any assumption on the iteration order, only that each pixel will appear once. Performance may be low as the collection uses boxed types.
image - The IterableInterval to wrap as a Java collection.Collection with Double elements.collection(IterableInterval, Function)public static Collection<Float> floatCollection(IterableInterval<? extends RealType<?>> image)
RealType iterable image as a collection.
Warning: Don't make any assumption on the iteration order, only that each pixel will appear once. Performance may be low as the collection uses boxed types.
image - The IterableInterval to wrap as a Java collection.Collection with Float elements.collection(IterableInterval, Function)public static Collection<Integer> integerCollection(IterableInterval<? extends IntegerType<?>> image)
IntegerType iterable image as a collection.
Warning: Don't make any assumption on the iteration order, only that each pixel will appear once. Performance may be low as the collection uses boxed types.
image - The IterableInterval to wrap as a Java collection.Collection with Integer elements.collection(IterableInterval, Function)public static Collection<Long> longCollection(IterableInterval<? extends IntegerType<?>> image)
IntegerType iterable image as a collection.
Warning: Don't make any assumption on the iteration order, only that each pixel will appear once. Performance may be low as the collection uses boxed types.
image - The IterableInterval to wrap as a Java collection.Collection with Long elements.collection(IterableInterval, Function)public static Collection<BigInteger> bigIntegerCollection(IterableInterval<? extends IntegerType<?>> image)
IntegerType iterable image as a collection.
Warning: Don't make any assumption on the iteration order, only that each pixel will appear once. Performance may be low as the collection uses boxed types.
image - The IterableInterval to wrap as a Java collection.Collection with BigInteger elements.collection(IterableInterval, Function)public static <T,E> List<E> list(RandomAccessibleInterval<T> image, Function<T,E> converter)
RandomAccessibleInterval as a List. The wrapped
list is read-only, throwing UnsupportedOperationException if the
caller attempts to mutate it.
With this method, and unlike
collection(IterableInterval, Function), the iteration order
of the wrapped list will always be the
flat iteration order, as
though Views.flatIterable(net.imglib2.RandomAccessibleInterval<T>) were used on the source
RandomAccessibleInterval image. As such, iterating the original
image and the wrapped List may result in differing sequences of
elements.
image - The RandomAccessibleInterval to wrap as a Java list.converter - Conversion function to use for accessing elements of the list.
This function will be transparently called on the
corresponding source sample from the ImgLib2 image.List of the converted type.public static List<Boolean> booleanList(RandomAccessibleInterval<? extends BooleanType<?>> image)
BooleanType random-accessible image as a list.
Warning: Performance may be low, as the collection uses boxed types.
image - The RandomAccessibleInterval to wrap as a Java list.List with Boolean elements.list(RandomAccessibleInterval, Function)public static List<Double> doubleList(RandomAccessibleInterval<? extends RealType<?>> image)
RealType random-accessible image as a list.
Warning: Performance may be low, as the collection uses boxed types.
image - The RandomAccessibleInterval to wrap as a Java list.List with Double elements.list(RandomAccessibleInterval, Function)public static List<Float> floatList(RandomAccessibleInterval<? extends RealType<?>> image)
RealType random-accessible image as a list.
Warning: Performance may be low, as the collection uses boxed types.
image - The RandomAccessibleInterval to wrap as a Java list.List with Float elements.list(RandomAccessibleInterval, Function)public static List<Integer> integerList(RandomAccessibleInterval<? extends IntegerType<?>> image)
IntegerType random-accessible image as a list.
Warning: Performance may be low, as the collection uses boxed types.
image - The RandomAccessibleInterval to wrap as a Java list.List with Integer elements.list(RandomAccessibleInterval, Function)public static List<Long> longList(RandomAccessibleInterval<? extends IntegerType<?>> image)
IntegerType random-accessible image as a list.
Warning: Performance may be low, as the collection uses boxed types.
image - The RandomAccessibleInterval to wrap as a Java list.List with Long elements.list(RandomAccessibleInterval, Function)public static List<BigInteger> bigIntegerList(RandomAccessibleInterval<? extends IntegerType<?>> image)
IntegerType random-accessible image as a list.
Warning: Performance may be low, as the collection uses boxed types.
image - The RandomAccessibleInterval to wrap as a Java list.List with BigInteger elements.list(RandomAccessibleInterval, Function)Copyright © 2015–2022 ImgLib2. All rights reserved.