Class IterableLoopBuilder<T>
java.lang.Object
net.imglib2.loops.IterableLoopBuilder<T>
Similar to
LoopBuilder, but expects the first image to be an IterableInterval
and the other images to be RandomAccessible.
Please note: It is usually preferable to use LoopBuilder as it often has a better performance,
and using RandomAccessibleInterval for all images is simpler.
Here is an usage example, that calculates the sum of two images:
IterableInterval<DoubleType> sum = ...
RandomAccessible<DoubleType> imageA = ...
RandomAccessible<DoubleType> imageB = ...
IterableLoopBuilder.setImages(sum, imageA, imageB).forEachPixel(
(s, a, b) -> {
s.setReal(a.getRealDouble() + b.getRealDouble());
}
);
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IterableInterval<?> private final List<RandomAccessible<?>> private TaskExecutor -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateIterableLoopBuilder(IterableInterval<?> firstImage, RandomAccessible<?>... otherImages) -
Method Summary
Modifier and TypeMethodDescription<R> List<R> forEachChunk(Function<LoopBuilder.Chunk<T>, R> chunkAction) voidforEachPixel(T action) Executes the given action pixel wise for the given images.This will cause the loop to be executed in a multi threaded fashion.multithreaded(TaskExecutor taskExecutor) This will cause the loop to be executed in a multi threaded fashion.static <A> IterableLoopBuilder<Consumer<A>> setImages(IterableInterval<A> a) Set the image to loop over.static <A,B> IterableLoopBuilder <BiConsumer<A, B>> setImages(IterableInterval<A> a, RandomAccessible<B> b) Sets the images to loop over.static <A,B, C> IterableLoopBuilder <LoopBuilder.TriConsumer<A, B, C>> setImages(IterableInterval<A> a, RandomAccessible<B> b, RandomAccessible<C> c) Sets the images to loop over.
-
Field Details
-
taskExecutor
-
firstImage
-
otherImages
-
-
Constructor Details
-
IterableLoopBuilder
-
-
Method Details
-
setImages
Set the image to loop over. -
setImages
public static <A,B> IterableLoopBuilder<BiConsumer<A,B>> setImages(IterableInterval<A> a, RandomAccessible<B> b) Sets the images to loop over. -
setImages
public static <A,B, IterableLoopBuilder<LoopBuilder.TriConsumer<A,C> B, setImagesC>> (IterableInterval<A> a, RandomAccessible<B> b, RandomAccessible<C> c) Sets the images to loop over. -
forEachPixel
Executes the given action pixel wise for the given images. -
forEachChunk
- See Also:
-
multithreaded
This will cause the loop to be executed in a multi threaded fashion. Details can be set using theParallelizationframework. -
multithreaded
This will cause the loop to be executed in a multi threaded fashion. The giveTaskExecutorwill be used for multi threading.
-