Hi Carlos,
Thanks very much for your post and very clear description of your application.
At the moment, QuPath does not have great support for more than 2 brightfield stains - I not yet had a similar project to work on, or example data to use to build out this functionality. Nevertheless, you may still be able to put together something with the current tools.
I cropped out a part of the image from your PDF to try it out. I put it into ImageJ and set the pixel size in microns based on the scalebar, and then imported it into QuPath. The resulting image will not exactly match the raw data, but it gives some idea.
I have attached an image showing the results of counting DAB positive and negative nuclei.
'Estimate stain vectors’ can really only handle two stains (usually H&E or hematoxylin & DAB), however there is another way to get stain vectors. If you have ‘Brightfield: Other’ selected, then you can zoom in to the highest magnification and draw a very small annotation around a region that looks like it contains just one color, then double-click on the stain within the table (several entries below ‘Brightfield: Other’). You should see a prompt: ‘Set stain vector from ROI?’
If you click ‘Yes’, then the stain is updated based on the pixels in the selected region. If you click ‘No’, then you have the option to enter the the numbers for the stain vector directly - and also the name of the stain. Therefore you might want to do both… firstly set the stain from the ROI, secondly set the name (but leave the values unchanged).
That should allow you to enter 3 sets of stain values, but not yet do anything very useful with them.
The conventional ‘Cell detection’ command doesn’t work well with your stains; the red overwhelms the blue. However, I was able to get ok results using the ‘Fast cell counts’ command applied to the sum of Hematoyxlin + DAB.
The settings I used are below:
setImageType('BRIGHTFIELD_OTHER');
setColorDeconvolutionStains('{"Name" : "H-DAB-AP", "Stain 1" : "Hematoxylin", "Values 1" : "0.54936 0.71051 0.43975 ", "Stain 2" : "DAB", "Values 2" : "0.3976 0.6146 0.68131 ", "Stain 3" : "AP", "Values 3" : "0.12439 0.7547 0.64417 ", "Background" : " 255 255 255 "}’);
runPlugin('qupath.opencv.CellCountsCV', '{"stainChannel": "Hematoxylin + DAB", "gaussianSigmaMicrons": 2.5, "backgroundRadiusMicrons": 0.0, "doDoG": false, "threshold": 0.2, "thresholdDAB": 0.6, "detectionDiameter": 10.0}');
Also, because the default ‘positive’ and ‘negative’ detection colors (red and blue) are not very clear with this staining, I changed them with the following script:
// Change colors
positiveColor = getColorRGB(20, 255, 20)
getPathClass("Positive").setColor(positiveColor)
negativeColor = getColorRGB(20, 200, 255)
getPathClass("Negative").setColor(negativeColor)
fireHierarchyUpdate()
I hope that is of some use to get started. I also hope to be able to improve QuPath’s handling of multiple stains in brightfield images in the future. However, I should probably mention that the accuracy of any intensity quantification is already limited in brightfield, and additional stains makes this even more difficult; therefore I would suggest that it is best to restrict any measurements to be counts or densities that can be verified visually, and retain some skepticism about any intensity-based measurements that can be made.
Best wishes,
Pete