Hi all, this is a post based on my experiences with determining positivity within cell objects for certain cytoplasmic markers. Feedback and other opinions welcome!
First, the standard problem. QuPath gives you a Cell Expansion after you detect your nuclei, and this expands a second area around the nucleus up until it hits the Cell Expansion distance, or runs into another cell expansion. This means the cell’s shape is almost purely determined by the shape of the nucleus. And if you have looked at tissue samples, or most cell preps, you probably already realize that isn’t always a very accurate approximation.
Options built into the function: With a smaller cell expansion you will collect less information about the surrounding area, but the “cytoplasm” will then be more likely to include information about only that cell/nucleus. A larger cell expansion will collected more information from the surroundings, and can sometimes be useful looking at ISH staining in stroma, where the distance between nuclei can be quite large.
Impact on the calculations:
This is the standard 5um expansion, and the mean value for the yellow channel 2 staining within the cytoplasm is ~2.5.
With a smaller expansion, this value jumps up to 5.8, largely due to the “empty space” that was included in the 5um expansion.
However, when you have a variety of markers, they might not strongly stain within 1um of the nucleus, so constraining your cell expansion might not be an option! What to do? Well, one option is that the desired cytoplasmic expansion is often cell specific, and you could run multiple cell detections with different settings, and only keep the cells from each setting that were “accurate” for the cell type. I can get into that if anyone wants, but it involves a bit of scripting.
Another options is to use the Subcellular detection command to find the area above a threshold for a marker of interest. Now, by default, rather than measuring the mean intensity of the marker within a cell compartment, you are measuring how much area within the cell is above a given threshold. This is somewhat similar in effect to other software such that allows you to measure the brightest X% of pixels within an object. If desired, you can also sum the intensity within those areas, rather than using the area, but again, that would take more scripting.
That ends up looking more like the following:
Regardless of how large I make the cell expansion, the area above that threshold should remain the same (caveats, caveats… I could run into other staining from a cell who’s nucleus is not in the plane of the slice, so this is not actually a call to make cell expansions infinite!). This makes it a more robust and effective way of determining positivity for many cytoplasmic stains, despite the original intention being for spot detection.
A couple more notes!
For this purpose ALWAYS check “Include clusters” and “Split by shape.” Unchecking clusters will remove any objects larger than the Max spot size, and not checking Split by shape will frequently “fill in” the nucleus, generating less accurate area measurements.
While it does take more scripting, I often will run the subcellular detection, save the desired measurement as a new measurement, and then wipe out all of the subcellular detections by running the command again with all -1s for the thresholds. Removing all of those detections will make interacting with the program much more efficient later on, when you only are concerned with the resulting classification and distribution of cells. You can always go back and run the detection for a single cell and a single channel if you want to see how the area measurement was generated.
Once you have accurate measurements, you then proceed with the many other classification options for QuPath!
I generally use the “Subcellular: Channel X: Num spots estimated” for a given channel as the value for classification (or to save to a new measurement name so I can delete the objects).
For even more fun, you can Add Intensity Measurements to subcellular detections, and classify those as well! The colocalization and R^2 scripts should also both have working options to specifically target subcellular detections, allowing you to look at colocalization of other channels within subcellular detections of a completely different channel.
Final warning, this can be a VERY slow process for large, high resolution images, and may not always be an option. I have had it take days on full sized tissue images. When it does work, it tends to be far more accurate than Cell or Cytoplasm mean measurements. Also, there is no perfect accuracy, as the cell expansions are still blind, and may overlap with other “real cells” incorrectly.