Skip to main content

iohub

Status Docs Tests
Package PyPI Python
Meta SPEC 0 Hatch uv Ruff prek License
Cite DOI

N-dimensional bioimaging produces data and metadata in various formats, and iohub aims to become a unified Python interface to the most common formats used at the Biohub and in the broader imaging community.

Project status: Active development. iohub is alpha software, and its APIs and file-format support may change between releases.

Supported formats

Read

  • OME-Zarr (OME-NGFF v0.5, OME-NGFF v0.4)
  • Micro-Manager TIFF sequence, OME-TIFF (MMStack), and NDTiff datasets
  • Nikon ND2 (via nd2)
  • Custom data formats generated by Biohub microscopes
    • Supported: Falcon (PTI), Dorado (ClearControl), Dragonfly (OpenCell OME-TIFF), Mantis (NDTiff), Osprey (ND2)
    • WIP: DaXi

Write

Quick start

Installation

Install iohub from PyPI:

pip install iohub

With optional TensorStore support:

pip install "iohub[tensorstore]"

Or install the latest development version:

pip install git+https://github.com/czbiohub-sf/iohub.git

For development setup, see the contributing guide.

Command-line interface

To check if iohub works for a dataset:

iohub info /path/to/data/

The CLI can show a summary of the dataset, point to relevant Python calls, and convert other data formats to the latest OME-Zarr. See the full CLI help message by typing iohub or iohub [command] --help in the terminal.

Working with OME-Zarr

Load and modify an example OME-Zarr dataset:

import numpy as np
from iohub import open_ome_zarr

with open_ome_zarr(
    "20200812-CardiomyocyteDifferentiation14-Cycle1.zarr",
    mode="r",
    layout="auto",
) as dataset:
    dataset.print_tree()  # prints the hierarchy of the zarr store
    channel_names = dataset.channel_names
    print(channel_names)
    img_array = dataset[
        "B/03/0/0"
    ]  # lazy Zarr array for the raw image in the first position
    raw_data = img_array.numpy()  # loads a CZYX 4D array into RAM
    print(raw_data.mean())  # does some analysis

with open_ome_zarr(
    "max_intensity_projection.zarr",
    mode="w-",
    layout="hcs",
    channel_names=channel_names,
) as dataset:
    new_fov = dataset.create_position(
        "B", "03", "0"
    )  # creates fov with the same path
    new_fov["0"] = raw_data.max(axis=1).reshape(
        (1, 1, 1, *raw_data.shape[2:])
    )  # max projection along Z axis and prepend dims to 5D
    dataset.print_tree()  # checks that new data has been written

For more about API usage, refer to the documentation and the example scripts.

Reading Micro-Manager TIFF data

Read a directory containing a TIFF dataset:

from iohub import read_images

reader = read_images("/path/to/data/")
print(reader)

Why iohub?

This project is inspired by the existing Python libraries for bioimaging data I/O, including ome-zarr-py, tifffile and aicsimageio. They support some of the most widely adopted and/or promising formats in microscopy, such as OME-Zarr and OME-TIFF.

iohub bridges the gaps among them with the following features:

  • Efficient reading of data in various TIFF-based formats produced by the Micro-Manager/Pycro-Manager acquisition stack.
  • Efficient and customizable conversion of data and metadata from TIFF to OME-Zarr.
  • Pythonic and atomic access of OME-Zarr data with parallelized analysis in mind.
  • OME-Zarr metadata is automatically constructed and updated for writing, and verified against the specification when reading.
  • Adherence to the latest OME-NGFF specification (v0.5) whenever possible.

Community

Read the contributing guide before proposing a change. Participation in iohub is governed by the Contributor Covenant Code of Conduct.

Security

Do not report security vulnerabilities in public issues. Follow our security policy to report them privately.

Metadata

Release files for iohub 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iohub 0.4.1
File Size Uploaded Provenance Actions
iohub-0.4.1.tar.gz 406.2 kB Without provenance Details for iohub-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iohub 0.4.1
File Interpreter ABI Platform Actions
iohub-0.4.1-py3-none-any.whl Python 3 none any Details for iohub-0.4.1-py3-none-any.whl

Total release size: 542.3 kB

Release files / iohub-0.4.1.tar.gz

Download URL iohub-0.4.1.tar.gz
Size 406.2 kB
Tags Source
SHA-256 checksum
How to use checksums
181a0741b5d3c61dc5087d62801b54023c2cfb745005dc5e97552ddd25020764
BLAKE2b-256 checksum
How to use checksums
059a0366e7943e9e6a11948df40512cd4fb9f1bdce5ec3a789b6919f39c91f81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / iohub-0.4.1-py3-none-any.whl

Download URL iohub-0.4.1-py3-none-any.whl
Size 136.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8088af0077dc6b8b31bf8dbd0dd4780eed4330d970f455bab7553debfbab194
BLAKE2b-256 checksum
How to use checksums
7e622a0a2e17f265bf8646cfe11ede5ac7a89039142f6e5f37b8cfe512b14e18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for iohub 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page