stlearn.pp.tiling¶
- stlearn.pp.tiling(adata: AnnData, out_path: Path | str = './tiling', library_id: str | None = None, crop_size: int = 40, target_size: int = 299, img_fmt: str = 'JPEG', quality: int = 75, verbose: bool = False, copy: bool = False) AnnData | None[source]¶
Tiling H&E images to small tiles based on spot spatial location.
- Parameters:
adata (AnnData) – Annotated data matrix containing spatial information.
out_path (Path or str, default "./tiling") – Path to save spot image tiles.
library_id (str, optional) – Library id stored in AnnData. If None, uses first available library.
crop_size (int, default 40) – Size of tiles to crop from original image.
target_size (int, default 299) – Target size for resized tiles (input size for CNN).
img_fmt (str, default "JPEG") – Image format (‘JPEG’ or ‘PNG’).
quality (int, default 75) – JPEG quality (1-100). Only used for JPEG format.
verbose (bool, default False) – Enable verbose output.
copy (bool, default False) – Return a copy instead of modifying adata in-place.
- Returns:
Depending on copy, returns or updates adata with the following fields.
**tile_path** (adata.obs field) – Saved path for each spot image tiles