Detecting spaces in tissue

Hi there,

I am fairly new to QuPath. So I apologise if there is a straightforward way to do this, but I am trying to find a way to detect and measure the area within my tissue section (H&E stained) that has spaces in it.

“Spaces” = essentially holes in the tissue that would be filled with background.

I have tried the following:

  • Magic wand (or simple tissue detection) to select the whole tissue section as a ROI
  • create tiles to split up the tissue section into more manageable bits for QuPath to compute
  • selecting one tile and using positive pixel count to set up QuPath to identify tissue surrounding the holes
  • selecting all the tiles and then running the positive pixel count operation applied to the whole tissue section

The idea being that I will then have the area of the entire tissue section and also the area of “positive” tissue and so the difference in the two will give me the combined “spaces” in the tissue.

This seems to work well in smaller bits of tissue, but when scaling up to larger bits of tissue the positive pixel count step takes some time but when it eventually reaches 100% complete it gets stuck there and doesn’t budge.

So two questions:

  1. Does this sound like the best way to do this?
  2. If not, then what else do you suggest? If so, is there anything helpful that can be done to speed up/allow the positive pixel count operation to complete?

I am using QuPath 0.2.0-m7

Thank you for your help,


Not 100% sure without a sample, but if you want to try something simple:

  1. Run Simple tissue detection preventing any holes from being generated, which might look something like this:
  2. Run it again, but this time allowing holes (Max fill area). Note that this will take more time. Potentially significantly.

    The difference between these two measurements would be approximately the area of the empty spaces, and works for small holes. It does not work for spaces between tissue slices, for large indentations (which would be part of the “outside” still).
    EDIT: Note that the Requested pixel size would be very important for the accuracy of this calculation. If I wanted greater accuracy, I would reduce that to the actual pixel size, and possibly turn off the Smoothing checkboxes. Doing this will also slow down the process significantly. Though that’s the price of accuracy, usually.

Alternatively, directly check the pixels. Positive pixel count is not recommended in the newer versions of QuPath due to the slowdown. A couple of other variants: