i have a Hematoxylin+Eosin stained Image.
So i am looking for the command in the script where i can switch between the channels ( I want to switch between channel 1 and channel 2?
When i have channel 2 (Hematoxylin staining) i want to loop over the whole picture (every pixel) and check if the pixel is under or over the Hematoxylin Threshold. So what is the command to get the Hematoxylin Value from a Pixel?
What do you mean by switch between channels? Visually?
One thing you might try is using the built in Positive Pixel Detection tool, but give the DAB threshold a large value. Then your Hematoxylin threshold will allow you to create objects everywhere that the HTX threshold is above the one you have input.
If you want to start pulling pixel values, that will get a bit more complicated.
Note that this can get kind of slow over large areas, and you may want to create tile annotations and run the script across each. Kind of depends on what your end goal is though.
You can see in the right corner the red Frame. There you can see the Hematoxylin Pixel Value from where your Mouse Pointer is. To get the RGB Values there is the Methode -> img.getRGB(x,y).
My thought is there should also be a methode to get the Hematoxylin Value of every Pixel.
That sounds like what the positive pixel detection will do, though I’m not sure at what resolution you want to create the binary mask. Pete has some blog posts on the topic though, with scripts that could be adapted. You are using the positive pixel detection to generate the mask (the object itself) and then writing the image out. If you have a whole slide image, writing the whole image out as a mask might be difficult, but there is an OME-TIFF writer now that might be able to handle it. I haven’t played around with much in the way of exporting masks, so you may want to have a look around the forum. There have been quite a few posts in various places on that topic.
And more on the GitHub issues page, I think. I don’t do much exporting, so I am not going to have all of the answers here.
I believe the new “Create simple thresholder” could be another way to do this, and I find that it has two advantages over Positive Pixel Count: it tends to work faster, and it provides a live preview as you adjust the threshold. However, in brightfield the channels available do not include hematoxylin and eosin, or DAB and hematoxylin. @petebankhead, could these be added in a next milestone?
In a future milestone anyway… it’s not technically difficult, the issue is that the classifiers need to be saved - and then (preferably) supported in future releases.
Some parts are awkward and require making a decision, e.g. should it use the stain vectors currently set for the current image, or the stain vectors that were used when the classifier was saved originally? I’m not sure what the right answer to that is… so resisted adding the feature until it was clearer how it should behave.
Ugh. I could see that going either way, situationally. I’d like to say it should use the color vectors when it was trained to keep things consistent. But what if you wanted similar darkness of stain on two different scanners? Would such a thing even be meaningful though?