Pixel grey scale value per ROI

Posted by AJBell on
URL: http://imagej.273.s1.nabble.com/Pixel-grey-scale-value-per-ROI-tp3691128.html

Dear All,

I am trying to find a way to list all pixel values for a given ROI. Having
searched the archive, I found a code that gives the pixel values for a
predetermined roi.

getSelectionBounds(xmin, ymin, selwidth, selheight);
run("Create Mask");
m=newArray(w*h);
for(x=0;x<w;x++){
       for(y=0;y<h;y++){
               m[y*w+x]=getPixel(x,y);
       }
}
close(); //close mask
for(x=xmin;(x<=xmin+selwidth);x++){
       for(y=ymin;(y<=ymin+selheight);y++){
               if (m[y*w+x]!=0) print (x,y,getPixel(x,y));
       }
}

What I have are images with up to 50 bacterial cells, and having
thresholded the image, I would like a list of the pixel values for each
ROI. I know in principle how to do this for a single ROI in turn, but with
approx 1200 cells that would take a long time. Is there a way to do this?
Or will I have to do it by hand as it were?

Regards,

Andrew