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 |
Good day Peter,
I've no idea what the macro is intended to perform. If you should like to permanently draw the elliptical selection (in white) you could use: // setForegroundColor(255, 255, 255); // white run("Draw", "slice"); run("Select None"); // You may use the Recorder feature to construct basic macros. Best Herbie ::::::::::::::::::::::::::::::::::::::::::: Am 23.02.17 um 21:06 schrieb Peter Oslanec: > 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); -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Peter Oslanec-2
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 |
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 |
Free forum by Nabble | Edit this page |