FIJI ImageJ ROI Manager - Setting Fill Colors

Hi all,

Could someone please suggest how I can set the FillColor and StrokeColor for ROIs using the ImageJ Macro language?

Specifically, I have written a script that prompts you to select an image file, opens the ROI Manager, sets the ‘Show All with labels’ option, and sets the freehand tool to start drawing your ROIs.

Is there a way to set the FillColor and StrokeColor so that each ROI that is subsequently drawn and added to the ROI Manager (using Add or ‘t’) is automatically filled in with a certain Fill and Stroke colour (e.g. blue)?

(As opposed to drawing the ROI first and then selecting it and setting the Fill and Stroke color.)

Thank you
Emma

The ImageJ macro API has two functions to set the color which might work for you, see:

https://imagej.net/developer/macro/functions.html#R

Here are the commands (from the ImageJ API):

Roi.setStrokeColor(color)
Sets the selection stroke color (“red”, “5500ff00”. etc.).
Roi.setStrokeColor(red, green, blue)
Sets the selection stroke color, where ‘red’, ‘green’ and ‘blue’ are integers (0-255).
Roi.setStrokeColor(rgb)
Sets the selection stroke color, where ‘rgb’ is an integer.
Roi.setFillColor(color)
Sets the selection fill color (“red”, “5500ff00”. etc.).
Roi.setFillColor(red, green, blue)
Sets the selection fill color, where ‘red’, ‘green’ and ‘blue’ are integers (0-255).
Roi.setFillColor(rgb)
Sets the selection fill color, where ‘rgb’ is an integer.

1 Like