imglib / imglib2

A generic next-generation Java library for image processing
http://imglib2.net/
Other
302 stars 90 forks source link

Add NativeImg.getAccessType() method #367

Closed tpietzsch closed 2 months ago

tpietzsch commented 2 months ago

PR https://github.com/imglib/imglib2/pull/354 added PrimitiveBlocks.of(...) support for NativeImg backed by BufferAccess.

This requires to infer the DataAccess type that holds the data of the NativeImg. For https://github.com/imglib/imglib2/pull/354 this is done using img.update(img.cursor()): https://github.com/imglib/imglib2/blob/865e0c10e77a77efb3e4d22165c1c62013235b2a/src/main/java/net/imglib2/blocks/ViewProperties.java#L149-L163

Unfortunately, for CacheCellImgs, this means loading the first Cell, which can cause a lot of overhead. I disabled this in cc07d99acda5e747bc933ecd17bee07ab6f325a8 Because we don't really use buffer-backed images yet (in particular, not in conjunction with PrimitiveBlocks).

To make it work without unnecessary overhead, we should add a method A getAccessType() to NativeImg.