ratiopath.tiling.tilers
Dims = TypeVarTuple('Dims')
module-attribute
grid_tiles(slide_extent, tile_extent, stride, last='drop')
Generates tiles for the given slide based on its size, tile size, and stride.
The function yields tile coordinates in row-major order, iterating first over the x-axis (e.g. (0,0,...), (1,0,...), (2,0,...)) before incrementing the y-axis (0,1,...), (1,1,...), etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
slide_extent
|
tuple[int, *Dims]
|
The dimensions of the slide in pixels. |
required |
tile_extent
|
tuple[int, *Dims]
|
The dimensions of the tile in pixels. |
required |
stride
|
tuple[int, *Dims]
|
The stride between tiles in pixels. |
required |
last
|
Literal['shift', 'drop', 'keep']
|
The strategy to handle the last tile when it does not fit the stride. - "shift": Shift the last tile to the left and up to fit the stride. - "drop": Drop the last tile if it does not fit the stride. - "keep": Keep the last tile even if it does not fit the slide. |
'drop'
|
Returns:
Type | Description |
---|---|
Iterator[NDArray[int64]]
|
An iterator of numpy arrays containing the tile coordinates. |
Source code in ratiopath/tiling/tilers.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|