Zarr Tile Write Strategy
Tile Zarr writing strategy.
ZarrTileHandler
A class handling metadata creation, cropping, restoring and stitching of a tile.
Parameters:
-
region(ImageRegionData) –The image region data containing the tile information.
Attributes:
-
original_chunks(Sequence[int] | None) –Original chunks of the array, if available.
-
original_shards(Sequence[int] | None) –Original shards of the array, if available.
-
crop_size(Sequence[int]) –Size of the tile to crop.
-
crop_coords(Sequence[int]) –Coordinates where to crop the tile.
-
stitch_coords(Sequence[int]) –Coordinates in the array for stitching the tile.
-
sample_idx(int) –Sample index of the tile.
-
tile(NDArray) –Tile data.
crop
property
Cropped tile array.
Returns:
-
NDArray–Cropped tile array.
crop_slices
property
pred_array_axes
property
Prediction array axes after restoring axes.
Returns:
-
str–Axes of the prediction array after restoring axes.
pred_array_shape
property
pred_chunks
property
pred_shards
property
restored_crop
property
Cropped tile array with restored axes.
Returns:
-
NDArray–Cropped tile array with restored axes.
stitch_slices
property
__init__(region)
Initialize the TileHandler with the given ImageRegionData.
Parameters:
-
region(ImageRegionData) –The image region data containing the tile information.
ZarrTileWriteStrategy
Bases: WriteStrategy
Zarr tile writer strategy.
This writer creates zarr files, groups and arrays as needed and writes tiles into the appropriate locations.
__init__()
Constructor.
set_source_base(source_base)
write_batch(dirpath, predictions)
Write all tiles to a Zarr file.
Parameters:
-
dirpath(Path) –Path to directory to save predictions to.
-
predictions(list[ImageRegionData]) –Decollated predictions.
write_tile(dirpath, region)
Write cropped tile to zarr array.
Parameters:
-
dirpath(Path) –Path to directory to save predictions to.
-
region(ImageRegionData) –Image region data containing tile information.