Problem with applying a color threshold to measure color intensity

Hi everyone,
My goal is to measure the intensity of a blue staining in tissue. First I use the plugin “HIC toolbox” that selects the blue-coloured pixels I want to keep, and sets all the other pixels at an intensity value of 255. So I get an image of my tissue with a range of blue pixels and white ones (255). But I want to measure the intensity of the blue pixels only, so I make a “Color threshold” and I threshold each color (RGB) between 254 and 255 to threshold the white color on my picture. Then I run “Analyse=>Mesure” (with the “Limit to threshold” checked) but the resulting table still gives me a maximum intensity of 255, meaning that the threshold didn’t apply I guess…? I didn’t manage to find how to correct that. I was wondering if the Color threshold is saved automatically when I set it up (I assumed that cause there is no Set button as for the greyscale threshold), or do I have to click on “Image->Threshold->Apply Threshold” before running the analysis (when I do that an error message appears…) ?
If anyone knows what I do wrong, or has suggestions or answers to quantify only the blue staining intensity on my blue/white image that would help me a lot thank you!!

Dear @Alizee_B,

If I have understood the documentation of the IHC toolbox correctly, the blue pixels will keep their original intensities. With the thresholding you are describing, you are selecting the pixels for which the intensity has been set to 255 only. Shouldn’t you rather select a threshold of 254 to select values between 0 and 254, because those pixels are the ones from intensities are extracted subsequently?

Best,
Stefan

Dear Stefan,

Thanks for your answer. Actually, when you are doing a threshold, only the pixels that have an intensity value OUT of this threshold are conserved if the “Pass” square is checked, or only the pixels that have an intensity value INSIDE the threshold are conserved if the square “Pass” is unchecked. In my case, I checked “Pass” but indeed you can also select 0 to 254 if you uncheck the “Pass” to eliminate white. Anyway, if I had selected only the white pixels as you said, my thresholded image would have appeared totally white and the intensity would have been 255 for all (min, mean and max), which is not the case for me. Actually I get the same results wether I try to eliminate the white or not, so I think that the color threshold simply does not apply but cant find what I am missing

Thanks again,
Alizee

The Limit to threshold option only works on thresholds set by Image > Adjust > Threshold…, i.e. only on grayscale images. The Color Threshold is displayed in a similar way, but doesn’t set the threshold value (which is just a single intensity value, not aware of RGB channels), as you can verify by this little macro after setting the color threshold:

getThreshold(lower, upper)
print("Lower: " + lower + ", Upper: " + upper)

Depending on what you’d like to achieve, you can instead do one of the following:

  • Use the Select button to create a selection, then Edit > Selection > Create Mask, and run your measurements with the Redirect to option set to point to your original image.

  • Convert your RGB image to a composite 3-channel image (Image > Color > Make Composite) and use the regular threshold on each channel.

Hope that helps, don’t hesitate to ask further if you’re stuck.

1 Like