How to select the last item in the ROI manager in macro language?

I need to select the last item in the ROI manager.

Hello Zeynab -

Most collections (tables, arrays, lists, etc.) expose a “length”
or “sizeOf” or “numberOfElements” property.

The ImageJ Macro Language documentation would likely
show whether the ROI manager supports such a feature.

Thanks, mm

1 Like

Hi
@Zeynab_Mousavi
Test this:
a= roiManager( “count” );
roiManager( “select”, a );

1 Like

@Mathew: I got this error:
1

a=roiManager(“count”)-1;
roiManager(“Select”, a);

Unfortunately I got the same error.

open an image
and

//setTool("point");
makePoint(65, 63, "extra large yellow circle");
roiManager("Add");
makePoint(166, 50, "extra large yellow circle");
roiManager("Add");
makePoint(151, 168, "extra large yellow circle");
roiManager("Add");
makePoint(218, 211, "extra large yellow circle");
roiManager("Add");
a=roiManager("count");
print(a);
roiManager("select",a-1);
roiManager("Set Color", "red");
roiManager("Set Line Width", 0);
roiManager("Show All");
1 Like

Thanks Mathew. This command worked:

a=roiManager("count");
roiManager("select",a-1);