Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Sep 20, 2015; 5:55pm
URL: http://imagej.273.s1.nabble.com/Creating-connected-lines-in-a-non-annotative-fashion-tp5014380p5014382.html
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