multiple color detection

641 views
Skip to first unread message

enmunari

unread,
Jul 5, 2018, 5:00:50 AM7/5/18
to QuPath users
Dear guys,
I am planning to work on slides immunostained with multiple colors (DAB + red + yellow) and was wondering if it is possible to get the number of stained cells for each color!
Thank you very much!

Pete

unread,
Jul 5, 2018, 5:55:45 AM7/5/18
to QuPath users
I'm afraid there isn't really in QuPath v0.1.2.  There might be elaborate workarounds... but I'd be very cautious about trying anything too elaborate.

I've made some improvements that aren't yet released (moving towards v0.1.3), but described at https://petebankhead.github.io/qupath/2018/03/19/qupath-updates.html (along with how you can get access to them early).  This supports detecting & measuring cells when you have hematoxylin + two other stains.

However, in your case I understand you have a brightfield image with hematoxylin (?) and then three more stains.  This is considerably more difficult... the method of separating stains (color deconvolution) does not really support more than three colors in total.  Ultimately, the image itself has three channels (red, green and blue) and figuring out how to computationally extract more colors than that isn't easy.

What might be possible is the following:
  • Analyze -> Cell analysis -> Cell detection to identify cells - this could be difficult, and I'd suggest turning off the 'Smooth boundaries' option and being careful about the choice of 'Cell expansion' value to try to avoid cells merging into one another
  • Analyze -> Calculate features -> Add intensity features (experimental) and ensure the region is 'ROI', the preferred pixel size is something small (e.g. 1µm), the color transforms are 'Red, Green, Blue & Hue', and the Basic features include 'Mean, Min & Max, Median' and when you run the command make sure no objects are selected, and then confirm to Process all: Detections (you might not need all these options, but I don't know without trying which ones could be removed)
Then you should have the cells and some additional information about their colors throughout the entire cell boundary.  Then you might try creating a script to classify the cells by color, or alternatively training a detection classifier to identify cells of each type.  If you have double or triple positive cells this may not work well enough... and you'd need to be careful about which features are used in the classifier.

Neither approach would be particularly easy.  I can't give detailed step-by-step instructions how to do it because I never have myself, and I don't have any images with similar staining to test it with.  The success of this would also depend upon where within the cell each marker is localized.  If you are able to share some images with this staining then I could experiment some more, but can't promise to find a nice solution.

Because it's possible to write scripts or extensions to QuPath, this could also be approached as a new image analysis project for someone who was happy with image analysis concepts and writing code.

In general, when it comes to looking at multiple IHC markers per cell, there are four main approaches I've encountered among people using QuPath:
  • fluorescence multiplexing (same tissue, one image, potentially many markers)
  • brightfield multiplexing (same tissue, one image, few markers)
  • brightfield restaining (same tissue, multiple images, few markers)
  • brightfield consecutive sections (different tissue, multiple images, few markers)
The order of that list also corresponds roughly to how difficult (I think) they are to handle with image analysis.  I'm interested in supporting all of them eventually, but have very limited time to work on any of them myself and for me fluorescence is the higher priority right now.

enmunari

unread,
Jul 5, 2018, 6:28:53 AM7/5/18
to QuPath users
Dear Pete,
thank you for your detailed (as always) answer.
I understand that playing with more than 2 IHC stains is very difficult, so i will try working with hematoxylin + 2 stains following the instructions you posted.
Thank you for the great efforts you are putting into this project!
Enrico

Pete

unread,
Jul 5, 2018, 6:38:23 AM7/5/18
to QuPath users
Thanks Enrico!  Then https://petebankhead.github.io/qupath/2018/03/19/qupath-updates.html should help.

If you search this Google Group, Carlos Moro has written some great and detailed posts on the workarounds needed to handle two stains using QuPath v0.1.2... but if you can successfully compile v0.1.3 using the instructions under the link then it should make the workarounds much less necessary.  Although I'd still recommend checking out his posts, and step-by-step attachments.

I get the impression that when more stains are required, there's more activity around fluorescence and that's where my priority should be in the near future in terms of maximizing the benefit of the effort put it... although I'm always keen to find out about really common needs or applications in pathology that I just haven't encountered myself yet.

enmunari

unread,
Jul 5, 2018, 7:04:47 AM7/5/18
to QuPath users
Dear Pete,
I agree with you that fluorescence is till the big player when it's necessary to deal with multiple stains, but also brightfield multiple IHC is becoming more and more popular in surgical pathology labs (since fluoresence it's not so widespread), especially with regards to immune cells quantification... I think that evaluation of the inflammatory infiltrate in tumors is playing a major role in research and will become necessary in clinical practice in the near future for both prognostic (e.g. immunoscore) and predictive purposes, especially if clinicians will require such parameters into our pathology report! Then Qu Path will become a MUST!

