Try this simple macro:
/****************************
requires("1.37");
run("Set Measurements...", "area perimeter fit redirect=None
decimal=2");
A=100; //Size of local area
w = getWidth();
h = getHeight();
setForegroundColor(0, 0, 0);
for (j=1;j<=nSlices;j++){
setSlice(j);
for (ii=0;ii<h/A;ii++){
for (i=0;i<w/A;i++){
run("Clear Results");
x=i*A;
y=ii*A;
makeRectangle(x, y, A, A);
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Nothing exclude");
//run("Draw");
print("Slice "+j+"Count: "+nResults);
}
}
}
/****************************
Change the value of A to adjust the grid size. Remove the comment
from the run("Draw"); to draw the corresponding grid. Particles
touching edges are ignored. The macro works also with stacks. Macros
perform slow, a plugin will be more efficient.
Gary.
http://www.gcsca.netOn May 30, 2007, at 5:34 PM, Annapragada, Sriram K. wrote:
> In reference to my previous post (below). Here is a link to the image;
>
>
http://img504.imageshack.us/my.php?image=gridyf5.jpg>
> I need to count the particles in each grid; 'Analyze particles'
> counts all the particles in the image but not in each grid. This
> should be pretty simple but was unable to figure it out. thanks for
> the help.
>
> Kiran.
>
> ________________________________
>
> From: ImageJ Interest Group on behalf of Annapragada, Sriram K.
> Sent: Wed 5/30/2007 1:18 AM
> To:
[hidden email]
> Subject: grid particle count
>
>
>
> Thank you for all suggestions/help so far. I have an image with
> particles randomly distributed. I grid the image to count the
> particles in each box.
>
> How do I do this? The 'analyze particles' counts all the particles
> in the image and not in each grid.
>
> thanks,
> Kiran.
>
>