Differents ROIs if Show all is enabled or not

roi-manager
imagej
macro

#1

Hi,

I noticed that if you run the following with Show all ROIs enabled I have different results than if it is not enabled. If it is not enabled the las two ROis are the same otherwise they are different (as they should).

run("Blobs (25K)");
run("ROI Manager...");
roiManager("reset")

makeOval(116, 24, 37, 28);
roiManager("Add");
makeOval(35, 74, 27, 32);
roiManager("Add");
makeOval(91, 87, 48, 22);
roiManager("Add");
makeOval(184, 79, 40, 25);
roiManager("Add");

roiManager("Deselect");
 roiManager("combine");
  roiManager("add");
 roiManager("Add");

 
 r1= roiManager("count");
 roiManager("select", r1-1);
 run("Make Inverse");

Is this a bug ?

Thanks


#2

I was able to reproduce the issue in an up-to-date Fiji installation.

Here’s a minimal version of your code that reproduces the issue:

//run("Blobs (25K)");
//run("ROI Manager...");
roiManager("reset")

makeOval(116, 24, 37, 28);
roiManager("Add");
makeOval(35, 74, 27, 32);
roiManager("Add");

roiManager("Deselect");
roiManager("combine");
roiManager("Add");
roiManager("Add");
 
r1= roiManager("count");
roiManager("select", r1-1);
run("Make Inverse");

When running this code with Show all disabled, the active ROI is indeed inverted, but the last entry in the ROI manager doesn’t reflect that. This can be this line to the end of the macro updates the stored ROI:

roiManager("Update");

Interestingly, when Show all is enabled, this last call is not necessary, and the entry in the ROI manager reflects the change (i.e. inverted combined ROI) nevertheless.

@Wayne is a ROI update automatically triggered when Show all is active?


#3

The ROI’s are displayed as an overlay in “Show All” mode and overlays do not require the equivalent of roiManager(“update”). You can work around this difference by adding roiManager(“update”) to your macro.


#4

When “Show All” is active the ROIs are displayed as an overlay, and overlays do not require updates.