micros...@gmail.com

unread,
Jul 5, 2018, 10:36:31 AM7/5/18
to QuPath users
Yep, this is definitely possible, though somewhat challenging... and in order to do it successfully would require a little bit more information.  The most colors I have gotten to work moderately well so far is 5+Htx (someone else's example on GitHub), but that required a decent chunk of scripting and was by no means a quick walk in the park.

Roughly though, you create a number of sets of stain deconvolutions.  The number depends on how many stains you have, as you need measurements that separate out each of the colors in each cell.  For example "DAB_NotHematoxylin," "Red_NotYellow," etc. for every color pairing.  A manual classifier can then be created with if then statements, or you can use a large number of these measurements to train a classifier.  It gets trickier to get good results as you have different sized cells, stains that are cytoplasmic, etc, because choosing an accurate Cell Expansion can drastically change how meaningful those measurements are.  I wouldn't want to try to be more specific without an actual example though, as it might not work well in your case :)

Also to do this on multiple slides, your staining needs to be very consistent!

enmunari

unread,
Jul 6, 2018, 6:00:08 AM7/6/18
to QuPath users
Sounds a bit too difficult for me right now, since i am still learning the basics :-)
By the way, i would be very greatful if you guys could give me some tips about scoring of PD-L1 stained TMAs!
I am attaching a sample core stained with E1L3N clone...
I have read the script reported in the supplementary material of Pete's paper and run it... but nothing happened!
Could you please suggest me how to start/which parts of the script i should use?
Thanks!

PD-L1.png

Pete

unread,
Jul 6, 2018, 8:28:00 AM7/6/18
to QuPath users
I suspect it's the dark background again; those scripts were really just intended as a guide (and to document the exact analysis approach in the paper), but wouldn't translate well across laboratory and scanner variation.

Also, I think (from memory) we trained a classifier for PD-L1 to distinguish epithelial, non-epithelial cells - but only actually report the % positive cells across the entire core, disregarding the cell classification, in the main paper (the other results are in the supplementary material).  This was primarily because the cutoff thresholds are so low, that when trying to look at % positive for one cell class even one or two misclassified cells could result in a negative core becoming 'positive'.  Basically, I think that the staining pattern of PD-L1 is such that I don't think it's possible to distinguish cell types automatically in brightfield images with hematoxylin & DAB with enough accuracy... the brown staining itself obscures too much useful information, and the margin for error is so small.

With fluorescence images (where stains can be separated much more cleanly) I'd say that it should be possible to make this distinction much more reliably, although I haven't tried it myself.

With that in mind, you could save yourself a lot of effort and skip the cell type classification step - and use either the percentage of positive cells or the number of positive cells per mm^2 as the final output.  The steps would be:
  • Run the TMA dearrayer (and refine the grid if necessary)
  • (Optional) Run Simple tissue detection - this is only necessary if you want the number of positive cells per mm^2 (we didn't do this in the paper)
  • Run Positive cell detection
The first crucial thing will be figuring out suitable settings for Positive cell detection to detect the cells in the first place - I'd suggest drawing a small rectangle somewhere within one or more 'typical-looking' TMA cores (including positive staining), and trying to run it with various different combinations of parameters and see which seems to give the most sensible cell detection.  Hover the mouse over each parameter for a short description of what it does.  Once you are happy with the settings, you can run it across the entire slide.

The second crucial thing is determining a suitable criterion for deciding when a detected cell is positive or not.  In the paper, we used the maximum DAB value across the entire cell for PD-L1, with a cutoff value that seemed to make sense for our particular staining.  You can explore different options for classifying cells as positive or negative after you've already detected the cells, when it will be much easier to see the impact of the decision across the image.

There are some tips and considerations distinguishing positive & negative cells at https://petebankhead.github.io/qupath/tips/2018/03/22/setting-positive.html
Reply all
Reply to author
Forward
0 new messages