Positive cell detection with a non standard background

250 views
Skip to first unread message

karna...@gmail.com

unread,
Aug 10, 2018, 7:33:47 AM8/10/18
to QuPath users
Hello,

I am a fairly new user of QuPath, and by the way this is an amazing tool to analyze the histopathology images that I am  working with. I have used this tool with both H and E and IHC stained images, while H and E analysis turned out  to be great, I am facing challenges with the IHC stained images, because of a yellow background. Attached are the original image CD45_H1.jpg , and the processed image for positive cell detection  CD45_H1.jpg .

I have used the following script for setting the image type and stain deconvolution 


setImageType('BRIGHTFIELD_H_DAB');
setColorDeconvolutionStains
('{"Name" : "H-DAB default", "Stain 1" : "Hematoxylin", "Values 1" : "0.69602 0.66056 0.28145 ", "Stain 2" : "DAB", "Values 2" : "0.47625 0.62539 0.61811 ", "Background" : " 240 230 140 "}');

The above background was set for the yellow color


The parameters I have used for positive cell detection is mentioned below

runPlugin('qupath.imagej.detect.nuclei.PositiveCellDetection', '{"detectionImageBrightfield": "Optical density sum",  "backgroundRadius": 15.0,  "medianRadius": 0.0,  "sigma": 5.0,  "minArea": 15.0,  "maxArea": 1000.0,  "threshold": 0.2,  "maxBackground": 2.0,  "watershedPostProcess": true,  "excludeDAB": false,  "cellExpansion": 5.0,  "includeNuclei": true,  "smoothBoundaries": true,  "makeMeasurements": true,  "thresholdCompartment": "Nucleus: DAB OD mean",  "thresholdPositive1": 0.2691,  "thresholdPositive2": 0.4,  "thresholdPositive3": 0.6,  "singleThreshold": true}');



I have gone through Pete's blog (mentioned below) for positive cell detection and also played around with setting cell intensity parameters,


setCellIntensityClassifications('Nucleus: DAB OD mean',1.2,2.6,3.4);


However, as you can see from the processed image, there are multiple cells detected for a single nuclei, I am wondering if there is a way or parameters to correctly estimate the positive stain, background and nuclei. Any ideas would be greatly appreciated.

Thanks,
Hema

CD45_H1.jpg
CD45_H1P.jpg.qpdata

Pete

unread,
Aug 10, 2018, 8:03:52 AM8/10/18
to QuPath users
Hi Hema,

This image looks really challenging for QuPath for two main reasons:
  • the dark (yellow) background
  • it's a JPEG - assuming this is the original, it lacks the pixel size information in µm and that means you need to define everything in pixels for the cell detection... and this is a lot harder
For the first of these, QuPath's cell detection doesn't (unfortunately) use the background correction during cell detection - often that is not very noticeable (since the background is close to white anyway), but here of course it really matters.  This means that the intensity measurements may be pretty wildly inaccurate and unintuitive (e.g. negative), although they should still have some relationship to the staining.

I plan to incorporate the background values into the cell detection in the future, but it will take some caution and need to be clearly documented, since it will impact the results.

Nevertheless, I think it should be possible to get some improvement in the cell detection.  The main thing is to increase the size of the filters used pretty dramatically.

Here's a script that shows the commands and settings I used with the image:

setImageType('BRIGHTFIELD_H_DAB');
setColorDeconvolutionStains
('{"Name" : "H-DAB updated", "Stain 1" : "Hematoxylin", "Values 1" : "0.3978 0.7337 0.55086 ", "Stain 2" : "DAB", "Values 2" : "0.15822 0.65622 0.73779 ", "Background" : " 236 175 41 "}');
createSelectAllObject
(false);
selectAnnotations
();
runPlugin
('qupath.imagej.detect.nuclei.WatershedCellDetection', '{"detectionImageBrightfield": "Hematoxylin OD",  "backgroundRadius": 30.0,  "medianRadius": 4.0,  "sigma": 10.0,  "minArea": 10.0,  "maxArea": 10000.0,  "threshold": 0.2,  "maxBackground": 2.0,  "watershedPostProcess": true,  "excludeDAB": false,  "cellExpansion": 20.0,  "includeNuclei": true,  "smoothBoundaries": true,  "makeMeasurements": true}');

Whenever the µm information isn't there, one thing I sometimes do is to open the image in ImageJ and try a Gaussian filter with different sigma values - this gives me an idea of what to set the 'sigma' value in the QuPath detection.  I can also apply a median filter with the same purpose.  This showed me that the default values where much too low and didn't really have much impact on the image.

You should be able to decipher what settings I used for cell detection from the script, but if it is not clear then you can also run the script for your image and check the 'Workflow' tab.  If you double-click the last 'Cell detection' entry then it should open the parameter dialog with the settings already there.

In general, assuming that the image is from a microscope (rather than a whole slide scanner), and the background is very dark indeed, QuPath might not be the best thing to use with such an image.  Or, if you do use QuPath, I'd suggest looking into preprocessing the image with ImageJ first to try to reduce the background problem.  The following link might help:

Best wishes,

Pete
Reply all
Reply to author
Forward
0 new messages