|
--- |
|
task_categories: |
|
- image-segmentation |
|
language: |
|
- en |
|
tags: |
|
- histology |
|
- pathology |
|
size_categories: |
|
- n<1K |
|
pretty_name: TCGA Tissue Segmentation |
|
license: cc0-1.0 |
|
--- |
|
|
|
## Overview |
|
|
|
This dataset consists of 242 images from [The Cancer Genome Atlas (TCGA)](https://www.cancer.gov/ccg/research/genome-sequencing/tcga) pathology dataset manually annotated for segmentation of tissue (i.e. pixel-level annotation of presence or absence of tissue). |
|
|
|
Each image is a full TCGA slide (mostly H&E) downsampled to 10 microns per pixel (MPP) and saved as a PNG. |
|
|
|
Each image has a corresponding mask, which is also saved as a PNG where each pixel corresponds to the pixel at the same position in the 10 MPP image. |
|
The pixel values of the image mask are either 0 (no tissue) or 255 (tissue). |
|
|
|
We also include text files `train-slides.txt` and `test-slides.txt` which provide a suggested train/test split of 194 training images (\~80%) and 48 test images (\~20%). |
|
|
|
The slides were selected from TCGA to contain representative artifacts like pen markings, ink, air bubbles, cracks, and slide labels -- artifacts that often cause standard tissue segmentation algorithms to fail. |
|
|
|
The slides are predominantly H&E and include both FFPE and frozen samples. |
|
|
|
The data annotation schema purposefully includes all tissue present, including necrotic tissue and tissue that is partially occluded (e.g., by pen marking or anatomic ink). |
|
In our applications, we combine this model with other artifact detection models to build a [scene graph](https://en.wikipedia.org/wiki/Scene_graph) representation of slide content -- including overall tissue area, as well as other overlay masks like cell or tissue type, artifact presence, etc. |
|
|
|
## Usage |
|
|
|
As an example of how to read in these images in Python with `cv2`: |
|
|
|
```python |
|
from typing import Iterable, Literal, Tuple |
|
from pathlib import Path |
|
|
|
import cv2 |
|
import numpy as np |
|
import numpy.typing as npt |
|
|
|
_DATA_PATH = Path("/path/to/tcga-tissue-segmentation") |
|
|
|
def get_image_and_mask(slide_name: str) -> Tuple[npt.NDArray[np.uint8], npt.NDArray[np.bool_]]: |
|
image_png = slide_name + ".png" |
|
image_path = _DATA_PATH / "images" / image_png |
|
mask_path = _DATA_PATH / "masks" / image_png |
|
# image is a numpy array of RGB values 0-255 (H x W x 3) |
|
image = cv2.cvtColor(cv2.imread(str(image_path)), cv2.COLOR_BGR2RGB) |
|
# mask is a numpy array of booleans (H x W) where True represents tissue presence and False represents tissue absence |
|
mask = cv2.imread(str(mask_path), cv2.IMREAD_GRAYSCALE) > 0 |
|
return image, mask |
|
|
|
def get_images_and_masks(split: Literal["train", "test"]) -> Iterable[Tuple[npt.NDArray[np.uint8], npt.NDArray[np.bool_]]]: |
|
with open(_DATA_PATH / f"{split}-slides.txt", "rt") as f: |
|
slide_names = f.read().splitlines() |
|
for slide_name in slide_names: |
|
yield get_image_and_mask(slide_name) |
|
``` |
|
|
|
## Acknowledgements |
|
|
|
We are grateful to the TCGA Research Network from which the slides originally used here are sourced. |
|
|
|
Per their citation request (https://www.cancer.gov/ccg/research/genome-sequencing/tcga/using-tcga-data/citing), |
|
|
|
> The results shown here are in whole or part based upon data generated by the TCGA Research Network: https://www.cancer.gov/tcga. |