Annotations Based on Cell Density


Hello all,

I have recently been doing work with cell detections and cell density maps in HE stained images. I was wondering if there was a way to create annotations based on a cell density threshold? similar to how the pixel threshold creates annotations of various size parameters for tissues.

I have played with some of the spatial analysis options in QuPath but they do not quite give me what i am looking for.

Analysis goals

Goal is to go from Image 1 to Image 2

If anyone has any suggestions or advice, it would be greatly appreciated.

1 Like

Two things I can sort of think of off the top of my head are the hotspot analysis and the cell density function, which could probably be used to create outlines as well with some modifications.
Hotspots: QuPath Spatial analysis - getting started - #2 by Mike_Nelson
Heatmap: Cell Density Map - #18 by EP.Zindy
One useful part about the heatmap is that it generates measurements within the detections that could be used for clustering, or you could use the FP to generate a mask (and then an annotation) from areas with above a certain density.

1 Like

One other option was also rattling around in my head, this one from @petebankhead , but I am not sure which version of QuPath it was for:

It might be possible to use this script once you classify the cells based on your heatmap. In other words, make a threshold classifier based on whatever your are showing in your first image, and then those cells will be positive and all other cells will be negative. You should end up with two annotations, one for positive, one for negative.

The script is from 3 years ago, though, so like the other options, probably won’t work out of the box.
*edit Yep, seems it would need a little work.

1 Like