Choosing an appropriate thresholding algorithm


I am trying to perform a threshold operation on images with varying intensities. I’ve included three example histograms from these images, and in each case I want the threshold to be at the indicated point, which is always on the down slope of the peak in intensities. This peak represents the intensity of a specific area of all the images, is it possible to set the threshold based on the intensity of a part of the image? Alternatively, is it possible to scale the intensity of the entire image? I’m very comfortable in matlab, and not so much in python, would it be required to write a custom module, or is there a combination of built in functionality which will work for me?



I assume that the automatic thresholding methods are not working for you? You can always adjust the threshold correction factor to adjust the automatic threshold upwards or downwards if it is consistently off the mark in a particular direction.

Alternately, you can use MeasureImageIntensity to collect a suite of intensity statistics from each image: mean, std, median, etc. If you can relate the observation that you describe in your screenshots to one of these statistics, then you can use it IdentifyPrimaryObjects by selecting ‘Measurement’ as the thresholding method and select the measurement that you want. If the measurement requires some prior arithmetic operations to reflect the value you want, then use CalculateMath on the measurement or RescaleIntensity on the original image prior to measurement to adjust the values accordingly prior to IdentifyPrimaryObjects.