HistoImagePlot 1.0.0
library(imageFeatureTCGA)
library(HistoImagePlot)
library(dplyr)
library(SpatialExperiment)
library(ggplot2)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("waldronlab/HistoImagePlot")
HoverNet is a deep learning model for simultaneous segmentation and classification of nuclei in multi-tissue histology images. This vignette demonstrates how to import HoverNet output files into Bioconductor’s spatial data structures and create visualizations of the segmentation results.
The package supports two main file formats:
.json or .json.gz): Contains cell coordinates, types, and
optional contours.h5ad): AnnData format with additional
computed features like mean intensity and nearest neighbor distanceSpatialExperimentobject from URLs (with Automatic Caching)
The file will be automatically cached using BiocFileCache:
hov_file <- paste0(
"https://store.cancerdatasci.org/hovernet/h5ad/",
"TCGA-23-1021-01Z-00-DX1.F07C221B-D401-47A5-9519-10DE59CA1E9D.h5ad.gz")
thumb_path <- paste0(
"https://store.cancerdatasci.org/hovernet/thumb/",
"TCGA-23-1021-01Z-00-DX1.F07C221B-D401-47A5-9519-10DE59CA1E9D.png")
hn_spe <- HoverNet(hov_file, outClass = "SpatialExperiment") |>
import()
The package provides a convenient function to overlay the segmentation on the original tissue thumbnail image.
thumb_path <- paste0(
"https://store.cancerdatasci.org/hovernet/thumb/",
"TCGA-23-1021-01Z-00-DX1.F07C221B-D401-47A5-9519-10DE59CA1E9D.png")
plotHoverNetH5ADOverlay(hn_spe, thumb_path)
plotHoverNetH5ADOverlay(
hn_spe,
thumb_path,
title = "Ovarian Cancer Tissue - Cell Segmentation",
point_size = 0.02,
legend_point_size = 3
)