Set ROI names as label with Java

Hi,

I am currently developing a plugin in which I take screenshots with ROIs displayed but I can’t find a way to use Roi names as labels without going by hand in the Roi Manager with More > Options > and tick Use ROI names as labels.

So if anyone knew how to do this I’d be very grateful, and don’t hesitate to ask me details if you didn’t understand.

This setting is stored in the ij.Prefs class.

You can simply set it to true in any full-fledged scripting language, e.g. in Groovy:

import ij.Prefs

Prefs.useNamesAsLabels = true

Note that you’ll need to update the ROI overlay after changing this in order to see the effect.

4 Likes