Posted by
Bo de Lange on
May 03, 2006; 1:58pm
URL: http://imagej.273.s1.nabble.com/numeric-polygon-selection-tool-tp3702909p3702910.html
Günter Bachelier wrote:
> Hello,
>
> how can I select polygons in pixel
> x,y-coordinates numerically like
>
> P1: 20, 30
> P2: 221, 30
> P3: 121, 204
>
> I want to select geometrical exact polygons
> like an equilateral triangle in batch jobs.
>
>
> thank you for your help
> Günter
>
Use the macro recorder to obtain syntax.
Open an image.
Run the Macro Recorder (Plugins:Macro:Record),
select the polygon tool, make one and
see the correct macro language required:
setTool(2);
makePolygon(26,61,36,122,103,144,186,156,218,124,230,75,196,57,119,43,63,46);
The first line sets the polygon tool (when not already selected),
the second line describes each point sequentially: x,y,x,y,x,y etc.
Run this macro to see how it works:
run("Blobs (25K)");
setTool(2);
makePolygon(1,1,256,1,128,254,1,1);
There is in fact no need to for the last x,y to be the same as the
first. If you leave out the last ,1,1 you'll get the same polygon: it
closes automatically
Bo