Help: use of makeOval

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Help: use of makeOval

Xuan Yang
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
Reply | Threaded
Open this post in threaded view
|

Re: Help: use of makeOval

Xuan Yang
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
Reply | Threaded
Open this post in threaded view
|

Re: Help: use of makeOval

Gabriel Landini
On Sunday 31 July 2005 04:04, Xuan Yang wrote:
> 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...

Isn't this because the polygons are drawn from the top left corner of a pixel?

Cheers,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Help: use of makeOval

Xuan Yang
Thanks for your reply. Yes, you are right. Finally I got what I want by
converting those double values of diameters to integers.

Xuan

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

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]]On Behalf Of Gabriel
Landini
Sent: Sunday, July 31, 2005 7:02 AM
To: [hidden email]
Subject: Re: Help: use of makeOval

On Sunday 31 July 2005 04:04, Xuan Yang wrote:
> 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...

Isn't this because the polygons are drawn from the top left corner of a
pixel?

Cheers,

Gabriel
Reply | Threaded
Open this post in threaded view
|

histograms of slices

Alex Mock
In reply to this post by Gabriel Landini
hi there,
i was wondering if there is a plugin or macro somewhere that saves the
histogram data of each individual slice of a stack into a file. I am
using imageJ under windows.

thanks very much for your help.

alex

____________________________

Alexander Mock
Department of Earth Sciences
Durham University
South Road
Durham
DH1 3LE
Reply | Threaded
Open this post in threaded view
|

Re: histograms of slices

Wayne Rasband
> i was wondering if there is a plugin or macro somewhere
> that saves the  histogram data of each individual slice of a
> stack into a file. I am  using imageJ under windows.

The StackHistogramLister macro at

    http://rsb.info.nih.gov/ij/macros/StackHistogramLister.txt

does this. I found this macro by searching the directory at

    http://rsb.info.nih.gov/ij/macros/

-wayne