Login  Register

Re: Overlay on image stack

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jun 17, 2016; 3:04am
URL: http://imagej.273.s1.nabble.com/Overlay-on-image-stack-tp5016634p5016678.html

> On Jun 13, 2016, at 8:29 AM, Aleksandr Mironov <[hidden email]> wrote:
>
> Dear All,
>
> Is it possible to use different or alternating non-destructive overlays on different slices of a stack? Or for each slice the overlay should be flattened? For example, I want to put an overlay of parallel lines so that for each slice of a stack line orientation will alternate between two directions.

You can do this. The following macro provides an example.

-wayne

  // Create a 4 slice stack
  newImage("Overlay", "8-bit black", 500, 500, 4);
  // Use Image>Overlay>Overlay Options to
  // specify the line color and width
  run("Overlay Options...", "stroke=red width=5 set”);
  // Add a line to the overlay in each of the 4 slices
  makeLine(117, 98, 385, 379);
  run("Add Selection...");
  run("Next Slice [>]");
  makeLine(368, 100, 117, 405);
  run("Add Selection...");
  run("Next Slice [>]");
  makeLine(93, 82, 365, 367);
  run("Add Selection...");
  run("Next Slice [>]");
  makeLine(365, 77, 133, 372);
  run("Add Selection...");
  run("Select None”);
  // Use Image>Overlay>List Elements to summarize
  // the overlay. Note how the stack position of each
  // line is shown in the “Pos” (position) column.
  run("List Elements”);
  // Use Image>Overlay>Flatten to flatten the stack
  run("Duplicate...", "title=Flattened duplicate");
  run("Flatten", "stack");


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