How to devide one image into different pixel areas, and then calculate and display the mean value of each area

Hi, all.

I am dealing with a serias of images stacked to be 61. The total size is 550555 pixles. Now, I want to measure the values of image in the unit of 55 pixels. I am sorry that I am not a coder. Then, I tried to manually measure some areas, like makerectangle (110, 25, 5,5) then run (measure).

However, I have to measure 110111 points, it was too much. I want to make a macro to automatically devide the image into 55 pixels, and then measure all the values.
Is there anyone could help?

Here is the image, and the manually picking up measurements.

In addition, I noticed @anon96376101 has posted a macro in How to save my counter results on my image?, it might be similar, but I could not run it in my PC.

3q in advance.
Amy

Hi,
I want to be sure I have understood what you want to do.
You want to “scan” your image with rectangles of a surface of 5*5 pixel ? And then apply your measurement to the automatically generated rectangle ? And save automatically the results.

If so, Please find below, a macro that should work for you:

Image_Name = getTitle();
getDimensions(image_width, image_height, image_channels, image_slices, image_frames);

dir = getDirectory("Choose directory");
size=5;

for (width=0;width<=image_width-size;width+=size){           //scanning in width
	for (height=0;height<=image_height-size;height+=size){  //scanning in height
		makeRectangle(width, height, size, size);
		selectWindow(Image_Name);
run("Measure");
	}
}
selectWindow("Results");
saveAs("text",dir+"results"+Image_Name+".csv");

I fear this is more or less a double post: See http://forum.image.sc/t/how-could-i-get-mean-grayvalues-of-each-grid/10589?u=herbie

The original poster considered the suggestion given in this thread as helpful: See http://forum.image.sc/t/how-could-i-get-mean-grayvalues-of-each-grid/10589/9?u=herbie

Regards

Herbie

Thank you @antonin.

This problem has been solved, but your offer is another choice. It is good for me to learn the macro code.
Thank you again.

Best

Amy

Thank you @anon96376101.

This is the same question. But I posted at different times. At that time, I did not know how to solve this.
But this macro is also very helpful. And it is helpful for me to learn macro code.

Thank you again.
Best.

Amy