# 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

1 Like

Hi,

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.

Thanks!

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

1 Like

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:

run("8-bit");
setThreshold(0, 1);
setTool("freehand");
run("Analyze Particles...", "size=16-32 clear summarize");
2 Likes

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:

2 Likes

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 Options Resetâ€¦ and then restart ImageJ, and try running the macro again.