IHC Image color deconvolution

Juan Nunez-Iglesias jni.soma at gmail.com
Tue Aug 23 22:08:00 EDT 2016


Hi Koundinya,

It looks like this is not a trivial question, because the conversion
between the two spaces is nonlinear. See the code here:
https://github.com/scikit-image/scikit-image/blob/master/skimage/color/colorconv.py#L1437

I originally thought that it would be possible to convert each channel
separately, but the `exp` call makes this either difficult or impossible (I
haven't yet decided which, but I wasn't able to get it to work in a short
amount of time).

Here's my initial attempt, which was a complete failure, for the record:

In [1]: from skimage import data
In [2]: from skimage.color import rgb2hed
In [3]: from skimage.color import hed2rgb
In [4]: import matplotlib.pyplot as plt
In [5]: ihc_rgb = data.immunohistochemistry()
In [6]: ihc_hed = rgb2hed(ihc_rgb)
In [8]: import numpy as np
In [9]: h, e, d = np.transpose(ihc_hed, (2, 0, 1))
In [10]: empty = np.zeros_like(h)
In [11]: h_rgb = hed2rgb(np.dstack((h, empty, empty)))
In [12]: e_rgb = hed2rgb(np.dstack((empty, e, empty)))
In [13]: d_rgb = hed2rgb(np.dstack((empty, empty, d)))
In [14]: fig, axes = plt.subplots(2, 2, figsize=(6, 7), sharex=True,
    ...:                          sharey=True,
    ...:                          subplot_kw={'adjustable': 'box-forced'})
In [15]: axes[0, 0].imshow(ihc_rgb); axes[0, 0].set_title('Original image')
Out[15]: <matplotlib.text.Text at 0x121357438>

In [16]: axes[0, 1].imshow(h_rgb); axes[0, 1].set_title('Hematoxylin')
Out[16]: <matplotlib.text.Text at 0x121371c18>

In [17]: axes[1, 0].imshow(e_rgb); axes[1, 0].set_title('Eosin')
Out[17]: <matplotlib.text.Text at 0x1210684e0>

In [18]: axes[1, 1].imshow(d_rgb); axes[1, 1].set_title('DAB')
Out[18]: <matplotlib.text.Text at 0x1219315f8>

In [19]: for ax in axes.ravel():
    ...:     ax.axis('off')

Result:


Maybe someone else in the list has some ideas?

Juan.

From: Koundinya Desiraju <drkoundinyadesiraju at gmail.com>
<drkoundinyadesiraju at gmail.com>
Reply: scikit-image at googlegroups.com <scikit-image at googlegroups.com>
<scikit-image at googlegroups.com>
Date: 23 August 2016 at 3:40:09 PM
To: scikit-image <scikit-image at googlegroups.com>
<scikit-image at googlegroups.com>
Subject:  IHC Image color deconvolution

In this tutorial,
http://scikit-image.org/docs/dev/auto_examples/color_exposure/plot_ihc_color_separation.html#sphx-glr-auto-examples-color-exposure-plot-ihc-color-separation-py

After color deconvolution the haematoxylin and DAB channels were plotted in
grayscale but I want to show them in respective colors. For example, I want
to show DAB channel in brown. Can anyone kindly post How to do that?

Thanks,
Koundinya
--
You received this message because you are subscribed to the Google Groups
"scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to scikit-image+unsubscribe at googlegroups.com.
To post to this group, send email to scikit-image at googlegroups.com.
To view this discussion on the web, visit
https://groups.google.com/d/msgid/scikit-image/74882dde-6af5-4cb8-a02d-debd5e2e1678%40googlegroups.com
<https://groups.google.com/d/msgid/scikit-image/74882dde-6af5-4cb8-a02d-debd5e2e1678%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20160823/34c036f5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deconv.png
Type: image/png
Size: 302111 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20160823/34c036f5/attachment.png>


More information about the scikit-image mailing list