| Modifier and Type | Class and Description |
|---|---|
static class |
LoopUtils.LineProcessor |
| Modifier and Type | Method and Description |
|---|---|
static Runnable |
createIntervalLoop(Positionable positionable,
Dimensions dimensions,
Runnable action)
Returns a
Runnable containing a loop. |
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.
|
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);
}
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.Runnable that is functionally equivalent to:public static Runnable createIntervalLoop(Positionable positionable, Dimensions dimensions, Runnable action)
Runnable containing 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.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.Copyright © 2015–2022 ImgLib2. All rights reserved.