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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iohub-0.3.11.tar.gz (338.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iohub-0.3.11-py3-none-any.whl (108.1 kB view details)

Uploaded Python 3

File details

Details for the file iohub-0.3.11.tar.gz.

File metadata

  • Download URL: iohub-0.3.11.tar.gz
  • Upload date:
  • Size: 338.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for iohub-0.3.11.tar.gz
Algorithm Hash digest
SHA256 b8de0698d4dcd25671858abb6d80875b643170780ccb62588c04cdf04e0cd42b
MD5 9172d94eef33c8e969bfcd9a219061c6
BLAKE2b-256 a5ccb69b2f71f526b1e556602e8346001e0c8fc93af0e2f2c939254d9067b812

See more details on using hashes here.

File details

Details for the file iohub-0.3.11-py3-none-any.whl.

File metadata

  • Download URL: iohub-0.3.11-py3-none-any.whl
  • Upload date:
  • Size: 108.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for iohub-0.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 827d94ef028023fbdfe9d30cfb2be3629ccfdb4053ec898bcd8da20040f23fea
MD5 6fd022d2f9fa80c08f5e4573ba3f1317
BLAKE2b-256 f4466ebbe269d557941eedf6ec1518f10a24a29e4d98b8057a4f05b51191c7bd

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.11 This release

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.3.post1

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page