import zarr
import vizarr
import fsspec
import requests
import zipfile
import io
from pathlib import Path
from typing import Optional
def zarr_from_zip(zarr_root: str, row: Optional[str]=None, col: Optional[str]=None):
with requests.get(zarr_root, stream=True) as r:
r.raise_for_status()with zipfile.ZipFile(io.BytesIO(r.content)) as z:
z.extractall()= Path(zarr_root).stem
stem if (row is not None) & (col is not None):
= f"{stem}/{row}/{col}"
zarr_url else:
= stem
zarr_url = fsspec.get_mapper(zarr_url)
store = zarr.open(store, mode='r')
root return(root)
View OME-ZARR plates in Vizarr
This tutorial demonstrates how to load data generated with Fractal into Vizarr.
= "https://zenodo.org/records/13998404/files/operetta_plate.zarr.zip"
zip_url = zarr_from_zip(zip_url, "C", "3") zarr_plate
= vizarr.Viewer()
viewer =zarr_plate)
viewer.add_image(source viewer