DAB detection - Cell expansion - QuPath

Hi there @petebankhead,

I’m trying to detect DAB in the cytoplasm, and I watched your videos on how to do that. Now I made a semi-optimized workflow. The only problem is that I have different cell types in my tissue cores, like some giant cells and some smaller ones, including red blood cells and white blood cells. I cannot use the same cell expansion for them; otherwise, it considers red blood cells as giant cells. I can ignore them as I mainly work with tumor cells, but is there any way to apply an automatic cell expansion based on the cell size? So that I can finally classify the expression of the protein in each cell type. As I have different tissue cores in one slide, I guess I cannot apply the detection classifier?

My next question is when I select the tissue microarrays and arrange them in rows and columns, I cannot draw on the tissue or use the wand tool anymore. So I guess the only way is first to classify them and then select the TMAs, am I right?

Not with the built-in cell segmentation.

You can with the (somewhat experimental) StarDist cell segmentation. This is rather more complicated to set up, and requires scripting. The key parameter is cellConstrainScale – see
https://qupath.readthedocs.io/en/latest/docs/advanced/stardist.html#cell-expansion-measurements

The detection classifier will end up being applied to all cells across the image, so I think you’re right and the answer is ‘no’.

I’m not sure I understand – can you just deselect the cores first before drawing (e.g. double-click outside a core with the Move tool active)?

2 Likes

I don’t know if @sadaffazeli1995 wants to dig into scripting, but I think that you pointed out this was possible in a post here:

Passing the children of a given set of TMA cores (or children of children, or checking “contains”) would allow specific classifiers to be applied to specific cores, perhaps by tissue type.

.
.

And wanted to mention that “cell size” in this case is “size of what StarDist detects as the nucleus.” Probably is what everyone meant, but sometimes expectations can be tricky.

2 Likes

Hi again,

Thanks for your suggestions. I have built a new Qupath and ran the Stardist. I will attach my result. It looks quite good. The only problem is with the positive cell detection command, I can define the threshold for 1+, 2+, and 3+, but with stardist, I cannot do that. I was thinking of training the image using the classification option, but I am not sure whether I can do that, and the software can recognize somehow, I am training the image for the cell’s intensity and not the cell’s shape. Can you guide me through that? How can I get the intensity of the cell as 1+ 2+ and 3+ and use stardist at the same time? (I know intensity for IHC is not the best option. Still, I am doing it based on the controls I have for some reasons)
I really appreciate any help you can provide.

Hi @sadaffazeli1995, the command Classify → Object classification → Set cell intensity classifications exists for cases where you want to use a different cell detection, but still classify according to intensities.

1 Like

Wow! Thanks a lot.
It was very helpful

Just one more question,

I can apply stardist for cell detection, and I have tried it on a small area I have selected. I have TMAs, and I have arranged them in the conventional way (rows and columns). How can I run the Stardist codes on TMAs? Now I have only two options 1. Run and 2. Run the selected area but not the TMAs.

Thanks a lot

Glad it works!

If your script contains a line

def pathObjects = getSelectedObjects()

then you can simply add

selectTMACores()

before that. Alternatively, replacing it with this should work too:

def pathObjects = getTMACoreList().findAll {!it.isMissing()}

If that doesn’t fix things, please post the script you’re using.

2 Likes