Count CD3+ cells from IHC slide images

I am trying to count CD3+ cells from immunohistochemistry slide images. RobustBackground method works far better than Otsu in most cases, as evident in the picture below (green: IdentifyPrimaryObject, red: after filtering).

but I found that RobustBackground doesn’t work when there are lymphoid aggregates!

is it possible to selectively apply Otsu to images that RobustBackground failed? or any kind of tricks would be greatly appreciated.

Unfortunately there isn’t really a way to set a ‘logic gate’ so that images that look like X are analyzed one way, and images that look like Y are analyzed another way (other than just skipping one class or the other entirely with the ‘FlagImage’ module).

My guess is that the threshold the ‘RobustBackground’ is picking is much, much higher in the cases where there are aggregates (since it’s trying to find a threshold that selects only the top few % of the pixels)- you can validate this yourself by looking at the Image_Threshold_FinalThreshold_(something) values of your Image spreadsheet/database for a normal image vs one with aggregates.

You can look at the threshold values it chooses on normal images, take roughly the maximum of those values, and use that as an upper bound on the threshold in your Identify module- that should allow you to use your same pipeline on both aggregated and non-aggregated images.

Good luck!

Dear Nowhere27. I am new to cell profiler. I also want to count CD3 cell from IHC slide images and still struggling with how to construct a pipeline. Can you by any chance help me with a guide? I am really stuck.