Creating tumor/stromal masks to classify and count cells in


I am learning how to use QuPath for analysis of multiplex IHC images. Is it possible to create a tumor mask so that I can then move on to classifying all the cell types within that mask.

When I train a pixel classifier and do cell detection, the measurements I can export don’t seem to give me cell counts within the masks.

I’d like to create tumor/stromal masks so that I can count immune cells within those two regions.

While I am following the multiplex analysis documentation for 0.2.3, it is showing a method of identifying all the cells but not within masks. I know I can identify all the CK+ cells as tumor cells, but that doesn’t help with me being able to say there is an X% of immune cells in the tumoral and an X% of immune cells in the stromal compartments.

Maybe I am just missing something obvious?

Does anyone have any suggestions?

Thanks for your help!

Have you tried using the pixel classifier to create Annotation objects? Those annotations should automatically include counts of various classes.

Depending on whether you choose to split the creation of the annotations, you could end up with multiple Tumor regions or one combined one.
That is specific to Thresholding, but the same general steps apply to the pixel classifier.

Cell classification would be handled with an object classifier, not the pixel classifier which is used to create the regions.

Thanks for getting back to me so quickly!

I’ll check those options out.

1 Like

Hi MicroscopyRA,

This is working great so far, thanks again. Some more questions with this. There are inevitably images I need to analyze that that are off the edge of the tissue, so are just black (the glass slide background). When I set up the thresholding using this method I have only two classes to choose, tumor or stroma, because there is only one threshold, meaning all that “glass” ends up being called stroma. This doesn’t matter so much for calculating % of cell types in regions, but sometimes people also want cell density measurements. If that area of no tissue is being called stroma then it really throws of the density measurements.

Is there a way I can create a third annotated area to account for the areas of no tissue in the images? Would that take place after this first thresholding step? And can that be incorporated into a workflow script to essentially run a “batch analysis” algorithm for all the images in a project?


The black background has come up before, especially in CZI files. If you cannot exclude this during picture collection, I would recommend a thresholding step (at max resolution) before the tissue detection to remove those areas. So you would only run the pixel classifier within the thresholded area.

Each step should show up in your Workflow tab for scripting. Though you may need to add selection steps by classification to make sure the right objects are being used to run each step “inside of.”
for example.