napari-lazy-openslide
napari-lazy-openslide copied to clipboard
OpenSlideStore serialization
This PR makes the OpenSlideStore objects seriazable, so that they can be used in a Dask cluster. Serialization is implemented in setstate and getstate.
At this moment, this code:
from dask.distributed import Client
c = Client()
import dask.array as da
import zarr
from napari_lazy_openslide import OpenSlideStore
store = OpenSlideStore('../data/normal_001.tif')
grp = zarr.open(store, mode="r")
datasets = grp.attrs["multiscales"][0]["datasets"]
pyramid = [da.from_zarr(store, component=d["path"]) for d in datasets]
pyramid[0][:10,:10].compute()
raises TypeError: ('Could not serialize object of type Array', "<zarr.core.Array '/0' (221184, 97792, 4) uint8 read-only>").
This PR solves the issue.