save_to_cache

save_to_cache(canvas, count, canvas_zarr, count_zarr, save_path='temp.zarr', zarr_dataset_name=('canvas', 'count'), *, verbose=True)[source]

Incrementally save computed canvas and count arrays to Zarr cache.

This function computes the given Dask arrays (canvas and count) row-chunks one at a time to avoid materializing the full dask arrays in memory. If the datasets do not exist, they are created using the chunk shapes from the first block.

Parameters:
  • canvas (da.Array) – Dask array representing image or feature data.

  • count (da.Array) – Dask array representing count or normalization data.

  • canvas_zarr (zarr.Array) – Existing Zarr dataset for canvas data. If None, a new one is created.

  • count_zarr (zarr.Array) – Existing Zarr dataset for count data. If None, a new one is created.

  • save_path (str | Path) – Path to the Zarr group for saving datasets. Defaults to “temp.zarr”.

  • zarr_dataset_name (tuple[str, str]) – Tuple of name for zarr dataset to save canvas and count. Defaults to (“canvas”, “count”).

  • verbose (bool) – Whether to display progress bar.

Returns:

Updated Zarr datasets for canvas and count arrays.

Return type:

tuple[zarr.Array, zarr.Array]