Extracts and returns a patch image form the whole slide image. Args: wsi: a whole slide image object loaded from a file or a lis of such objects location: (top, left) tuple giving the top left pixel in the level 0 reference frame. Defaults to (0, 0).
(
self, wsi, location: tuple[int, int], size: tuple[int, int], level: int, dtype: DtypeLike, mode: str
)
| 270 | |
| 271 | @abstractmethod |
| 272 | def _get_patch( |
| 273 | self, wsi, location: tuple[int, int], size: tuple[int, int], level: int, dtype: DtypeLike, mode: str |
| 274 | ) -> np.ndarray: |
| 275 | """ |
| 276 | Extracts and returns a patch image form the whole slide image. |
| 277 | |
| 278 | Args: |
| 279 | wsi: a whole slide image object loaded from a file or a lis of such objects |
| 280 | location: (top, left) tuple giving the top left pixel in the level 0 reference frame. Defaults to (0, 0). |
| 281 | size: (height, width) tuple giving the patch size at the given level (`level`). |
| 282 | If None, it is set to the full image size at the given level. |
| 283 | level: the level number. |
| 284 | dtype: the data type of output image. |
| 285 | mode: the output image mode, 'RGB' or 'RGBA'. |
| 286 | |
| 287 | """ |
| 288 | raise NotImplementedError(f"Subclass {self.__class__.__name__} must implement this method.") |
| 289 | |
| 290 | def _get_metadata( |
| 291 | self, wsi, patch: NdarrayOrTensor, location: tuple[int, int], size: tuple[int, int], level: int |