Imglib2: Accessibles and Accessors and how to get from one to the other

trying to lift some of my confusion…

@gab1one showed a way to use ops to get from an accessor to an accessible. Calling ImageJ ops in a plugin; output types:
If I saw correctly there are some ops creating blank images in the “create” package and some wrapping accessors in a an Img. Sometimes only the dimesnions of the input are taken some times also the pixel values. Is that correct?

But then I was asking myself why this is in ops and what would be the imglib way to get from an accessor back to the accessible?

Hi Felix,
the CreateNamespace contains methods to create empty images based on the types, dimensions and factories (think memory layout) from different sources.

If you want to create an Img<T> out of a RandomAccessibleInterval<T> you can use the ImgView class from Imglib2, e.g:

Img<T> img = ImgView.wrap(rai, new ArrayImgFactory<>());
1 Like

thanks @gab1one was very helpful