How to ignore background pixel values when calculating mean intensity of 8-bit image?

Hello guys,

I’m new to image analysis and I am struggling to do some automated segmantation. I have RGB images of wheat leaves obtained from a scanner (white background), that were converted to 8-bit using the color deconvolution plugin (H DAB). I need to calculate the mean pixel intensity of the leaves only, from the DAB channel. The segmentation methods I’ve tryed ("Threshold…, “SIOX”, “Create selection”, etc) returns a binary image but I need the original values to calculate the mean.

Is there a way I could I could select the leaves as ROIs automatically instead of using a polygon selection tool? Perhaps by ignoring the pixels with value>250 when calculating the mean of the entire image, without the need to segmentate? Or by creating a mask that substracts the white background and then I can calculate the mean intensity of the remaining pixels?

Thanik you very much in advance!
scan_2021-05-25-12-17-57-Im4-1.tif (3.8 MB)

You can use the ROI manager as convenient storage container for ROIs, to transfer ROIs from one active image to another. Once you have a binary image, run Analyze → Particle Analyzer and let it add the “particles” (= leaf areas) to the ROI manager, by checking “Add to manager” in the dialog popping up, or by the following macro command:

run("Analyze Particles...", "add");

Then, select the image in which you want to measure. In the ROI manager, select the ROIs (one after the other) and run the measurement. The ROI manager is scriptable. One can automate the entire procedure.