Overlays on multi-frame hyperstacks

Hello everyone,

I have encountered a bit of an odd scenario when using overlays on a multi-time-frame image. It seems that the behaviour of the overlay depends on the number of z-slices in the image. I am working with a multi-channel, multi-slice, multi-frame hyperstack (4, 3, 15 to be precise):

  1. On the first slice (channel 1, slice 1, frame 1) I create a ROI.
  2. I add the ROI to the ROI manager.
  3. Select the ROI in the manager.
  4. Add an overlay to the image by ‘Add Selection…’
  5. Mouse click on the image outside the ROI to remove the ROI.

Now I observe that the overlay is visible on every time frame of the hyperstack on channel 1 and slice 1. Choosing a different channel or slice will not show the overlay.

If I try the same scenario on a hyperstack with just 1 z-slice, even on a 1-slice duplicate of the image I used before, the overlay is only visible on the first time frame.
Using just 1 channel instead of 1 z-slice will keep the overlay on every time frame.

What is even more surprising is that the ‘Set stack positions’ option on the Overlay Options is active (as per default it seems).
Switching off this option and running the same scenario on a multi-slice image will actually only show me the overlay on the first time frame and not on any other slice or channel.
From what I understand, the ‘Set stack positions’ should only show the overlay in the current position in the stack and nowhere else, while switching it off should show it everywhere. Or am I mistaken?

In a simple macro with an example rectangle ROI:

makeRectangle(262, 336, 482, 390);
roiManager(“Select”, 0);
run(“Add Selection…”);

Does anyone know if this is intended behaviour (and why so)?

Thanks and regards,

1 Like

Hi @mverp,

I can confirm this occurs with me too (ImageJ 1.51n). The multi-point tool does it correctly, e.g. only shows a point ROI where you place it in slice/frame, including when adding to overlay using ‘Add Selection…’. So, I imagine it is unintended.

@Wayne, are you the right person to ask about this?


It appears that the default is to display the ROI on all frames, using an ROI position of (1,1,0). You can override this by explicitly setting the position to (1,1,1), for example

  newImage("HyperStack","8-bit color-mode label",300,200,4,3,15);
  run("Add Selection...");
  run("Select None");