ApplyThreshold module




In the ApplyThreshold module, instead of manually typing in a threshold value, I would like to use a Measure module to generate that value for me and set it appropriately. But, I am unsure how to do that. Any help will be greatly appreciated. Thanks.



Hi Greg,

The ApplyThreshold can only take a user-provided value, so unfortunately, computation of that value can’t be out-sourced to another module. However, is there any reason you can’t use IdentifyPrimAutomatic for your purposes?



Sorry, I guess I was a little vague on why I am doing this.

I am analyzing a movie frame by frame in CP. But, the lighting / background changes over time. So, I created a mask where the only object is background pixels. I then found the mean intensity value of that area (in each frame) using MeasureObjectIntensity. Now, I would like to use the ApplyThreshold module, setting the threshold value to the measured intensity, to shift all of the pixels in that individual frame down and accomplish a frame-by-frame background subtraction.

Do you think it would be possible / straightforward for me to add that as a feature in the code for the ApplyThreshold module? If so, how would I go about it and which modules or subfunctions would I need to adjust?



In this case, have you considered using CorrectIllumination_Calculate/Appy?

Depending on the nature of the background that you want to remove, you can use CorrectIllumination_Calculate with the Background method, with no rescaling, in Each mode (i.e., applied to each image individually) to create an illumination function representative of the background lighting distribution. Then, in the CorrectIllumination_Apply module, this illumination function can be applied to the image using the subtraction to yield the corrected image.

The _Calculate module can be somewhat tricky to navigate so let us know if you need further help in using it.