Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find the same stain vector for hematoxylin and eosin #556

Open
joelive opened this issue Oct 7, 2018 · 4 comments
Open

Find the same stain vector for hematoxylin and eosin #556

joelive opened this issue Oct 7, 2018 · 4 comments

Comments

@joelive
Copy link

joelive commented Oct 7, 2018

when I run find_stain_index like the example code:
w_est = htk.preprocessing.color_deconvolution.rgb_separate_stains_macenko_pca(imInput, I_0)
Perform color deconvolution

deconv_result = htk.preprocessing.color_deconvolution.color_deconvolution(imInput, w_est, I_0)

print('Estimated stain colors (rows):', w_est.T[:2], sep='\n')
Display results

for i in 0, 1:
plt.figure()

Unlike SNMF, we're not guaranteed the order of the different stains.

find_stain_index guesses which one we want

channel = htk.preprocessing.color_deconvolution.find_stain_index(
stain_color_map[stains[i]], w_est)
plt.imshow(deconv_result.Stains[:, :, channel])
_ = plt.title(stains[i], fontsize=titlesize)

It works in most images. But in one image it find_stain_index point to the same index when I try to find the stain vectors for hematoxylin and eosin.Can anyone help me with the issue. Thanks.

The stain vectors for hematoxylin and eosin:
'hematoxylin': [0.65, 0.70, 0.29],
'eosin': [0.07, 0.99, 0.11],

The output of rgb_separate_stains_macenko_pca:
[[ 0.04452724 0.41049417 -0.3624586 ]
[ 0.77551179 0.78978495 0.59997259]
[ 0.6297609 0.45577876 -0.71320169]]

For the stain vectors for hematoxylin and eosin, find_stain_index returns index 1 and index 1

@cdeepakroy
Copy link
Contributor

@joelive Thank you for reporting this. I will try to look into it. Could you please share a sample image to help with debugging?

@alessiamarcolini
Copy link

alessiamarcolini commented Sep 10, 2021

Hello @cdeepakroy, I'm replying here because I bumped into the same issue.

My resulting stain vector

np.array(
    [
        [-0.38326727, 0.55173352, -0.19168126],
        [0.68482841, 0.72174826, 0.59742868],
        [0.61977113, 0.41793489, -0.77867662],
    ]
)

Unfortunately I cannot provide an example image because I use a slighly different way of finding the stain vector and then I'm using _reorder_stains

@cooperlab
Copy link
Contributor

@kheffah have you been working with this function? Any comments?

@cooperlab
Copy link
Contributor

Note on this topic - instead of evaluating the match between an individual stain vector and the columns of a stain matrix, we should look at the global distortion for an injective mapping between one set of stain vectors and another and find a global minimum solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants