Posted by
George Patterson on
Feb 23, 2017; 8:27pm
URL: http://imagej.273.s1.nabble.com/user-prompt-to-draw-oval-tp5018181p5018183.html
Hi Peter,
The List.getValue("X") and List.getValue("Y") are returning the centroid
whereas the makeOval uses the upper left of the bounding rectangle for
positioning.
You can fix it by using List.getValue("BX") and List.getValue("BY") or use
something like getSelectionBounds(x,y,w,h) to get the position of the oval.
George
On Thu, Feb 23, 2017 at 3:06 PM, Peter Oslanec <
[hidden email]> wrote:
> Hi all,
>
> I am trying to creeate little script to prompt user to draw oval in a
> picture.
>
> setTool("oval");
> waitForUser("....");
>
> if (selectionType==-1)
> exit("Area selection required");
> List.setMeasurements;
> //print(List.getList); // list all measurements
> x = List.getValue("X");
> y = List.getValue("Y");
> width = List.getValue("Major");
> heigth = List.getValue("Minor");
> makeOval(x,y,width,heigth);
>
> The macro works, but the drawn oval moves its center slightly to the right
> bottom corner of the picture.
>
> Thank you!
>
> --
> Peter Oslanec
> Institute of materials and machine mechanics
> Slovak Academy of Sciences
> Racianska 75
> 831 02 Bratislava
> Slovakia
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html