Detection of White Background

I am looking to see if anyone would know how to detect a white background in ImageJ – or some way of detecting all of the tissue. I am just looking to select all of the tissue at once (in a selection box), but I can’t figure out how to do it. Regular thresholding often isn’t satisfactory.

Here’s some sample images:

You might try classification with the Trainable Segmentation plugin:


This was actually one of my first ideas too. The only issue with the trainable Weka segmentation is I’d need to train on multiple images, and that seems to get incredibly slow, incredibly quickly (my computer starts getting hot enough to cook an egg on, and stays hot long enough to do so). If you have any other ideas, or any suggestions on how to make Weka not cause my laptop to combust, I’d appreciate it.

you could try to train on only a portion of each image by cropping it first or give Labkit from @maarzt a try. But I do not know how it deals with limited resources computation wise.

One additional thing to point out is that the lighting conditions in your example images are quite different. One has a pinkish background the other a rather yellowish one. This differences might make it also for any trainable segmentation more difficult, since the basic conditions and color distribution changes. In turn, you will need to include even more test examples to cover that variation. I would suggest to try to consider this in addition in following imaging experiments to achieve a more reliable segmentation.
I will lok still into other possibilities and report back, if I find a simpler solution.


It would also work out if there was just some way for me to locally threshold nuclei. Basically, I’d like to go through each nuclei, and check if they are positive for DAB signal (just get the mean and max brown signal in the nucleus, and then check if either of those are above two different values we use to determine ‘positive’ nuclei). The issue with this is that some of the cytoplasm signal bleeds over into the nuclei, so what I have done previously is color balance the image to the color of the cytoplasm before checking all of the nuclei for positivity.

Obviously, this isn’t ideal, since I have to manual select the cytoplasm for color balancing, and this doesn’t account for variance in cytoplasm staining between parts of the tissue. The only point in selecting the tissue which I have in this experiment is to just remove the human aspect from selecting the tissue for thresholding.

If there was some way to locally alter the threshold values based on the tissue color immediately around the nuclei, I think that would be best. The nuclei selections are actually pretty good – ImageJ can pretty easily grab them based on the haemotoxylin stain. In theory, I could expand this selection, and grab the DAB color around the nuclei, and use that to modify the thresholding. The problem with this is that for nuclei on the edge of the tissue, it would grab some of the non-tissue blank space, and incorrectly modify the thresholding. Can you think of any way I might be able to go about dealing with that particular issue?

If this is too outside the bounds of this topic, I’ll make a new one for this particular question.