Counting Points Using a Grid

I am using a grid placed on a kidney to count what parts of the kidney the grid points intersect. Is there a way I could drag a box around multiple grid points and have them counted that way?

1 Like

On YouTube you will find several tutorials which will help you:

1 Like


This sounds like something I’m interested in too. Could you please post an image to illustrate what you mean? Including the image, the grid, and the multiple things you want to count?

If you can’t post an image here on the forum, you can link to one on imgur.


I have updated the original post it may be easier to understand now

1 Like

Thanks – very helpful!
If I understand correctly, these are subregions of the tissue that you can’t distinguish in an automated fashion. To quantify the amounts using unbiased stereology methods, you have to count the intersections of each of these subregions with regularly spaced grid points (black crosshairs in the image). Sometimes you have a block of 25 contiguous grid points that intersect the same structure, and it’s inefficient and annoying to click 25 times. Encircling blocks of points by drawing an ROI is a common feature in commercial stereology software.

Unfortunately, I don’t have an answer at the moment – except to make sure you’re using the minimum grid density to get a precise result.

I can envision a macro or script to do the job. If you can recover the coordinates of the grid points (using the code that generates the grid) you can draw an ROI and determine how many points are within that ROI. Ideally you could add those totals to the Multi-Point Tool counts so that single and group counts could be done at the same time.

I’d love to hear if anyone else has tackled this problem.

1 Like

Yes that is precisely what i am trying to do.

The following macro illustrates how to count the black crosses within a user-drawn ROI:

setThreshold(0, 1);
waitForUser("Please draw an ROI");
run("Analyze Particles...", "size=16-32 clear summarize");

I have copied that macro. It gets to the ROI and brings up a table but it doesn’t count yet. Ty for the help tho already alot closer than I was before.

So its the ROI I am having problems with. I was under the assumption drawing freehand countted as an ROI

Freehand selections are ROIs, indeed.

Well since freehand selections are ROI’s then its all working except it isn’t counting.

What do you see in the Summary table? When I run the macro from my post above, draw an ROI, and click OK, I get the following table containing a Count column with the desired result:


A post was split to a new topic: Counting and measuring nerve fibers

I get the same table but its 3 rows and everything is either NA or 0 except for slice which is 1,2 and 3.

Sorry, I cannot reproduce this behavior. I seems like you’re processing a stack of three slices, maybe your RGB Color image gets converted to an RGB Stack? Do you get this when using the exact macro code from my post above?

Also, what version of ImageJ are you using? And on what Java version are you running?

1 Like

@oddsock3 One possibility is that something in your ImageJ settings is affecting the computation. You could try Edit :arrow_forward: Options :arrow_forward: Reset… and then restart ImageJ, and try running the macro again.

See also: