I - input primitive array type, e.g., float[]O - output primitive array type, e.g., float[]public interface BlockProcessor<I,O>
BlockProcessor computes values in a flattened primitive output
array from values in a flattened primitive input array.
Typically, BlockProcessor should not be used directly, but wrapped in
DefaultUnaryBlockOperator which has the ImgLib2 Types
corresponding to I, O. This helps to avoid mistakes with
unchecked (primitive array) type casts.
| Modifier and Type | Method and Description |
|---|---|
void |
compute(I src,
O dest)
Compute the
dest array from the src array. |
I |
getSourceBuffer()
Get a
src array of sufficient size. |
net.imglib2.Interval |
getSourceInterval() |
BlockProcessor<I,O> |
independentCopy() |
void |
setTargetInterval(net.imglib2.Interval interval) |
BlockProcessor<I,O> independentCopy()
void setTargetInterval(net.imglib2.Interval interval)
net.imglib2.Interval getSourceInterval()
I getSourceBuffer()
src array of sufficient size.
Consecutive calls may return the same array (but don't have to).
E.g., this is a BUG:
blockProcessor.setTargetInterval( interval );
blockSupplier.copy( blockProcessor.getSourceInterval(), blockProcessor.getSourceBuffer() );
blockProcessor.compute( blockProcessor.getSourceBuffer(), dest );
Use this instead:
blockProcessor.setTargetInterval( interval );
Object buf = blockProcessor.getSourceBuffer();
blockSupplier.copy( blockProcessor.getSourceInterval(), buf );
blockProcessor.compute( buf, dest );
void compute(I src, O dest)
dest array from the src array.
src and dest are expected to be flattened arrays of the
dimensions specified in setTargetInterval(net.imglib2.Interval) and provided in getSourceInterval(), respectively. The typical sequence is:
dest with known flattened layout and min
position should be computed.setTargetInterval(net.imglib2.Interval). This will compute the corresponding
source interval including BlockProcessor-specific transformations, padding, etc.src array (either provided by getSourceBuffer(), or otherwise allocated) with the input data (see
BlockSupplier.copy(net.imglib2.Interval, java.lang.Object)).compute(src, dest) to compute the target array.src and dest arrays may be larger than
implied by setTargetInterval and getSourceSize. In that
case the trailing elements are ignored.
Typically, BlockProcessor should not be used directly, but
wrapped in DefaultUnaryBlockOperator which has the ImgLib2 Types corresponding to I, O.
src - flattened primitive array with input valuesdest - flattened primitive array to fill with output valuesCopyright © 2009–2025 ImgLib2. All rights reserved.