Login  Register

Re: user prompt to draw oval

Posted by Peter Oslanec-2 on Feb 24, 2017; 6:49am
URL: http://imagej.273.s1.nabble.com/user-prompt-to-draw-oval-tp5018181p5018184.html

Thank you guys for answers!

Have a nice day.

Peter

2017-02-23 21:27 GMT+01:00 George Patterson <[hidden email]>:

> 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
>



--
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