MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / _get_patch

Method _get_patch

monai/data/wsi_reader.py:272–288  ·  view source on GitHub ↗

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
    )

Source from the content-addressed store, hash-verified

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

Callers 1

get_dataMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected