Login  Register

Re: Overlay question

Posted by Wayne Rasband-2 on Nov 16, 2018; 4:09am
URL: http://imagej.273.s1.nabble.com/Overlay-question-tp5021465p5021466.html

> On Nov 15, 2018, at 10:35 PM, Cammer, Michael <[hidden email]> wrote:
>
> Perhaps I missed this in the recent discussions of overlays, but I have a question I hope someone can help with.
>
> When I put text overlay on a slice in a stack but typig the text and adding the overlay from the menu, the overlay is only displayed on one slice.
>
> However, in a macro when I use a command such as
>
>    Overlay.drawString(outputstrings[i-1], 260, 290);
>
> the overlay is displayed on the entire stack, not just the one slice.

Use Overlay.setPosition(slice) to specify which slice the text is displayed on. Here is an example:

  newImage("Untitled", "8-bit noise", 500, 500, 5);
  setFont("SansSerif", 40, " antialiased");
  setColor("cyan");
  Overlay.drawString("This text only appears\non the third slice.", 20, 200);
  Overlay.setPosition(3)
  Overlay.show();
  setSlice(3);

Use Overlay.setPosition(0) to have the text displayed on the entire stack.

> Also, based on the recorder, I tried
>
>    Overlay.drawString(outputstrings[i-1], 260, 290, 0.0);
>
> but this is the same.

The fourth argument is the angle.

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html