Skip to content

Tiled Patching

Source

Tiled patching utilities.

extract_tiles(arr, tile_size, overlaps)

Generate tiles from the input array with specified overlap.

The tiles cover the whole array. The method returns a generator that yields tuples of array and tile information, the latter includes whether the tile is the last one, the coordinates of the overlap crop, and the coordinates of the stitched tile.

Input array should have shape SC(Z)YX, while the returned tiles have shape C(Z)YX, where C can be a singleton.

Parameters:

Name Type Description Default
arr ndarray

Array of shape (S, C, (Z), Y, X).

required
tile_size Union[list[int], tuple[int]]

Tile sizes in each dimension, of length 2 or 3.

required
overlaps Union[list[int], tuple[int]]

Overlap values in each dimension, of length 2 or 3.

required

Yields:

Type Description
Generator[tuple[ndarray, TileInformation], None, None]

Tile generator, yields the tile and additional information.