Creating connected lines in a non-annotative fashion

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating connected lines in a non-annotative fashion

Peter Cao
I have previously used employed this macro to create a border around the
area of interest for analysis.  However, I now require this border to be
burnt into the image, rather than merely implemented in the annotation
layer.  Can somebody please provide me with the amended code which
implements these lines but in a non-annotative, destructive fashion?  Many
thanks.

run("Colors...", "selection=green");
> makeLine(104, 104, 920, 104, 920,1024);
> run("Add Selection...");
>
> run("Colors...", "selection=red");
> makeLine(104, 0, 104, 920, 920, 920, 920, 1024);
> run("Add Selection...");

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Creating connected lines in a non-annotative fashion

Rasband, Wayne (NIH/NIMH) [E]
On Sep 20, 2015, at 11:38 AM, Peter Cao <[hidden email]> wrote:
>
> I have previously used employed this macro to create a border around the
> area of interest for analysis.  However, I now require this border to be
> burnt into the image, rather than merely implemented in the annotation
> layer.  Can somebody please provide me with the amended code which
> implements these lines but in a non-annotative, destructive fashion?  Many
> thanks.

Use the Image>Overlay>Flatten command to burn an overlay into an image. The following example creates a 1024x1024 8-bit image, adds 3 pixel wide green and red lines to an overlay and then uses the “Flatten” command to burn the overlay into an RGB version of the image.

-wayne

   newImage("Untitled", "8-bit black", 1024, 1024, 1);
   makeLine(104, 104, 920, 104, 920,1024);
   Overlay.addSelection("green", 3)
   makeLine(104, 0, 104, 920, 920, 920, 920, 1024);
   Overlay.addSelection("red", 3);
   run("Select None");
   run("Flatten");
 

> run("Colors...", "selection=green");
>> makeLine(104, 104, 920, 104, 920,1024);
>> run("Add Selection...");
>>
>> run("Colors...", "selection=red");
>> makeLine(104, 0, 104, 920, 920, 920, 920, 1024);
>> run("Add Selection...");

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