How would I create a table of measurement results?


I’m trying to make a macro that selects a 10x10 grid of pixels and measures the intensity at each grid, then applies it to each image in a stack of 20 images. I have it so that it runs through the stack, but the measurements come out as a single column whereas I want it in a 20x100 table, i.e. each image in the stack is in its own column. From there I can copy it into excel and find the standard deviation of each pixel. I’ve heard using setResults might be able to do this, but haven’t been able to figure it out. Any help would be appreciated! My code right now is:

macro "ROI Grid measurement stack"

	//define number of slices in stack

	for (n=1; n<nSlices+1; n++) 
		x = 70;
		y = 70;
		width = 1;
		height = 1;
		spacing = 35;
		numRow = 10;
		numCol = 10;

		for(i = 0; i < numRow; i++)
			for(j = 0; j < numCol; j++)
				xOffset = j * (width + spacing);
				yOffset = i * (height + spacing);
				makeRectangle(x + xOffset, y + yOffset, width, height);		
		roiManager("Show All");

I’m not sure if I can attach a stack here, but if sample data is needed please let me know.

Thank you in advance!