Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
79
88
image
unknown
inst
unknown
type
unknown
sem
unknown
sample
stringlengths
79
88
patient
stringclasses
120 values
slide_name
stringclasses
120 values
hospital
stringclasses
19 values
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-0_ymin-0_xmax-1024_ymax-1024
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nCz7166ua5KdiYV53Wd+M81ye+/0WZlZrCoWWWS3WqI(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAADa90lEQVR4nO2dd7w+R1n27zlEmhBC6D2ABDGUUASkSABRRNAIinS(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAACOHklEQVR4nO1967Yzqcqumau/uv/rrT26s3/kUB5AAUGx4jPW6nc(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAArNElEQVR4nO3d22KrOAxGYZPd93/iTDIXTdscONhYkiVrfRcznT3(...TRUNCATED)
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-0_ymin-0_xmax-1024_ymax-1024
TCGA-A1-A0SK
TCGA-A1-A0SK-DX1
A1
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-0_ymin-1024_xmax-1024_ymax-2048
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nDT82bJtSXamh43OmznnanZzzokTTTbIAkBUFYu04hV(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAAC9lUlEQVR4nO2dd9w1R1n+7wkBVEoCqCA1UqRDIAJKfWnSIfQOoYS(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAB8HElEQVR4nO2d4bbrKsuo7Vzr5P6vN++3V8+PzraJAoKCYsIzxt6(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAAVDUlEQVR4nO3d21rjyBlAUZn0+z8xg3PRQHPw+SCVtNe6mUx/pOM(...TRUNCATED)
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-0_ymin-1024_xmax-1024_ymax-2048
TCGA-A1-A0SK
TCGA-A1-A0SK-DX1
A1
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-1024_ymin-0_xmax-2048_ymax-1024
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nCT817J2a46dicG8bs75meV+s03mrsxisRmkGGS3dKS(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAADlYUlEQVR4nO2dd9xtR1X314SAgpQIgkiN0nsAKWqAINKkhd4hFKV(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAACZX0lEQVR4nO1d65bsqqo2NXv3+z9vn7HK86NuiQICgmIq31hrdlU(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAABA1UlEQVR4nO2d2YLbuJJEoWr//xfPtebBtagkkcSSS0QizsNM922(...TRUNCATED)
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-1024_ymin-0_xmax-2048_ymax-1024
TCGA-A1-A0SK
TCGA-A1-A0SK-DX1
A1
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-1024_ymin-1024_xmax-2048_ymax-2048
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nDT919IkWZKtiSnbxMzc/WcRSaqySJ85PRwjAibzDHh(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAADsW0lEQVR4nO2dd9x1R1W21xzpCITeIXSkhi49VAEpQRApigmiFEF(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAACaZ0lEQVR4nO1dbbfrKqu1PefJ//+9ueOs3g99iwoICIpp5hh7r7Z(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAAn0ElEQVR4nO3d23biPBIGUJPV7//Es8Jc9OEnCQZb1qGk2vtqDmk(...TRUNCATED)
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-1024_ymin-1024_xmax-2048_ymax-2048
TCGA-A1-A0SK
TCGA-A1-A0SK-DX1
A1
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-2048_ymin-0_xmax-3072_ymax-1024
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nCT717JtW5YY1nUz3HTL7L2PuyY9qkCAlBhBKfTIJ/2(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAAEAAElEQVR4nOydd7xuR1X315wEJCAhEKSEFgKISIsUAQEJFroQmoK(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAClrElEQVR4nO297ZbsKss2qvWsvc7/eNc77nb/qK9E+RaUpPsaY86(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAA1+ElEQVR4nO3dWbLrOrJsUWjb6X+TU/mxKhWkSKIK98AcP8/s3Tx(...TRUNCATED)
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-2048_ymin-0_xmax-3072_ymax-1024
TCGA-A1-A0SK
TCGA-A1-A0SK-DX1
A1
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-2048_ymin-1024_xmax-3072_ymax-2048
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nDT92bIlR7Jli2lnjTdr7S4iACQyT3NLLikUknKFH8z(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAAC1dUlEQVR4nO29d9x1R1nuf683AekkICA9gKBSI6DShFcUVESJVAW(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAB8J0lEQVR4nO196bosKailEbe63v95q2+n/WPnEKGgoIBouL6qs3O(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAA4/0lEQVR4nO2d2ZLjOIxF5Yr6/09u90NtTqclccFyL3BPxERMzHS(...TRUNCATED)
TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-2048_ymin-1024_xmax-3072_ymax-2048
TCGA-A1-A0SK
TCGA-A1-A0SK-DX1
A1
TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-0_ymin-0_xmax-1024_ymax-1024
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nCz8x7ZsWZJliQnb5Jyjqpe8Z8/MnEZGRVbWQAOj/hQ(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAADzoElEQVR4nO2dd7xuR1X31z5EirRL7xh6J6EJSjE0KSIEkKIUQ5E(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAACfg0lEQVR4nO1d25rkLKs21b3m/q/3+5+urIPaRQUEBMVU3oOZrqp(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAAbPklEQVR4nO3d2XYjN7ZFUdDy/39xpVUPapKU2ESLbs/5UHVdY1w(...TRUNCATED)
TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-0_ymin-0_xmax-1024_ymax-1024
TCGA-A2-A04P
TCGA-A2-A04P-DX1
A2
TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-0_ymin-1024_xmax-1024_ymax-2048
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nCT815J02bKlh7maYq0VEal+UVVbnRbnoEHVZiSN97z(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAADdcklEQVR4nO2dedx+21j/r3U7ERkOxxw6xpA4pswcKpEyVEKDJEm(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAACXb0lEQVR4nO1d6ZbrKK8l9rn1/s9bX9t1f2QwgwQSSCAc9lrdJ0n(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAAam0lEQVR4nO3d2ZpaRxKFUcrS+z+x9MkXpaFKYjqHHCJzr3XT3W5(...TRUNCATED)
TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-0_ymin-1024_xmax-1024_ymax-2048
TCGA-A2-A04P
TCGA-A2-A04P-DX1
A2
TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-1024_ymin-0_xmax-2048_ymax-1024
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nDz9yZJly7Jlh2llxVprF+4eEae61ct8D8lMQEAI2WC(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAAEAAElEQVR4nOydd9w2R1X3zy6B0InSFTQU6UIA6cUgSi9BgVekhSb(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAACvB0lEQVR4nO1d67broKo26dr7/Z/37JHk/OglUQEBQUlnv7HGmk2(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAAf9UlEQVR4nO3d25LbSJJoUeSY/v+LyzrnQVJVXpgkbhHhl7Uejtm(...TRUNCATED)
TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-1024_ymin-0_xmax-2048_ymax-1024
TCGA-A2-A04P
TCGA-A2-A04P-DX1
A2
TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-1024_ymin-1024_xmax-2048_ymax-2048
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nCz9x5I2a7Klh7l4VUR8IjN/ufeuXVXnnG5U86CbBhg(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQAEAAAAAAK5qgcAADsB0lEQVR4nO2defy/2Vj/r/M2IesgOxlblsgkSwlNJEQMKVQKKZR(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAACfHUlEQVR4nO1d67LrKK/Ezpz9/s+7vopzfuTGRRISSCAcd9XMTlZ(...TRUNCATED)
"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAAAAABadnRfAAAgkUlEQVR4nO3d2XrbSJKA0WSr3v+JbbMvqIWSuAAgkBmRcc7F9NQ(...TRUNCATED)
TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-1024_ymin-1024_xmax-2048_ymax-2048
TCGA-A2-A04P
TCGA-A2-A04P-DX1
A2
End of preview. Expand in Data Studio

PanopTILs Refined

Overview

PanopTILs Refined contains 1,349 breast cancer tissue images from 150 TCGA patients, with masks for individual nuclei and surrounding tissue regions. Each H&E image is 1024 × 1024 pixels at 0.25 µm per pixel. There are six nucleus classes and six tissue classes.

This selected subset uses model-assisted nucleus labels and hand-drawn tissue labels. It builds on PanopTILs, BCSS and NuCLS, and can support studies of tumour cells and nearby immune cells.

License: CC0 1.0 Universal.

Files and splits

Split File ROIs Patients
train train.parquet 1,068 120
val val.parquet 130 15
test test.parquet 151 15

Each patient belongs to only one split, so all images from that patient stay together. The 150 patients were randomly divided 80/10/10 using seed 42. These splits were made for this refined subset and differ from the original PanopTILs folds. Classes and hospitals were not balanced between splits. Full patient lists are in manifest.json.

The older panoptils_refined.parquet file contains the whole collection. Use the three files above for training and evaluation; combining them with the older file would repeat images and mix test patients into training.

Fields

Each row contains one image and its masks, stored as PNG bytes. Images are 1024 × 1024 pixels with three colour channels; masks are 1024 × 1024 arrays.

Field Contents
id, sample The same original image name, kept in both fields
patient TCGA patient ID used to keep that patient's images in one split
slide_name Original TCGA slide name
hospital Original TCGA tissue-source-site code
image RGB colour image; uint8 values from 0 to 255
inst Numbered nucleus mask; uint16, with 0 for background
type Nucleus class mask; uint8, using the numbers below
sem Tissue class mask; uint8, using the numbers below

Original nucleus numbers are kept within each image. Keep inst as uint16: converting it to uint8 would lose numbers above 255. Nucleus numbers do not identify the same object across images. Tissue masks label the surrounding regions separately from the nuclei.

Labels

Nucleus classes (type)

Value Class
0 background
1 neoplastic
2 stromal
3 inflammatory
4 epithelial
5 other
6 unknown

Tissue classes (sem)

Value Class
0 background
1 tumor
2 stroma
3 epithelium
4 junk/debris
5 blood
6 other

These are the refined dataset's original class mappings. Nucleus unknown (6) is distinct from background (0).

Download and read a sample

from io import BytesIO

import numpy as np
import polars as pl
from huggingface_hub import hf_hub_download
from PIL import Image


def read_png(data: bytes) -> np.ndarray:
    """Decode RGB pixels or integer labels without reducing mask bit depth."""
    with Image.open(BytesIO(data)) as image:
        return np.array(image)


path = hf_hub_download(
    repo_id="csmp-hub/panoptils_refined",
    repo_type="dataset",
    filename="train.parquet",
)
row = pl.read_parquet(path, n_rows=1).row(0, named=True)
image = read_png(row["image"])
instances = read_png(row["inst"])
cell_types = read_png(row["type"])
tissue_types = read_png(row["sem"])

Use the filenames above to load a different split.

Plot examples

Continue from the loading example.

import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from skimage.segmentation import find_boundaries

sample_ids = [
    "TCGA-A1-A0SK-DX1_xmin45749_ymin25055_MPP-0.2500_xmin-0_ymin-0_xmax-1024_ymax-1024",
    "TCGA-A2-A04P-DX1_xmin104246_ymin48517_MPP-0.2500_xmin-0_ymin-0_xmax-1024_ymax-1024",
    "TCGA-A2-A04Q-DX1_xmin20868_ymin17804_MPP-0.2500_xmin-0_ymin-0_xmax-1024_ymax-1024",
]
samples = pl.scan_parquet(path).filter(pl.col("id").is_in(sample_ids)).collect()
nucleus_names = [
    "Neoplastic",
    "Stromal",
    "Inflammatory",
    "Epithelial",
    "Other",
    "Unknown",
]
nucleus_colors = (
    np.array(
        [
            [0, 0, 0],
            [216, 62, 62],
            [52, 157, 110],
            [55, 109, 219],
            [199, 176, 51],
            [150, 104, 200],
            [110, 110, 110],
        ]
    )
    / 255
)
tissue_names = ["Tumor", "Stroma", "Epithelium", "Junk/debris", "Blood", "Other"]
tissue_colors = (
    np.array(
        [
            [0, 0, 0],
            [224, 77, 74],
            [54, 164, 111],
            [76, 125, 218],
            [129, 98, 149],
            [229, 160, 51],
            [170, 170, 170],
        ]
    )
    / 255
)

fig, axes = plt.subplots(3, 3, figsize=(10, 11.4))
for row_axes, sample in zip(axes, samples.iter_rows(named=True)):
    image = read_png(sample["image"])
    instances = read_png(sample["inst"])
    cell_types = read_png(sample["type"])
    foreground = instances > 0
    overlay = image / 255
    overlay[foreground] = (
        0.65 * overlay[foreground] + 0.35 * nucleus_colors[cell_types[foreground]]
    )
    edges = find_boundaries(instances, mode="inner") & foreground
    overlay[edges] = nucleus_colors[cell_types[edges]]
    tissue_types = read_png(sample["sem"])
    tissue_overlay = image / 255
    annotated = tissue_types > 0
    tissue_overlay[annotated] = (
        0.45 * tissue_overlay[annotated] + 0.55 * tissue_colors[tissue_types[annotated]]
    )
    for ax, pixels in zip(row_axes, (image, overlay, tissue_overlay)):
        ax.imshow(pixels)
        ax.set_axis_off()
    row_axes[0].text(
        0, 1.01, sample["slide_name"], transform=row_axes[0].transAxes, fontsize=8
    )

for ax, title in zip(
    axes[0], ["RGB image", "Nucleus annotations", "Tissue annotations"]
):
    ax.set_title(title, pad=16, fontsize=11)
fig.legend(
    handles=[
        Patch(facecolor=c, label=n) for c, n in zip(nucleus_colors[1:], nucleus_names)
    ],
    loc="lower center",
    bbox_to_anchor=(0.5, 0.045),
    ncol=3,
    frameon=False,
    fontsize=8,
    title="Nuclei",
)
fig.legend(
    handles=[
        Patch(facecolor=c, label=n) for c, n in zip(tissue_colors[1:], tissue_names)
    ],
    loc="lower center",
    bbox_to_anchor=(0.5, 0.003),
    ncol=6,
    frameon=False,
    fontsize=8,
    title="Tissue",
)
fig.subplots_adjust(
    left=0.01, right=0.99, top=0.95, bottom=0.13, hspace=0.14, wspace=0.025
)
plt.show()

Three PanopTILs Refined examples with aligned annotation overlays

Each row shows the colour image and its marked nuclei, followed by the tissue labels.

Two examples without the image underneath. Black marks background; bright instance colours distinguish objects, not cell types. Class colours match the overlay examples above.

from skimage.color import label2rgb

instance_colors = [
    (1, 0.85, 0.2),
    (0.2, 1, 1),
    (1, 0.3, 0.8),
    (0.5, 1, 0.2),
    (0.65, 0.55, 1),
]
mask_samples = samples.to_dicts()
mask_samples = [mask_samples[0], mask_samples[-1]]
mask_layers = [
    ("inst", "Nucleus instances"),
    ("type", "Nucleus classes"),
    ("sem", "Tissue classes"),
]
mask_fig, mask_axes = plt.subplots(2, 3, figsize=(9.600000000000001, 8))
for row_axes, sample in zip(mask_axes, mask_samples):
    for column, (ax, (key, title)) in enumerate(zip(row_axes, mask_layers)):
        labels = read_png(sample[key])
        if key == "type":
            pixels = nucleus_colors[labels]
        elif key == "sem":
            pixels = tissue_colors[labels]
        else:
            pixels = label2rgb(
                labels, colors=instance_colors, bg_label=0, bg_color=(0, 0, 0)
            )
        ax.imshow(pixels, interpolation="nearest")
        ax.set_axis_off()
    label = sample["id"]
    row_axes[0].text(0, 1.02, label, transform=row_axes[0].transAxes, fontsize=8)
for ax, (_, title) in zip(mask_axes[0], mask_layers):
    ax.set_title(title, fontsize=10, pad=18)
mask_fig.subplots_adjust(
    left=0.01, right=0.99, bottom=0.02, top=0.94, hspace=0.16, wspace=0.03
)
plt.show()

Two examples of the annotation masks without image backgrounds

Preparation and validation

Based on Histolytics' refined PanopTILs release. All 1,349 images, class labels and tissue masks are kept. Numbered nucleus masks are stored as uint16 without changing their values.

The data are divided into patient groups as described above. Source details and exact split assignments are in manifest.json.

Limitations

This is a selected subset with model-assisted nucleus labels. It does not contain the full original PanopTILs collection or its folds. Test patients are separate from training patients, but hospitals may be shared. There are no whole-cell or cytoplasm masks.

License and citation

The data use CC0 1.0 Universal. Please credit the PanopTILs, BCSS and NuCLS authors and Histolytics for the refined dataset, and cite these sources:

  • Liu S, Amgad M, Rathore MA, Salgado R, Cooper LA. A panoptic segmentation approach for tumor-infiltrating lymphocyte assessment: development of the MuTILs model and PanopTILs dataset. medRxiv 2022.01.08.22268814. Paper; original PanopTILs.
  • Amgad M, Elfandy H, Hussein H, et al. Structured crowdsourcing enables convolutional segmentation of histology images. Bioinformatics. 2019;35(18):3461–3467. BCSS paper.
  • Amgad M, Atteya LA, Hussein H, et al. NuCLS: A scalable crowdsourcing approach and dataset for nucleus classification and segmentation in breast cancer. GigaScience. 2022;11. NuCLS paper.
Downloads last month
97