ImageJ/Fiji XOR selection with overlays

I’m using ImageJ/Fiji.

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

Given two region of interest, I know how to select the XOR between the region of interest. In ROI Manager window, I will find the option XOR in the More menu.

I’m searching of how can I do the same if I’m using overlays. The overlay menu does not list the XOR operation.

I do not want to move selections between overlays and ROI. Any suggestion on how to perform the XOR operation? Thanks!

The ImageJ 1.53h20 daily build adds an Overlay.xor(indexes) macro function that creates a new ROI by XORing all the ROIs in the overlay with indexes in the array ‘indexes’. Here is an example:

  run("Blobs (25K)");
  makeOval(44, 31, 112, 106);
  Overlay.addSelection;
  makeOval(86, 74, 112, 106);
  Overlay.addSelection;
  Overlay.xor(newArray(0,1));
  fill;

Screenshot

2 Likes

@Wayne, Thanks for the reply. I’m curious to see the macro source code. Can you message me the commit ID that has the macro source code for Overlay.xor()?

The commit can be found at Commits · imagej/imagej1 · GitHub.