from typing import Any, List, Tuple, Literal
from pathlib import Path
import numpy as np
from PIL import Image
from typing import Union

num = Union[float, int]

class Reader:
    path: Union[str, Path]
    def __init__(self, path: Union[str, Path]): ...
    @property
    def level_count(self) -> int: ...
    def base_mpp(self) -> float: ...
    def mpp(self, level: int = 0) -> float: ...
    def dimension(self, level: int = 0) -> Tuple[int, int]: ...
    def downsample(self, level: int = 0) -> float: ...
    def region(self, level: int, left: num, up: num, right: num, down: num) -> np.ndarray: ...
    def thumb(self, level: int = -1) -> np.ndarray: ...

class AsapSlide(Reader): ...
class OpenSlide(Reader): ...
class ImageSlide(Reader): ...
class NumpySlide(Reader): ...
class TiffSlide(Reader): ...

def load(path: Union[str, Path]) -> Reader: ...

class SingleDataset:
    def __init__(self, source: Union[str, Path, np.ndarray, Image.Image, Reader], samples: List[Tuple[int, int, int, int, int]]): ...
    def __len__(self): ...
    def __getitem__(self, item): ...
    def __iter__(self): ...
    def load(self, level: int, left: int, up: int, right: int, down: int) -> Any:...

def trans_norm(target_input: np.ndarray, channel_dim: int = 1) -> np.ndarray: ...
def trans_linear(target_input: np.ndarray) -> np.ndarray: ...
def sample_image(image: Union[np.ndarray, Image.Image], kernel_size: int, step: int)-> List[Tuple[int, int, int, int, int]]: ...
def sample_slide(reader: Reader, level: int, kernel_size: int, step: int, mask: np.ndarray = None) -> List[Tuple[int, int, int, int, int]]: ...
def find_sites(sight: Tuple[int, int, int, int], k: int, s: int, mode: Literal["overshoot", "in_bounds", "uniform"] = 'uniform', mask: np.ndarray = None) -> List[Tuple[int, int]]: ...

def crop(slide: Reader, center: Tuple[float, float], size: Union[int, Tuple[int, int]], degree: float = 0, scale: float = 1, nearest: bool = True, pad_item: Union[int, List[int]] = 0) -> np.ndarray: ...
