choosehappy / HoverFast

Blazing fast nuclei segmentation for brightfield Whole Slide Images
BSD 3-Clause "New" or "Revised" License
29 stars 4 forks source link

Application to IHC stained slides #1

Closed usrsbn closed 1 month ago

usrsbn commented 5 months ago

Hi!

First of all thanks for this great tool that works already very well out of the box! I would like to also use it with my immunohistochemistry (IHC) slides. Are you planning to include this use case as well? I tested it with an H-DAB image, it does segment the blue nuclei pretty well, but struggles with the brown ones. image

Best, Sbn

petroslk commented 5 months ago

Hey there @usrsbn

Thanks for using HoverFast and for the request. Indeed, IHC is already on the radar and we're working on getting it out with our next release. The pretrained model was trained on H&E and ignores brown spots since those can often be melanin in the case of melanoma or anthracosis for lung. We can likely work around this by deconvolving DAB from Hematoxylin. We will do some more experimentation in the next few days and hopefully push a new version in the next couple of week!

Cheers, Petros

PPhamtue commented 3 months ago

Hi Petros,

Our group is also interested in doing nuclear segmentation on IHC, and I was wondering if there is any updates on this. Also, how would you go about this if you wanted to train the model on custom labels?

Kind regards, Paul

petroslk commented 3 months ago

Hey Paul,

IHC support is already implemented in the dev branch, you can already give it a try. I will merge it soon! You can now add -st ihc_dab as an argument for ihc DAB specific segmentation. Keep in mind that you should only do this if your DAB stain is nuclear. If your DAB is not nuclear, you should maybe use regular H&E segmentation, it will probably work better.

Regarding training a custon model to segment objects, are you talking about binary classification? If you want to use your own annotations, I added a notebook in the tutorials directory of the dev branch which shows you how to generate a custom dataset using tiles in png format and corresponding geojson annotations from QuPath.

In brief, you can extract a bunch of tiles at your desired size and magnification (say 1024x1024 at 40x for example), annotate your tiles and then export the annotations with File > Export Objects as geojSON. Then select All objects, Pretty JSON and Export as FeatureCollection. If you have a directory of png tiles and a corresponding directory with the geojsons for each tile, you can create your custom dataset and train a model.

Let me know if this is clear for you, I can provide more information if necessary!

Cheers,

Petros