|
44 | 44 | import net.imglib2.RandomAccessible;
|
45 | 45 | import net.imglib2.Typed;
|
46 | 46 | import net.imglib2.blocks.PrimitiveBlocks;
|
| 47 | +import net.imglib2.cache.img.CachedCellImg; |
47 | 48 | import net.imglib2.type.NativeType;
|
48 | 49 | import net.imglib2.util.Cast;
|
49 | 50 | import net.imglib2.util.Util;
|
@@ -156,6 +157,25 @@ default < U extends NativeType< U > > BlockSupplier< U > andThen( Function< Bloc
|
156 | 157 | return andThen( function.apply( this ) );
|
157 | 158 | }
|
158 | 159 |
|
| 160 | + /** |
| 161 | + * Return a {@code CachedCellImg} which copies cells from this {@code BlockSupplier}. |
| 162 | + * |
| 163 | + * @param dimensions |
| 164 | + * dimensions of the {@code CachedCellImg} to create |
| 165 | + * @param cellDimensions |
| 166 | + * block size of the {@code CachedCellImg} to create. |
| 167 | + * This is extended or truncated as necessary. |
| 168 | + * For example if {@code cellDimensions={64,32}} then for creating a 3D |
| 169 | + * image it will be augmented to {@code {64,32,32}}. For creating a 1D image |
| 170 | + * it will be truncated to {@code {64}}. |
| 171 | + * |
| 172 | + * @return a {@code CachedCellImg} which copies cells from this {@code BlockSupplier}. |
| 173 | + */ |
| 174 | + default CachedCellImg< T, ? > toCellImg( final long[] dimensions, final int... cellDimensions ) |
| 175 | + { |
| 176 | + return BlockAlgoUtils.cellImg( this, dimensions, cellDimensions ); |
| 177 | + } |
| 178 | + |
159 | 179 | /**
|
160 | 180 | * Create a {@code BlockSupplier} accessor for an arbitrary {@code
|
161 | 181 | * RandomAccessible} source. Many View constructions (that ultimately end in
|
|
0 commit comments