ome-zarr-py
Activate the conda environment ngff_workshop
:
Browse into the example data directory and then access Python:
Import the relevant tools
import ome_zarr, zarr, pprint, os
from ome_zarr.reader import Reader
from ome_zarr.io import parse_url
Read local and remote OME-Zarrs
# local_path = "./6001240.zarr"
remote_path = "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0062A/6001240.zarr"
reader = Reader(parse_url(remote_path))
# Note here that 'parse_url' can parse both remote and local urls.
Note that ome-zarr-py uses the term 'node' for different zarr groups and reads them in a flat list.
Print the node information per resolution level:
nodes = list(reader())
for idx, node in enumerate(nodes):
print(f"The node at the level {idx} is {node}")
Get the data and metadata of the top-level node
Check the 'data' instance to examine the array shape and the chunks for each resolution layer
for idx, array in enumerate(dataset):
print(f"The array {idx} is a {type(array)} and has shape {array.shape} and has chunks with shape {array.chunksize}")
Print the axis types and units of the arrays using the metadata instance
Print the voxel sizes per resolution level (and any other voxel transforms that may exist)