How to control antialiasing of flattened overlay selection objects

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

How to control antialiasing of flattened overlay selection objects

Stein Rørvik
I want to draw some relatively small sized text and arrows as an image overlay,
and at a later point flatten the image when the annotation is complete.

My question is how to control the antialiasing of the arrows?
In my case I want to not use antialiasing, as that does not look good for small objects.
I cannot figure out how to do this in a macro.

Text antialiasing can be turned on and off using options in setFont(name, fontsize, options);
so how can I do the same for drawn overlay objects (originating from selections)?
Antialiasing seems to be default on for all overlay objects (which is normally what is desired).
The same behaviour applies to ellipses, rectangles etc.

See the below example.
What I want to achieve is to have the flattened arrow not be antialiased.

An macro controllable "antialiasing" checkbox under Overlay Options would be an ideal solution, with default on.

run("Close All");
newImage("temp", "RGB black", 70, 70, 1);
color = "yellow";
fontsize = 12;
xPos = 20;
yPos1 = 20;
yPos2 = 40;
length = 20;
width = 2;
style = "notched small";
setColor(color);
setJustification("left");

options = "bold";
//options = "antialiased,bold";
setFont("SanSerif", fontsize, options);
makeArrow(xPos, yPos1, xPos+length, yPos1, style);
Overlay.addSelection(color,width);
Overlay.drawString("test", xPos, yPos2);
run("Flatten");
run("Set... ", "zoom=400 x=0 y=0");
run("Select None");


Stein

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

Re: How to control antialiasing of flattened overlay selection objects

Wayne Rasband-2
> On Jun 18, 2019, at 11:32 AM, Stein Rørvik <[hidden email]> wrote:
>
> I want to draw some relatively small sized text and arrows as an image overlay,
> and at a later point flatten the image when the annotation is complete.
>
> My question is how to control the antialiasing of the arrows?

The latest ImageJ daily build (1.52p60) adds the Roi.setAntiAlias(boolean) macro function that can be used to control the antialiasing of arrows. To not use antialiasing, add Roi.setAntiAlias(false) immediately after makeArrow(…).

-wayne

> In my case I want to not use antialiasing, as that does not look good for small objects.
> I cannot figure out how to do this in a macro.
>
> Text antialiasing can be turned on and off using options in setFont(name, fontsize, options);
> so how can I do the same for drawn overlay objects (originating from selections)?
> Antialiasing seems to be default on for all overlay objects (which is normally what is desired).
> The same behaviour applies to ellipses, rectangles etc.
>
> See the below example.
> What I want to achieve is to have the flattened arrow not be antialiased.
>
> An macro controllable "antialiasing" checkbox under Overlay Options would be an ideal solution, with default on.
>
> run("Close All");
> newImage("temp", "RGB black", 70, 70, 1);
> color = "yellow";
> fontsize = 12;
> xPos = 20;
> yPos1 = 20;
> yPos2 = 40;
> length = 20;
> width = 2;
> style = "notched small";
> setColor(color);
> setJustification("left");
>
> options = "bold";
> //options = "antialiased,bold";
> setFont("SanSerif", fontsize, options);
> makeArrow(xPos, yPos1, xPos+length, yPos1, style);
> Overlay.addSelection(color,width);
> Overlay.drawString("test", xPos, yPos2);
> run("Flatten");
> run("Set... ", "zoom=400 x=0 y=0");
> run("Select None");
>
>
> Stein

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