I - input primitive array type, e.g., float[]O - output primitive array type, e.g., float[]public abstract class AbstractDimensionlessBlockProcessor<I,O> extends Object implements BlockProcessor<I,O>
BlockProcessor to simplify implementations.
This is intented as a base class for BlockProcessor with an adaptable
number of dimensions (such as converters). For BlockProcessor with a
fixed number of source dimensions, see AbstractBlockProcessor.
A BlockInterval is exposed through getSourceInterval()
(after setTargetInterval(net.imglib2.Interval) has been called). 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 net.imglib2.blocks.BlockInterval |
sourceInterval |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDimensionlessBlockProcessor(AbstractDimensionlessBlockProcessor<I,O> proc) |
protected |
AbstractDimensionlessBlockProcessor(net.imglib2.type.PrimitiveType sourcePrimitiveType) |
| 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() |
protected boolean |
updateNumSourceDimensions(int n)
Re-allocates
sourceInterval if it does not already exist and
match numDimensions()==n. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, independentCopyprotected net.imglib2.blocks.BlockInterval sourceInterval
protected AbstractDimensionlessBlockProcessor(net.imglib2.type.PrimitiveType sourcePrimitiveType)
protected AbstractDimensionlessBlockProcessor(AbstractDimensionlessBlockProcessor<I,O> proc)
public void setTargetInterval(net.imglib2.Interval interval)
setTargetInterval in interface BlockProcessor<I,O>protected boolean updateNumSourceDimensions(int n)
sourceInterval if it does not already exist and
match numDimensions()==n.n - new number of source dimensionstrue if sourceInterval was re-allocatedprotected int sourceLength()
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–2025 ImgLib2. All rights reserved.