Class LoopUtils
java.lang.Object
net.imglib2.loops.LoopUtils
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RunnablecreateIntervalLoop(Positionable positionable, Dimensions dimensions, Runnable action) Returns aRunnablecontaining a loop.static RunnablecreateLineLoop(Positionable positionable, long length, int dimension, Runnable action) Returns a loop, that moves the given positonable along a line, and executes the given operation for each pixel of the line.
-
Field Details
-
factory
-
-
Constructor Details
-
LoopUtils
private LoopUtils()
-
-
Method Details
-
createLineLoop
public static Runnable createLineLoop(Positionable positionable, long length, int dimension, Runnable action) Returns a loop, that moves the given positonable along a line, and executes the given operation for each pixel of the line. The method uses
ClassCopyProvider, such that the returned loop can be optimised gracefully by the java just-in-time compiler. Aside from that, the result is functionally equivalent to:Runnable result = () -> { for (long i = 0; i < length; i++) { operation.run(); positionable.fwd(dimension); } positionable.move(- length, dimension); }- Parameters:
positionable- Positionable that is moved (along a line). Defines the starting point of the line. After the loops execution the positionable is moved back to the starting point.length- Length of the line.dimension- Direction of the line.action- Operation that is executed for each pixel along the line.- Returns:
- A
Runnablethat is functionally equivalent to:
-
createIntervalLoop
public static Runnable createIntervalLoop(Positionable positionable, Dimensions dimensions, Runnable action) Returns aRunnablecontaining a loop. The loop moves the given positionable over all the pixels of an interval. For each pixel of the interval the given operation is executed.- Parameters:
positionable- Positionable that is moved. Defines the minimum point of the interval. After the loops execution the positionable is moved back to the starting point.dimensions- Dimensions of the interval.action- Operation that is executed for each pixel of the interval.
-