[RoiManager] show selected ROIs

Hi to all,
maybe already replied but I surfed mailing lists and Forum and didnt find.
I want to select only some ROIs and show (not draw) them on an Image.
Is it already possible?
Essentially, I would like the same behavior of the checkbox show all but that displays only the selected ROIs and not all the ROIs.
Thank you very much,
Emanuele

One way to achieve this is to add the selected ROIs to the image overlay.

Here’s a small Groovy script that does this by looping through the indices of selected ROIs:

import ij.IJ;
import ij.plugin.frame.RoiManager;

rm = RoiManager.getInstance();
selected = rm.getSelectedIndexes();

imp = IJ.getImage();

for (index in selected) {
    rm.select(index);
    IJ.run(imp, "Add Selection...", "");
}

IJ.run(imp, "Select None", "");
1 Like

I tried that way, but is it possible to remove selections from image?
Maybe, I am wronging but i cant remove them… otherewise when I use “show all” they are putted in a no destructive way.
I see now an “overlay” API so maybe I need to use it.

Thank you,
Emanuele

@emartini Overlays are non-destructive. Try the commands in the Image > Overlay submenu.

OK resolved via Overlay API.

Thank you @imagejan