Skip to main content

Pytest

ndbioimage

Exposes (bio) images as a numpy ndarray-like object, but without loading the whole image into memory, reading from the file only when needed. Some metadata is read and stored in an ome structure. Additionally, it can automatically calculate an affine transform that corrects for chromatic aberrations etc. and apply it on the fly to the image.

Currently, it supports imagej tif files, czi files, micromanager tif sequences and anything bioformats can handle.

Installation

One of:

pip install ndbioimage
pip install ndbioimage[bioformats]
pip install ndbioimage[write]
pip install ndbioimage[bioformats, write]
  • bioformats: use bio-formats as fallback when other readers cannot open a file.
  • write: write an image file into a mp4 or mkv file. Work in progress! Make sure ffmpeg is installed.

Usage

Python

  • Reading an image file and plotting the frame at channel=2, time=1
import matplotlib.pyplot as plt
from ndbioimage import Imread
with Imread('image_file.tif', axes='ctyx', dtype=int) as im:
    plt.imshow(im[2, 1])
  • Showing some image metadata
from ndbioimage import Imread
from pprint import pprint
with Imread('image_file.tif') as im:
    pprint(im)
  • Slicing the image without loading the image into memory
from ndbioimage import Imread
with Imread('image_file.tif', axes='cztyx') as im:
    sliced_im = im[1, :, :, 100:200, 100:200]

sliced_im is an instance of Imread which will load any image data from file only when needed

  • Converting (part) of the image to a numpy ndarray
from ndbioimage import Imread
import numpy as np
with Imread('image_file.tif', axes='cztyx') as im:
    array = np.asarray(im[0, 0])

Command line

ndbioimage --help: show help
ndbioimage image: show metadata about image
ndbioimage image -w {name}.tif -r: copy image into image.tif (replacing {name} with image), while registering channels
ndbioimage image -w image.mp4 -C cyan lime red copy image into image.mp4 (z will be max projected), make channel colors cyan lime and red

Adding more formats

Readers for image formats subclass AbstractReader. When an image reader is imported, Imread will automatically recognize it and use it to open the appropriate file format. Image readers are required to implement the following methods:

  • staticmethod _can_open(path): return True if path can be opened by this reader
  • __frame__(self, c, z, t): return the frame at channel=c, z-slice=z, time=t from the file

Optional methods:

  • get_ome: reads metadata from file and adds them to an OME object imported from the ome-types library
  • open(self): maybe open some file handle
  • close(self): close any file handles

Optional fields:

  • priority (int): Imread will try readers with a lower number first, default: 99
  • do_not_pickle (strings): any attributes that should not be included when the object is pickled, for example: any file handles

TODO

  • more image formats

Download files

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

Source Distribution

ndbioimage-2026.7.1.tar.gz (52.3 kB view details)

Uploaded Source

Built Distribution

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

ndbioimage-2026.7.1-py3-none-any.whl (57.6 kB view details)

Uploaded Python 3

File details

Details for the file ndbioimage-2026.7.1.tar.gz.

File metadata

  • Download URL: ndbioimage-2026.7.1.tar.gz
  • Upload date:
  • Size: 52.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for ndbioimage-2026.7.1.tar.gz
Algorithm Hash digest
SHA256 d5eb56218693a8cde6c812817857bb1b455968c05d6ee1048a7c3af63311ef01
MD5 09e305965ebe04ca6b219f551914e226
BLAKE2b-256 3d6d910d9890c656f389bbf9a48572e382607ac4998c7433f5aca2cb9cf76a66

See more details on using hashes here.

File details

Details for the file ndbioimage-2026.7.1-py3-none-any.whl.

File metadata

  • Download URL: ndbioimage-2026.7.1-py3-none-any.whl
  • Upload date:
  • Size: 57.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for ndbioimage-2026.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f46e44ddd4cb89591e79dd627926aa5e8d14049643bb176c9b8442b1d0acd107
MD5 c7ab1b45cef413cdc5cb72802d17c092
BLAKE2b-256 0bf7d67244f5b46716034f9f8976b06782264ef80cc4cebea115294c0203cbac

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2026.7.1 This release

2 files

2026.7.0

2 files

2026.4.0

2 files

2026.3.6

2 files

2026.3.5

2 files

2026.3.4

2 files

2026.3.3

2 files

2026.3.2

2 files

2026.3.1

2 files

2026.3.0

2 files

2026.1.2

2 files

2026.1.1

2 files

2026.1.0

2 files

2025.11.0

2 files

2025.10.0

2 files

2025.9.0

2 files

2025.8.0

2 files

2025.3.2

2 files

2025.3.0

2 files

2025.2.1

2 files

2025.2.0

2 files

2025.1.2

2 files

2025.1.1

2 files

2025.1.0

2 files

2024.10.0

2 files

2024.9.2

2 files

2024.9.1

2 files

2024.9.0

2 files

2024.7.0

2 files

2024.5.2

2 files

2024.5.1

2 files

2024.5.0

2 files

2024.4.8

2 files

2024.4.7

2 files

2024.4.6

2 files

2024.4.4

2 files

2024.4.3

2 files

2024.4.1

2 files

2024.4.0

2 files

2024.3.7

2 files

2024.3.6

2 files

2024.3.5

2 files

2024.3.4

2 files

2024.3.3

2 files

2024.3.2

2 files

2024.3.1

2 files

2024.3.0

2 files

2024.2.0

2 files

2023.12.2

2 files

2023.12.1

2 files

2023.12.0

2 files

2023.11.1

2 files

2023.11.0

2 files

2023.10.3

2 files

2023.10.2

2 files

2023.10.1

2 files

2023.10.0

2 files

2023.9.0

2 files

2023.8.2

2 files

2023.8.1

2 files

2023.8.0

2 files

2023.7.4

2 files

2023.7.3

2 files

2023.7.2

2 files

2023.7.0

2 files

2023.6.1

2 files

2022.7.1

2 files

2022.7.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