HoverFast

HoverFast: an accurate, high-throughput, clinically deployable nuclear segmentation tool for brightfield digital pathology images - Published in JOSS (2024)

https://github.com/choosehappy/hoverfast

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Mathematics Computer Science - 84% confidence
Engineering Computer Science - 60% confidence
Last synced: 6 months ago · JSON representation ·

Repository

Blazing fast nuclei segmentation for brightfield Whole Slide Images

Basic Info
  • Host: GitHub
  • Owner: choosehappy
  • License: bsd-3-clause
  • Language: Jupyter Notebook
  • Default Branch: main
  • Size: 39 MB
Statistics
  • Stars: 36
  • Watchers: 5
  • Forks: 4
  • Open Issues: 0
  • Releases: 4
Created almost 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Citation

README.md

HoverFast Logo

License GitHub release (latest by date) Python Version Docker Pulls GitHub issues GitHub stars

Welcome to the official repository of HoverFast, a high-performance tool designed for efficient nuclear segmentation in Whole Slide Images (WSIs).

Overview

HoverFast utilizes advanced computational methods to facilitate rapid and accurate segmentation of nuclei within large histopathological images, supporting research and diagnostics in medical imaging. For more info on the inner workings of HoverFast, do not hesitate to go over our paper

Documentation

An overview of the documentation is provided in this repository, but for more details, please visit the full official documentation

Installation

Prerequisites

  • Python 3.11.5
  • CUDA installation for GPU support (version > 12.1.0)

Using Docker

We recommend using HoverFast within a Docker or Singularity (Apptainer) container for ease of setup and compatibility.

  • Pull Docker Image docker pull petroslk/hoverfast:latest

Using Singularity

For systems that support Singularity (Apptainer), you can pull the HoverFast container as follows:

  • Pull Singularity Container singularity pull docker://petroslk/hoverfast:latest

Local Installation with Conda

For local installations, especially for development purposes, follow these steps:

  • Create and activate a Conda environment conda create -n HoverFast python=3.11 conda activate HoverFast

  • Install HoverFast git clone https://github.com/choosehappy/HoverFast.git cd HoverFast pip install .

Usage

Command Line Interface

HoverFast offers a versatile CLI for processing WSIs, ROIs, and for model training.

