Start with an image of the tissue stained using Hematoxylin C19 and DAB (3,3'-Diaminobenzidine):
In[1]:=
img=
;
Literature provides the typical RGB colors of the two stains:
In[2]:=
Hematoxylin=
;Diaminobenzidine=
;
Theoretically, the dye colors are obtained by multiplying their color spectrum with the sensitivity spectrum of the red, green and blue channels of the CCD in the recording camera. Obtain the transformation matrix from staining dye to RGB color channels:
These multiplications are called color convolutions; the inverse operations are called color deconvolutions, which is effectively a color demixing of stain colors. Compute the linear inverse transformation from color to dye concentration:
The actual demixing is performed in the log-scale of color intensities, since the color absorption is exponentially proportional to the dye concentration. Define a function to implement the color deconvolution: