Brightfield Multiplex analysis

I have been attempting to work with an image with multiple stains using the workflow found here:
https://qupath.readthedocs.io/en/latest/docs/tutorials/multiplex_analysis.html
The image is a brightfield image. I am getting stuck at setting up the channel names. The example in the workflow is fluorescent, so I am not sure if the workflow is different. However, I am not able to set up multiple channels in the brightness and contrast window, meaning that only one channel is showing at a time. This means that I have not been able to detect multiple different stains by separating them into different classes. Is there a better method that I could use for the multiplex analysis, or another workflow I should be following? Alternatively, are there any currently available scripts that can perform multiplex analysis?

Hi! If I understand correctly, you cannot set channel names in an RGB image, though you can set color deconvolution channel names as long as you are not using H&E or HDAB. Using Brightfield(Other) will allow you to freely change the names and color vectors. You can view multiple deconvolved channels using the View->Mini vieweres->Show channel viewer

This is, really, a very hard problem (if you have more than two stains). At least as I see it, there are three major complicating factors in brightfield multiplex analysis.

  1. The staining “intensity” is not linear. IE, you cannot assume that something that is twice as dark has twice as much sample. And the closer you get to black, the less additional information each pixel value gives you.
  2. Staining overlap interferes with each other - as far as I know, you can never purely separate out two stains, only get an estimate of the relative contribution. Which will be wrong. Another case of “all models are wrong, but some models are still useful.” In this case, that factor comes into play most strongly if you try to use the multiplex method where you calculate the intensity “per stain” and try to figure out double, triple, etc positive cells.
    Lets say you have a single positive cell with an OD of 0.2 “yellow”
    If you then had a double positive cell with “yellow” and “red,” even with the exact same amount of protien and yellow staining, after deconvolution, the OD of the “yellow” would be less than 0.2. Often by quite a bit, though that depends on how “close” the two color vectors are, at least in my experience.
  3. There are only two real color vectors, and a residual color vector, as long as you are using the standard built in color deconvolution. That means you cannot easily get values for each individual stain, but you can often identify cells of a particular “color” based on a combination of color vector measurements.

There is some discussion of deconvolving stains on the forum, I think @gabriel, @petebankhead and @phaub here: Color deconvolution implementations & best practice
I think there was a discussion of a higher number of stains than 3 somewhere as well, but I am pretty tired from a day in the sun and can’t find it easily at the moment.

One option might be to train a pixel classifier to identify the different “colors” and classify cells that way - or superpixels or tiles. You would need to create a class for all possible colors (including overlaps), though. But it might be your best shot at the moment.

If you can find good single color deconvolutions (probably impossible if you have 3+ stains), you could potential export each channel and combine them as a multichannel quasi IF image. It would NOT be quantitative, but it might let you look at the stains in a fluorescence channel kind of way.

1 Like

What does this mean in detail?


This is an example slide, zoomed in to look at the stains. One cell type is stained with DAB, the other with a purple cytoplasmic stain.

Your image seems to be perfectly 3-color stained.
And the stains can be separated nicely.
All you need is a 3-color deconvolution.
Then you can build a workflow based on the OD channels.

Support for 3-color deconvolution is a bit tricky in QuPath.
see this old post Support for alternative stains in brightfield images · Issue #73 · qupath/qupath · GitHub

Maybe others have more information.

In any case, you should use ImageJ ColorDeconvolution2 for pre-testing and to familiarize with the concept of ColorDeconvolution.

This is the normal QuPath behavior for brightfield images. Only one channel is displayed at a time.

I am not sure if something is not mixed up here. The stain separation is done by the software, not by the user and not by the brightness&contrast settings.
Once the colors are separated, they can be handled in the QuPath functions in the same way as fluorescence channels.

Hope that helps little.

1 Like

Hi @Sophia_Kerns
in

I posted a script which helps you to setup the 3-stain color deconvolution for your test image.

From your image I have estimated the following stain vectors:

"HTX", 0.7110,  0.6300,  0.3080
"DAB", 0.3250,  0.6070,  0.7250
"Stain3", 0.3000,  0.9100,  0.2850

The result of this 3-stain color separation looks like this:

Hope this helps.

2 Likes

Yep, and as an add-on there is also a way to do this using the GUI via brightfield other and manual editing of the values:
Set the image type to Brightfield Other, and double click on the stain vectors to add them in.
image
Going through that using all of the stain vectors and image type will auto generate this code in the Workflow tab.

setImageType('BRIGHTFIELD_OTHER');
setColorDeconvolutionStains('{"Name" : "DAB-Purple", "Stain 1" : "HTX", "Values 1" : "0.71197 0.63086 0.30842 ", "Stain 2" : "DAB", "Values 2" : "0.32505 0.60709 0.72511 ", "Stain 3" : "Purple", "Values 3" : "0.30286 0.90857 0.28771 ", "Background" : " 255 255 255 "}');

As long as you set the color vectors before detecting cells, you will get measurements for all three channels this way - if you set the color vectors after generating cells, you will need to generate new measurements. The cell measurements do not automatically update when the stain vectors are changed.

The key, of course, is getting the stain vectors right, and once you are in Brightfield Other, you cannot use the Preprocessing-> Estimate stain vectors function in QuPath.

Also, that is some impressively clean color deconvolution, so bravo on the imaging, staining, and the stain vectors!

1 Like