Using ImageJ/Fiji for ROI annotations

Dear all,
With the latest daily build versions of ImageJ1 (Help > Update ImageJ > daily build), you will have now a new ROI Menu (if not visible click the >>).

In particular this Menu comes with functions related to the new ROI group attribute.
This group attribute allows to annotate ROI for different categories of objects.

See the pdf attached for a more detailed description of the functionalities.
Those functionalities are now part of ImageJ1 core via the Roi.class and RoiManager.class meaning they are also available for Fiji and any scripting language including the macro language (code-completion still to come).

RoiGroup.pdf (660.6 KB)

Thanks @Wayne for the final implementation and @mountain_man for the initial support !


Hi @LThomas (and @Wayne and @mountain_man)

Thanks for this improvement!

I have some questions:
What actually happens when using Roi > Install keypad shortcuts?
What are the 12 installed macros?
How can they be used?

Is there a way to change the group of a Roi selected in the RoiManager by using the numerical keypad instead of opening the properties dialog?
(Currently the nemrical keypad seems only be used for changing the default group, correct?)


Hi @phaub,

Correct, if you have clicked Install keypad shortcuts.
If you restart Fiji, the shortcuts are not activated by default, I think it was to prevent overwriting existing shortcuts.

There is 1 small macro code by keyboard shortcut. 0 to 9 makes the 10 shortcuts associated to the numerical keypad digits. The 2 others I dont know to be honest. :sweat_smile:

There is no default shortcut for that, you can use the Menu entry Set group of selected ROIs.
Or you could define a custom personal shortcut by adding a small macro code as below.

// This macro executed on pressing 1, update the group of the currently selected ROI
macro "SetGroup1 [n1]" {
     print("The user pressed '1' on the numerical keypad");

Again you would have to write a set of such small macros in a given file for each group/shortcut.
You can then install the shortcut by doing

If you want to have it installed automatically you can past those macros to the end of

1 Like

This is the macro set installed in the Plugins>Macros menu by the Toolbar’s ROI>Install Keyboard Shortcuts command:

  macro "Group 0 (none) [n0]" { npad(0); }
  macro "Group 1 [n1]" { npad(1); }
  macro "Group 2 [n2]" { npad(2); }
  macro "Group 3 [n3]" { npad(3); }
  macro "Group 4 [n4]" { npad(4); }
  macro "Group 5 [n5]" { npad(5); }
  macro "Group 6 [n6]" { npad(6); }
  macro "Group 7 [n7]" { npad(7); }
  macro "Group 8 [n8]" { npad(8); }
  macro "Group 9 [n9]" { npad(9); }

 function npad(digit) {

Run the ROI Menu command in the Toolbar’s “>>” menu to add the ROI Menu Tool to the Toolbar. Add


to the Edit>Options>Startup dialog to have the shortcuts automatically installed when ImageJ launches.

1 Like