Posted by
Xuan Yang on
Jul 31, 2005; 4:04am
URL: http://imagej.273.s1.nabble.com/Help-use-of-makeOval-tp3705113p3705114.html
It seems that shifting of the center is not because of the way to draw the
circle... I used the center-based method, still got the shifting (one pixel)
sometimes...
-----Original Message-----
From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of Xuan
Yang
Sent: Wednesday, July 27, 2005 7:55 PM
To:
[hidden email]
Subject: Help: use of makeOval
Hi all,
I tried to use makeOval to draw a set of circles (the macro is shown below).
But because it's not center-based, it gave me some trouble when I used the
circles later (the center is shifted a little bit.). Can anyone please tell
me how to draw the circles based on the center and size? I also tried to use
the recorded line:
"run("Specify...", "width=250 height=250 x=125 y=125 oval centered");" but I
don't know how to transfer a variable to this line. Thanks for any
suggestions in advance.
open(); //open a text file which contains the names of the images to be
saved in.
contents = getInfo();
run("Close");
list = split(contents, "\n");
xx=50;
yy=50;
for (k=1;k<26;k++) {
newImage("Untitled", "8-bit White", 500, 500, 1);
dotSize = sqrt(25*25-(k-1)*(k-1)); //Calculate the radius of the
circles on
this image.
for (i=1; i<11; i++) {
for (j=1;j<11;j++) {
x = xx/2+(i-1)*xx-dotSize; //Calculate the left
boundary of the
circle
y = yy/2+(j-1)*yy-dotSize; //Calculate the top
boundary of the circle
makeOval(x, y, dotSize*2, dotSize*2); //Draw a
circle based on the size
and the boundary points.
run("Fill");
}
}
run("Select None");
run("Invert");
saveAs("Tiff", list[k]);
close();
}
----------------------------------------------
Xuan Yang
Graduate Research Assistant
School of Civil and Environmental Engineering
Georgia Institute of Technology
Atlanta, GA 30332-0355
Phone: (404) 385-0058
Fax: (404) 894-2281