Tiles
Fill in a module description here
stitch
stitch (tiles_list:List[numpy.ndarray], x_list:List[int], y_list:List[int], iou_threshold:float)
Stitch tile masks into a global mask using IoU-based label matching.
Type | Details | |
---|---|---|
tiles_list | List | List of 2D mask arrays for each tile. |
x_list | List | X-coordinates of tiles’ top-left corners. |
y_list | List | Y-coordinates of tiles’ top-left corners. |
iou_threshold | float | Minimum IoU threshold to match cell labels between overlapping tiles. |
Returns | ndarray | Stitched mask with consistent global labels. |
save
save (tiles:List[numpy.ndarray], filename:str, x:List[int], y:List[int], output_dir:str)
Save a list of image tiles to disk with filenames encoding their positions.
Type | Details | |
---|---|---|
tiles | List | List of image tiles to save. |
filename | str | Original filename to derive base name for tiles. |
x | List | X-coordinates corresponding to each tile. |
y | List | Y-coordinates corresponding to each tile. |
output_dir | str | Directory to save the tile files. |
Returns | None |
split
split (image:numpy.ndarray, tile_size:Tuple[int,int], overlap:int, tile_all:bool=True)
Split an image into tiles of specified size with a given overlap.
Type | Default | Details | |
---|---|---|---|
image | ndarray | Input image array (2D grayscale or 3D color). | |
tile_size | Tuple | Height and width of each tile, e.g., (128, 128). | |
overlap | int | Number of pixels each tile overlaps adjacent tiles. | |
tile_all | bool | True | If True, include partial edge tiles to cover the entire image. Default is True. |
Returns | Tuple | Array of shape (N, tile_h, tile_w[, C]) containing all tiles. |
count
count (image:numpy.ndarray, t:int=1024, v:float=0.1)
Calculate the number of tiles in the vertical and horizontal directions.
Type | Default | Details | |
---|---|---|---|
image | ndarray | Input image array. | |
t | int | 1024 | Length (in pixels) of each square tile. Default is 1024. |
v | float | 0.1 | Fractional overlap between tiles (e.g., 0.1 for 10%). Default is 0.1. |
Returns | Tuple | Number of tiles along the vertical axis (height). |