:py:mod:`wsinfer.modellib.data` =============================== .. py:module:: wsinfer.modellib.data Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: wsinfer.modellib.data.WholeSlideImagePatches .. py:class:: WholeSlideImagePatches(wsi_path: str | pathlib.Path, patch_path: str | pathlib.Path, transform: Callable[[PIL.Image.Image], torch.Tensor] | None = None) Bases: :py:obj:`torch.utils.data.Dataset` Dataset of one whole slide image. This object retrieves patches from a whole slide image on the fly. :param wsi_path: Path to whole slide image file. :type wsi_path: str, Path :param patch_path: Path to npy file with coordinates of input image. :type patch_path: str, Path :param transform: A callable to modify a retrieved patch. The callable must accept a PIL.Image.Image instance and return a torch.Tensor. :type transform: callable, optional .. py:method:: worker_init(worker_id: int | None = None) -> None .. py:method:: __len__() -> int .. py:method:: __getitem__(idx: int) -> tuple[PIL.Image.Image | torch.Tensor, torch.Tensor]