The tissue segmentation model identifies tissue regions in a slide, letting you discard background tiles before running H-Optimus or M-Optimus. It is bundled with both model packages.
Specifications
| Property | Value |
|---|
| Task | Binary tissue mask |
| Input | 512×512 RGB tile at 8.0 µm/px |
| Output | Flattened binary mask of length 262,144 (512×512), values 0.0 or 1.0 |
| SageMaker dispatch | model_name: "tissue-seg", mode: "prediction" |
| Recommended instance | ml.g5.xlarge |
Run segmentation at the coarse 8.0 µm/px resolution first; it is cheap relative to per-tile feature extraction at 0.5 µm/px and can dramatically reduce the number of tiles you embed.
Reshaping the output
The endpoint returns a flat array. Reshape it to a 512×512 mask:
import numpy as np
mask = np.array(result["output"]).reshape(512, 512)
Deploy
Tissue segmentation has no separate deployment — it is bundled with both the H-Optimus and M-Optimus packages and served from the same endpoint. Deploy either model (see the Deployment overview) and tissue-seg is available alongside it.
Using it in a pipeline
In practice you rarely call this endpoint directly — the Bioptimus SDK’s tissue mask provider generates and caches masks for you, then filters tiles before feature extraction or prediction. See Spatial transcriptomics and the Bioptimus SDK.
Once masks are generated, bioptimus.utils.plot_slide_and_mask renders the mask next to the slide thumbnail for a quick sanity check:
from bioptimus import utils
record = cohort[0]
utils.plot_slide_and_mask(record.wsi_path, record.mask_path, threshold=0.5)