ImageJ/Fiji ROI returns none for XOR of the same ROI

Consider the following minimal working example, mwe.ijm:

run("Blobs (25K)");
makeRectangle(50, 50, 150, 150);

roiManager("Add");
roiManager("Save", "mwe.roi");

roiManager("Deselect");
roiManager("Delete");

roiManager("Open", "mwe.roi");
roiManager("Open", "mwe.roi");

roiManager("XOR");

When I execute it, my expectation was to have the rectangle given by (50, 50, 150, 150) but ImageJ/Fiji returns no ROI.

Is this a bug in the XOR operation? Or did I misunderstand the XOR operator? Thanks for your help!

$ ImageJ --headless --console -eval "print(getVersion());" | tail -n 1
2.1.0/1.53h

XOR will select pixels that are in either one of the selections, but not in both. So XOR on two copies of the same selection will give you an empty selection.

OR would give you what you expect in this case.

3 Likes