File size: 4,695 Bytes
97508bc 35d4f88 dc10f14 97508bc 880cd60 91e39b3 942c12b 97508bc 91e39b3 35d4f88 91e39b3 35d4f88 91e39b3 35d4f88 6941ddc 35d4f88 97508bc d0661ff f43bf5d 97508bc d0661ff 97508bc f43bf5d 97508bc f43bf5d e748dab c05a386 97508bc d40293b 97508bc c05a386 97508bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
---
license: cc0-1.0
tags:
- histology
- panoptic
- segmentation
- biology
- medical
---
## Dataset Description
This dataset contains refined **Panoptils manual regions and bootstrapped nuclei labels** for panoptic segmentation model training. This refined version
contains in total **1349 images** and corresponding annotations of **TCGA invasive breast cancer cases**. Cases (total 360) with incomplete or insufficient
annotations from the original dataset have been excluded to ensure only high-quality annotations. The segmentation masks have been algorithmically post-processed
to fill excessive background regions present in the original annotations, resulting in more contiguous tissue regions. Each sample includes byte-encoded
**image, nuclei instance segmentation, nuclei semantic segmentation, and tissue semantic segmentation masks** serialized in a **Parquet file** for efficient access.
(See 'How to use'-section on how to decode).
The original **[Panoptils dataset](https://sites.google.com/view/panoptils/)** (CC0-1.0) is a large-scale, semi-manually annotated collection of breast cancer
whole-slide images (WSIs) designed for panoptic segmentation tasks.
**From the Panoptils webpage**:
"PanopTILs was created by reconciling and expanding two public datasets, BCSS and NuCLS, to enable in-depth analysis of the tumor microenvironment (TME) in whole-slide
images (WSI) of H&E stained slides of breast cancer."
"The dataset is composed of **1024x1024 regions of interest (ROIs) at 0.25 microns-per-pixel (MPP) resolution**, which corresponds to 40x magnification on many scanners.
Annotations of histologic regions (semantic segmentation), as well as nuclear classifications and segmentation (object segmentation), are provided for the same ROI"
**References**:
- **PanopTILs dataset**
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.
- **BCSS dataset**
Amgad M, Elfandy H, Hussein H, Atteya LA, Elsebaie MA, Abo Elnasr LS, Sakr RA, Salem HS, Ismail AF, Saad AM, Ahmed J. Structured crowdsourcing enables convolutional segmentation of histology images. *Bioinformatics*. 2019 Sep 15;35(18):3461-7.
- **NuCLS dataset**
Amgad M, Atteya LA, Hussein H, Mohammed KH, Hafiz E, Elsebaie MA, Alhusseiny AM, AlMoslemany MA, Elmatboly AM, Pappalardo PA, Sakr RA. NuCLS: A scalable crowdsourcing approach and dataset for nucleus classification and segmentation in breast cancer. *GigaScience*. 2022 May 17;11.
**Dataset Classes (refined)**:
```
nuclei_classes = {
"background": 0,
"neoplastic": 1,
"stromal": 2,
"inflammatory": 3,
"epithelial": 4,
"other": 5,
"unknown": 6,
}
tissue_classes = {
"background": 0,
"tumor": 1,
"stroma": 2,
"epithelium": 3,
"junk/debris": 4,
"blood": 5,
"other": 6,
}
```
**How to use**:
```python
import pandas as pd
import numpy as np
import io
import matplotlib.pyplot as plt
from datasets import load_dataset
from PIL import Image
from skimage.color import label2rgb
# for decoding PNG bytes to numpy array
def png_bytes_to_array(png_bytes):
img = Image.open(io.BytesIO(png_bytes))
return np.array(img)
# Load the dataset from Hugging Face Hub
ds = load_dataset("histolytics-hub/panoptils_refined", split="train")
# convert to pandas df
df = ds.with_format("pandas")[:]
# Example: decode one row
row = df.iloc[1]
image = png_bytes_to_array(row["image"])
inst_mask = png_bytes_to_array(row["inst"])
type_mask = png_bytes_to_array(row["type"])
sem_mask = png_bytes_to_array(row["sem"])
fig, axes = plt.subplots(1, 4, figsize=(20, 5))
axes[0].imshow(image)
axes[1].imshow(label2rgb(inst_mask, bg_label=0))
axes[2].imshow(label2rgb(type_mask, bg_label=0))
axes[3].imshow(label2rgb(sem_mask, bg_label=0))
for ax in axes:
ax.axis("off")
plt.tight_layout()
plt.show()
```

**Note:** The original fold splits are not viable in this dataset since many images were excluded during curation. However, you can easily split the data for training and validation using the `slide_name` and `hospital` columns to avoid data leakage. Here is an example using `sklearn`'s `GroupShuffleSplit` to split by slide:
```python
from sklearn.model_selection import GroupShuffleSplit
gss = GroupShuffleSplit(n_splits=1, test_size=0.2, random_state=42)
train_idx, val_idx = next(gss.split(df, groups=df["slide_name"]))
df_train = df.iloc[train_idx]
df_val = df.iloc[val_idx]
```
You can also use the `hospital` column as the grouping key if you want to split by hospital. |