Save overlay after using Overlay service

Hi everyone,
Is there a way to save the overlays in Java code devop?
I know that overlays can be added to images using the Overlay service.
However, the image when stored using theIOService does not store the overlay.

Thanks for your help

As far as I can tell, saving overlays is currently not well supported, there are a few issues discussing this:

You might have to fall back to ImageJ 1.x API (saving ROIs), or create your own IOPlugin<Overlay> or similar in Java.

Thanks,
Actually, I was thinking it would be more interesting for overlays to return an iterator, cursor, to provide the possibility of manipulating the underlying image.
For example, I was hoping to iterate over the region and color the pixels, but I couldn’t find anything.

This is made possible by imglib2-roi and the ROI model implemented there, which (in part) supersedes/replaces IJ2 Overlays.

The main ROI “currency” of the new implementation are Mask and RealMask objects. To iterate contained pixels/voxels and change their value, you can get an IterableRegion.

Have a look at this repository to get started:

(In the future, this should hopefully migrate to imagej/tutorials at some point.)