Skip to content

Commit 6df8565

Browse files
authored
📝 Add WSIReader Type Annotation to input_img for PatchExtrator
- Add `WSIReader` Type Annotation to `input_img` for `PatchExtrator`
1 parent 03e7491 commit 6df8565

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tiatoolbox/tools/patchextraction.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ExtractorParams(TypedDict, total=False):
3737
3838
"""
3939

40-
input_img: str | Path | np.ndarray
40+
input_img: str | Path | np.ndarray | wsireader.WSIReader
4141
locations_list: np.ndarray | DataFrame | str | Path
4242
patch_size: int | tuple[int, int]
4343
resolution: Resolution
@@ -57,7 +57,7 @@ class PointsPatchExtractorParams(TypedDict):
5757
5858
"""
5959

60-
input_img: str | Path | np.ndarray
60+
input_img: str | Path | np.ndarray | wsireader.WSIReader
6161
locations_list: np.ndarray | DataFrame | str | Path
6262
patch_size: int | tuple[int, int]
6363
resolution: Resolution
@@ -74,7 +74,7 @@ class SlidingWindowPatchExtractorParams(TypedDict):
7474
7575
"""
7676

77-
input_img: str | Path | np.ndarray
77+
input_img: str | Path | np.ndarray | wsireader.WSIReader
7878
patch_size: int | tuple[int, int]
7979
resolution: Resolution
8080
units: Units
@@ -109,7 +109,7 @@ class PatchExtractor(PatchExtractorABC):
109109
"""Class for extracting and merging patches in standard and whole-slide images.
110110
111111
Args:
112-
input_img(str, Path, :class:`numpy.ndarray`):
112+
input_img(str, Path, :class:`numpy.ndarray`, :class:`WSIReader`):
113113
Input image for patch extraction.
114114
patch_size(int or tuple(int)):
115115
Patch size tuple (width, height).
@@ -186,7 +186,7 @@ class PatchExtractor(PatchExtractorABC):
186186

187187
def __init__(
188188
self: PatchExtractor,
189-
input_img: str | Path | np.ndarray,
189+
input_img: str | Path | np.ndarray | wsireader.WSIReader,
190190
patch_size: int | tuple[int, int],
191191
input_mask: str | Path | np.ndarray | wsireader.VirtualWSIReader | None = None,
192192
resolution: Resolution = 0,
@@ -574,7 +574,7 @@ class SlidingWindowPatchExtractor(PatchExtractor):
574574
"""Extract patches using sliding fixed sized window for images and labels.
575575
576576
Args:
577-
input_img(str, pathlib.Path, :class:`numpy.ndarray`):
577+
input_img(str, pathlib.Path, :class:`numpy.ndarray`, :class:`WSIReader`):
578578
Input image for patch extraction.
579579
patch_size(int or tuple(int)):
580580
Patch size tuple (width, height).
@@ -627,7 +627,7 @@ class SlidingWindowPatchExtractor(PatchExtractor):
627627

628628
def __init__(
629629
self: SlidingWindowPatchExtractor,
630-
input_img: str | Path | np.ndarray,
630+
input_img: str | Path | np.ndarray | wsireader.WSIReader,
631631
patch_size: int | tuple[int, int],
632632
input_mask: str | Path | np.ndarray | wsireader.VirtualWSIReader | None = None,
633633
resolution: Resolution = 0,
@@ -665,7 +665,7 @@ class PointsPatchExtractor(PatchExtractor):
665665
"""Extracting patches with specified points as a centre.
666666
667667
Args:
668-
input_img(str, pathlib.Path, :class:`numpy.ndarray`):
668+
input_img(str, pathlib.Path, :class:`numpy.ndarray`: class:`WSIReader`):
669669
Input image for patch extraction.
670670
locations_list(ndarray, pd.DataFrame, str, pathlib.Path):
671671
Contains location and/or type of patch. This can be path to
@@ -709,7 +709,7 @@ class PointsPatchExtractor(PatchExtractor):
709709
def __init__(
710710
# pylint: disable=PLR0913
711711
self: PointsPatchExtractor,
712-
input_img: str | Path | np.ndarray,
712+
input_img: str | Path | np.ndarray | wsireader.WSIReader,
713713
locations_list: np.ndarray | DataFrame | str | Path,
714714
patch_size: int | tuple[int, int] = (224, 224),
715715
resolution: Resolution = 0,

0 commit comments

Comments
 (0)