I - input primitive array type, e.g., float[]O - output primitive array type, e.g., float[]public abstract class AbstractBlockProcessor<I,O> extends Object implements BlockProcessor<I,O>
BlockProcessor to simplify implementations.
This is intented as a base class for BlockProcessor that have source
dimensionality fixed at construction. For BlockProcessor with
adaptable number of dimensions (such as converters), see AbstractDimensionlessBlockProcessor.
A BlockInterval of the desired number of dimensions is exposed
through getSourceInterval(). (For convenience, min and
dimensions of the interval are also exposed through the protected fields sourcePos and sourceSize.) The protected method sourceLength() returns the number of elements in
the source interval.
getSourceBuffer() is implemented
according to the sourcePrimitiveType specified at construction.
| Modifier and Type | Field and Description |
|---|---|
protected long[] |
sourcePos |
protected int[] |
sourceSize |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBlockProcessor(AbstractBlockProcessor<I,O> proc) |
protected |
AbstractBlockProcessor(net.imglib2.type.PrimitiveType sourcePrimitiveType,
int numSourceDimensions) |
| Modifier and Type | Method and Description |
|---|---|
I |
getSourceBuffer()
Get a
src array of sufficient size. |
net.imglib2.blocks.BlockInterval |
getSourceInterval() |
void |
setTargetInterval(net.imglib2.Interval interval) |
protected int |
sourceLength() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, independentCopyprotected AbstractBlockProcessor(net.imglib2.type.PrimitiveType sourcePrimitiveType, int numSourceDimensions)
protected AbstractBlockProcessor(AbstractBlockProcessor<I,O> proc)
protected int sourceLength()
public void setTargetInterval(net.imglib2.Interval interval)
setTargetInterval in interface BlockProcessor<I,O>public net.imglib2.blocks.BlockInterval getSourceInterval()
getSourceInterval in interface BlockProcessor<I,O>public I getSourceBuffer()
BlockProcessorsrc 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 );
getSourceBuffer in interface BlockProcessor<I,O>Copyright © 2009–2026 ImgLib2. All rights reserved.