lazyslide.seg.tissue#
- tissue(wsi, *, model='pathprofiler', level=None, mpp=None, bbox_ratio=0.05, min_area=0.001, min_hole_area=1e-05, detect_holes=True, threshold=0.5, device=None, amp=None, autocast_dtype=None, key_added='tissues')#
Perform tissue segmentation powered by a deep learning model.
- Supported models:
“grandqc”: [Weng et al., 2024]. Runs on mpp=10.
“pathprofiler”: [Haghighat et al., 2022]. Runs on mpp=2.5.
“hest”: “https://huggingface.co/MahmoodLab/hest-tissue-seg”. Runs on mpp=1.
If you encounter a memory issue, please set a higher mpp value.
- Parameters:
- wsi
wsidata.WSIData The whole slide image.
- model{“grandqc”, “pathprofiler”, “hest”}, default: “pathprofiler”
The model to use for tissue segmentation.
- levelint, default: None
The level to segment the tissue, mutually exclusive with mpp.
- mppfloat, default: None
The mpp level to segment the tissue, mutually exclusive with level.
- bbox_ratiofloat, default: 0.05
The ratio of the bounding box to filter the false positive tissue polygons.
- min_areafloat, default: 1e-3
The minimum area of the tissue polygon.
- min_hole_areafloat, default: 1e-5
The minimum area of the hole in the tissue polygon.
- detect_holesbool, default: True
Whether to detect holes in the tissue polygons.
- thresholdfloat, default: 0.5
The probability threshold to consider a pixel as tissue.
- devicestr, default: None
The device to run the model.
- ampbool, optional, default: False
Whether to use automatic mixed precision.
- autocast_dtypetorch.dtype, optional, default: torch.float16
The dtype for automatic mixed precision.
- key_addedstr, default: ‘tissues’
The key to add the tissue polygons.
- wsi