For Whole Slide Images (WSI) Inference

  • Basic Usage HoverFast infer_wsi --help
  • Check Version HoverFast --version

  • Example Command without binary masks HoverFast infer_wsi path/to/slides/*.svs -m hoverfast_crosstissue_best_model.pth -n 20 -o hoverfast_output

  • Example Command with binary masks

Although HoverFast does have a simple threshold based tissue detection, we highly recommend the use of QC tools such as HistoQC for generating tissue masks to avoid computing on artefactual regions and reducing computation time. You can give the path to the directory where the masks are stored. HoverFast will search for a mask with the same name as the slide with a .png extension.

HoverFast infer_wsi path/to/slides/*.svs -b path/to/masks/ -m hoverfast_crosstissue_best_model.pth -n 20 -o hoverfast_output

  • Example for IHC Nuclear DAB stain

If your IHC DAB stain is nuclear, you should use the ihc_dab flag to segment nuclei. If your IHC DAB stain is not nuclear, regular H&E segmentation might be a better option.

HoverFast infer_wsi path/to/slides/*.svs -b path/to/masks/ -m hoverfast_crosstissue_best_model.pth -n 20 -o hoverfast_output -st ihc_dab

For Region of Interest (ROI) Inference

  • Example Command

HoverFast infer_roi path/to/rois/*png -m hoverfast_pretrained_pannuke.pth -o hoverfast_output

Using Containers

Containers simplify the deployment and execution of HoverFast across different systems. We highly recommend using them!

Docker

  • Run Inference

docker run -it --gpus all -v /path/to/slides/:/app petroslk/hoverfast:latest HoverFast infer_wsi *svs -m /HoverFast/hoverfast_crosstissue_best_model.pth -o hoverfast_results

Singularity

  • Run Inference

singularity exec --nv hoverfast_latest.sif HoverFast infer_wsi /path/to/wsis/*svs -m /HoverFast/hoverfast_crosstissue_best_model.pth -o hoverfast_results

Training

To train HoverFast on your data, you may need to generate a local dataset first using our provided container.

Generating Local Dataset

  • Structure your data directory

└── dir config.ini └── slides/ ├── slide_1.svs ├── ... └── slide_n.svs

  • Generate Dataset

docker run --gpus all -it -v /path/to/dir/:/HoverFastData petroslk/data_generation_hovernet:latest hoverfast_data_generation -c '/HoverFastData/config.ini'

This should generate two files in the directory called "datatrain.pytable" and "datatest.pytable". You can use these to train the model.

  • Train model

You can use these to train the model as follows:

The training batch size can be adjusted based on available VRAM

HoverFast train data -o training_model -p /path/to/pytable_files/ -b 16 -n 20 -e 100

docker run -it --gpus all -v /path/to/pytables/:/app petroslk/hoverfast:latest HoverFast train data -o training_metrics -p /app -b 16 -n 20 -e 100

singularity exec --nv hoverfast_latest.sif HoverFast train data -o training_metrics -p /path/to/pytables/ -b 16 -n 20 -e 100

Testing

Since HoverFast utilizes GPU for almost all tasks, most tests have to be run locally using pytest.

First, install pytest:

pip install pytest

Then, you can just run the following command inside the HoverFast repo:

pytest -vv Note that the first time you run these, the infer_wsi test can take longer since the slide will be downloaded locally

For more detailed instructions, including setting up your environment and running specific tests, please refer to the testing documentation

How to Cite HoverFast

If you use HoverFast in your research, please cite our paper:

bibtex @article{Liakopoulos2024, doi = {10.21105/joss.07022}, url = {https://doi.org/10.21105/joss.07022}, year = {2024}, publisher = {The Open Journal}, volume = {9}, number = {101}, pages = {7022}, author = {Petros Liakopoulos and Julien Massonnet and Jonatan Bonjour and Medya Tekes Mizrakli and Simon Graham and Michel A. Cuendet and Amanda H. Seipel and Olivier Michielin and Doron Merkler and Andrew Janowczyk}, title = {HoverFast: an accurate, high-throughput, clinically deployable nuclear segmentation tool for brightfield digital pathology images}, journal = {Journal of Open Source Software} } By citing HoverFast, you help us to continue our research and development. Thank you for your support!

Authors

Owner

  • Login: choosehappy
  • Kind: user

JOSS Publication

HoverFast: an accurate, high-throughput, clinically deployable nuclear segmentation tool for brightfield digital pathology images
Published
September 26, 2024
Volume 9, Issue 101, Page 7022
Authors
Petros Liakopoulos ORCID
Service of Precision Oncology, Department of Oncology, University of Geneva and Geneva University Hospitals, Geneva, Switzerland
Julien Massonnet ORCID
Division of Clinical Pathology, , Departments of Pathology and Immunology & Diagnostics, University of Geneva and Geneva University Hospitals, Geneva, Switzerland
Jonatan Bonjour ORCID
Service of Precision Oncology, Department of Oncology, University of Geneva and Geneva University Hospitals, Geneva, Switzerland
Medya Tekes Mizrakli
Section of Communication Systems, School of Computer and Communication Sciences, École Polytechnique Fédérale de Lausanne, Lausanne, Switzerland.
Simon Graham
Histofy Ltd, Birmingham, United Kingdom
Michel A. Cuendet
Service of Precision Oncology, Department of Oncology, University of Geneva and Geneva University Hospitals, Geneva, Switzerland
Amanda H. Seipel
Division of Clinical Pathology, , Departments of Pathology and Immunology & Diagnostics, University of Geneva and Geneva University Hospitals, Geneva, Switzerland
Olivier Michielin
Service of Precision Oncology, Department of Oncology, University of Geneva and Geneva University Hospitals, Geneva, Switzerland
Doron Merkler
Division of Clinical Pathology, , Departments of Pathology and Immunology & Diagnostics, University of Geneva and Geneva University Hospitals, Geneva, Switzerland
Andrew Janowczyk
Service of Precision Oncology, Department of Oncology, University of Geneva and Geneva University Hospitals, Geneva, Switzerland, Division of Clinical Pathology, , Departments of Pathology and Immunology & Diagnostics, University of Geneva and Geneva University Hospitals, Geneva, Switzerland, Emory University, Atlanta, Georgia, United States of America.
Editor
Stefan Appelhoff ORCID
Tags
digital pathology deep learning biomedical imaging nuclear segmentation

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it using the following information."
authors:
  - family-names: Liakopoulos
    given-names: Petros
  - family-names: Massonnet
    given-names: Julien
  - family-names: Bonjour
    given-names: Jonatan
  - family-names: Mizrakli
    given-names: Medya Tekes
  - family-names: Graham
    given-names: Simon
  - family-names: Cuendet
    given-names: Michel A
  - family-names: Seipel
    given-names: Amanda H
  - family-names: Michielin
    given-names: Olivier
  - family-names: Merkler
    given-names: Doron
  - family-names: Janowczyk
    given-names: Andrew
title: "HoverFast: an accurate, high-throughput, clinically deployable nuclear segmentation tool for brightfield digital pathology images"
version: 1.0.0
date-released: 2024-05-30
url: "https://arxiv.org/abs/2405.14028"

GitHub Events

Total
  • Release event: 1
  • Watch event: 8
  • Push event: 3
  • Pull request event: 4
  • Fork event: 1
  • Create event: 1
Last Year
  • Release event: 1
  • Watch event: 8
  • Push event: 3
  • Pull request event: 4
  • Fork event: 1
  • Create event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 43
  • Total Committers: 3
  • Avg Commits per committer: 14.333
  • Development Distribution Score (DDS): 0.209
Past Year
  • Commits: 8
  • Committers: 2
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.125
Top Committers
Name Email Commits
petroslk l****s@g****m 34
JulienMassonnet 9****t 7
JonatanBonjour j****r@g****m 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 4
  • Total pull requests: 3
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 1 minute
  • Total issue authors: 4
  • Total pull request authors: 1
  • Average comments per issue: 2.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 3
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: 1 minute
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • PingjunChen (1)
  • roberts10 (1)
  • NetoPedro (1)
  • usrsbn (1)
Pull Request Authors
  • JulienMassonnet (4)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels

Dependencies

Dockerfile docker
  • nvidia/cuda 12.1.0-runtime-ubuntu22.04 build
requirements.txt pypi
  • Pillow *
  • albumentations ==1.2.1
  • matplotlib *
  • opencv-python *
  • openslide-python ==1.3.1
  • scikit-image *
  • scipy *
  • shapely *
  • tables *
  • tensorboard *
  • tensorboardx *
  • torch >=2.0.0
  • torchmetrics *
  • tqdm *
  • ujson *
setup.py pypi
docs/requirements.txt pypi
  • furo *
  • sphinx *
  • sphinx-autobuild *
  • sphinx-rtd-theme *
  • sphinx_design *