Skip to content

Create an OME-Zarr image

Convert a numpy array into an OME-Zarr image.

Convert a numpy array into an OME-Zarr image with ngio, then attach a ROI table to it. By the end you will have an on-disk container that the other tutorials read from.

For larger conversion jobs — vendor formats, multi-file acquisitions, whole plates — reach for the converter tooling library ome-zarr-converters-tools.

Step 1: convert an array to OME-Zarr

Start by converting a sample image from skimage to OME-Zarr format.

import skimage

fig, ax = plt.subplots(figsize=(6, 6))
ax.imshow(skimage.data.human_mitosis(), cmap="gray")
ax.axis("off")
print(figure_html(fig))
2026-08-11T12:15:56.147063 image/svg+xml Matplotlib v3.11.0, https://matplotlib.org/
from ngio import create_ome_zarr_from_array

ome_zarr = create_ome_zarr_from_array(
    store="./data/human_mitosis.zarr",
    array=skimage.data.human_mitosis(),
    pixelsize=0.1,  # Just a guess
    overwrite=True,
)
print(ome_zarr)
OmeZarrContainer(levels=5)

Step 2: add a ROI table

Attaching ROIs to an OME-Zarr image lets you retrieve those regions later. Add them with ngio as follows.

# create a roi for the whole image
roi_table = ome_zarr.build_image_roi_table(name="image_roi")
ome_zarr.add_table("image_roi_table", roi_table, overwrite=True)

Next steps