Napari pyramid precomputation and saving to zarr

So I have been reading all the exciting work and the tutorials on the napari website about precomputing pyramids and viewing them in napari. Which looks great but I am a little confused on a couple of aspects.

There looks like an active movement to make this work in zarr and Ive even seen a multilevel octree implementation underway but I also keep reading (including the zarr tutorials) how pyramids have been saved into a zarr file format. Now I am a bit confused, I would think that that each pyramid would need to be saved into a seperate group and not as I would think as I would save using dask, as da.out_zarr(..........)? So how are people implementing pyramids with an example would be really great?

Hi @Sh4zKh4n that’s great that you’re checking out napari and excited about zarr pyramids. As you note there are a couple different approaches people are exploring right now.

For napari we can handle a list of arrays as inputs to make a pyramid so you could something as simple as

pyramid = [da.from_zarr('my_file.zarr' + '/' + str(i)) for i in range(10)]
napari.view_image(pyramid)

and have each level be it’s own array.

@joshmoore from the OME team has been working on an ome-zarr spec which has a multiscale property, see here https://github.com/ome/omero-ms-zarr/blob/1ca87a0c7117a642a52994bbbc8d805a15916094/spec.md that you can then use the ome-zarr-py napari plugin to read https://github.com/ome/ome-zarr-py#napari-plugin and would probably be my recommended approach right now.

@manzt has also done some cool work here getting zarr backed tiffs into napari which might be a source of inspiration too!! https://github.com/manzt/napari-lazy-openslide

Hope that helps!!

3 Likes