Cell detection inside thresholder annotation

I have very crude hand drawn annotations on tissue (the whole slide in some instances), and I need to apply thresholder to generate better annotations then run cell detection inside these “Tissue” annotations only.
The below script seems to only run cell detection in the space between the “tissue” annotation and hand drawn annotation. How do I tell the cell detection to only operate within “Tissue” annotation only? ie I need data to be only from inside “Tissue” annotation.
Thanks QuPath team for your amazing support!

createAnnotationsFromPixelClassifier("Tissue", 0.0, 10000.0)
//run cell detection optical density sum default
runPlugin('qupath.imagej.detect.cells.WatershedCellDetection', '{"detectionImageBrightfield": "Optical density sum",  "requestedPixelSizeMicrons": 0.17,  "backgroundRadiusMicrons": 15,  "medianRadiusMicrons": 0.0,  "sigmaMicrons": 1.5,  "minAreaMicrons": 10.0,  "maxAreaMicrons": 400.0,  "threshold": 0.1,  "maxBackground": 2.0,  "watershedPostProcess": true,  "excludeDAB": false,  "cellExpansionMicrons": 5.0,  "includeNuclei": true,  "smoothBoundaries": true,  "makeMeasurements": true}');

1 Like

The script looks ok, could it be that the annotations themselves have the wrong classifications?

Whenever multiple annotations are selected it can be hard to distinguish ‘yellow’ lines that are outer and inner boundaries – try selecting a single tissue annotation manually, and you should find that cells are detected inside that.

If that doesn’t help, I might need to see an image to help further.


Yep, my guess would be that the area above or area below threshold was a little bit confusing. Especially since, in brightfield images, the area you “select” changes depending on whether you are using a color deconvolved channel or the Averaged channels options (or other 0-255 scale options).

Your tissue annotations are the area around the tissue, not the tissue itself.