{"library":"ome-zarr","title":"OME-Zarr Python Library","description":"ome-zarr is a Python library providing an implementation of images in Zarr files according to the OME-Zarr specification. It enables reading and writing bioimaging data stored in the OME-Zarr format, supporting multiscale images, metadata, and various Zarr features like chunking and compression. The current version is 0.16.0, with a release cadence that sees new features and bug fixes approximately every few months, often tied to updates in the OME-Zarr specification itself.","language":"python","status":"active","last_verified":"Mon May 18","install":{"commands":["pip install ome-zarr"],"cli":null},"imports":["from ome_zarr.io import parse_url","from ome_zarr.io import Writer","from ome_zarr.reader import Reader","from ome_zarr.writer import write_image","from ome_zarr.writer import write_multiscale","from ome_zarr.scale import scale_pyramid"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import numpy as np\nimport zarr\nimport os\nimport shutil\nfrom ome_zarr.io import parse_url\nfrom ome_zarr.writer import write_image\nfrom ome_zarr.reader import Reader\n\n# Define a path for the OME-Zarr store\nstore_path = 'my_ome_zarr_image.zarr'\n\n# Clean up previous store if it exists for a fresh run\nif os.path.exists(store_path):\n    shutil.rmtree(store_path)\n\n# 1. Create a dummy numpy array (e.g., a 5D image: T, C, Z, Y, X)\n# OME-Zarr typically uses this dimension order or a subset.\n# Here: 1 Time point, 2 Channels, 3 Z-slices, 64 Y, 64 X\ndata = np.zeros((1, 2, 3, 64, 64), dtype=np.uint16)\ndata[0, 0, 1, 10:20, 10:20] = 100 # Channel 0, Z-slice 1\ndata[0, 1, 2, 30:40, 30:40] = 200 # Channel 1, Z-slice 2\n\n# 2. Write the numpy array to an OME-Zarr store\n# `parse_url` creates an FSSpec store object.\n# `zarr.group` creates the root Zarr group, overwriting if it exists.\nstorage = parse_url(store_path, mode='w').store\nroot_group = zarr.group(storage, overwrite=True)\n\n# `write_image` handles the OME-Zarr metadata and array layout.\nwrite_image(\n    image=data,\n    group=root_group,\n    axes=['t', 'c', 'z', 'y', 'x'], # Specify axes order, crucial for OME-Zarr\n    chunks=(1, 1, 1, 32, 32) # Optional: define Zarr chunking\n)\n\nprint(f\"OME-Zarr image written to: {store_path}\")\n\n# 3. Read the OME-Zarr image\nreader = Reader(parse_url(store_path))\n\n# Get the list of nodes (images) in the Zarr store. Typically one at the root.\nnodes = list(reader())[0] \n\n# Access image data for the highest resolution (level 0)\nimage_data_level_0 = nodes.data[0]\n\n# Access OME metadata (a dictionary parsed from the OME-XML JSON)\nome_metadata = nodes.metadata\n\nprint(f\"Successfully read OME-Zarr image from: {store_path}\")\nprint(f\"Shape of data (level 0): {image_data_level_0.shape}\")\nprint(f\"OME metadata keys: {ome_metadata.keys()}\")\n\n# Clean up the created Zarr store (optional but good practice for examples)\nshutil.rmtree(store_path)\nprint(f\"Cleaned up: {store_path}\")\n","lang":"python","description":"This quickstart demonstrates how to create a dummy 5D NumPy array, write it to a local OME-Zarr store using `ome_zarr.writer.write_image`, and then read the data and its associated OME metadata back using `ome_zarr.reader.Reader`. It highlights the use of `parse_url` for store creation and the importance of specifying `axes` during writing.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-18","installed_version":"0.10.2","pypi_latest":"0.16.0","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":50,"avg_install_s":19,"avg_import_s":2.76,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"ome-zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"ome-zarr","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":20,"import_time_s":1.66,"mem_mb":32.9,"disk_size":"399M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"ome-zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"ome-zarr","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":17.9,"import_time_s":3.29,"mem_mb":41.2,"disk_size":"423M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"ome-zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"ome-zarr","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":16.3,"import_time_s":3.77,"mem_mb":39.6,"disk_size":"406M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"ome-zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"ome-zarr","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":16.5,"import_time_s":3.28,"mem_mb":39.2,"disk_size":"404M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"ome-zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"ome-zarr","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":24.3,"import_time_s":1.82,"mem_mb":32.4,"disk_size":"410M"}]}}