Skip to main content

ndbioimage

Pytest

Work in progress

Rust rewrite of python version. Read bio image formats using the bio-formats java package. https://www.openmicroscopy.org/bio-formats/

Exposes (bio) images as a numpy ndarray-like object (Python) or a struct that can be sliced like an ndarray Array (Rust), 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.

To transition to semver, versions before 0.1.0 were yanked from crates.io.

Installation

pip install ndbioimage

Installation with option to write mp4 or mkv:

Work in progress! Make sure ffmpeg is installed.

pip install ndbioimage[write]

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])

Rust

use ndarray::Array2;
use ndbioimage::{DynReader, Frame, Reader};

fn main() -> Result<(), ndbioimage::error::Error> {
    let path = "/path/to/file";
    let reader = DynReader::new(&path, 0, 0)?;
    println!("shape: {}", reader.shape());
    let frame = reader.get_frame(0, 0, 0)?;
    if let Ok(arr) = <Frame as TryInto<Array2<i8>>>::try_into(frame) {
        println!("{:?}", arr);
    } else {
        println!("could not convert Frame to Array<i8>");
    }
    let xml = reader.metadata()?.to_xml()?;
    println!("{}", xml);
    Ok(())
}
use ndbioimage::{DynReader, Reader};

fn main() -> Result<(), ndbioimage::error::Error> {
    let path = "/path/to/file";
    let reader = DynReader::new(&path, 0, 0)?;
    let view = reader.view();
    let view = view.max_proj(3)?;
    let array = view.as_array::<u16>()?;
    println!("{:?}", array.shape());
    Ok(())
}

Command line

ndbioimage --help: show help
ndbioimage info image: show metadata about image
ndbioimage tiff image image.tif -r: copy image into image.tif, while registering channels
ndbioimage movie image image.mp4 -C cyan lime red copy image into image.mp4 (z will be max projected), make channel colors cyan lime and red

Metadata

Release files for ndbioimage 2027.0.7

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

Source distribution (sdist)

Source distribution for ndbioimage 2027.0.7
File Size Uploaded Provenance Actions
ndbioimage-2027.0.7.tar.gz 398.7 kB Without provenance Details for ndbioimage-2027.0.7.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ndbioimage 2027.0.7
File Actions
ndbioimage-2027.0.7-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for ndbioimage-2027.0.7-cp310-abi3-win_arm64.whl
ndbioimage-2027.0.7-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for ndbioimage-2027.0.7-cp310-abi3-win_amd64.whl
ndbioimage-2027.0.7-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for ndbioimage-2027.0.7-cp310-abi3-musllinux_1_2_x86_64.whl
ndbioimage-2027.0.7-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for ndbioimage-2027.0.7-cp310-abi3-musllinux_1_2_aarch64.whl
ndbioimage-2027.0.7-cp310-abi3-manylinux_2_34_x86_64.whl CPython 3.10 abi3 Linux glibc 2.34+ x86-64 Details for ndbioimage-2027.0.7-cp310-abi3-manylinux_2_34_x86_64.whl
ndbioimage-2027.0.7-cp310-abi3-manylinux_2_34_aarch64.whl CPython 3.10 abi3 Linux glibc 2.34+ ARM64 Details for ndbioimage-2027.0.7-cp310-abi3-manylinux_2_34_aarch64.whl
ndbioimage-2027.0.7-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for ndbioimage-2027.0.7-cp310-abi3-macosx_11_0_arm64.whl
ndbioimage-2027.0.7-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for ndbioimage-2027.0.7-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 202.7 MB

Release files / ndbioimage-2027.0.7.tar.gz

Download URL ndbioimage-2027.0.7.tar.gz
Size 398.7 kB
Tags Source
SHA-256 checksum
How to use checksums
da779ac2e32efb6737f924e367fa3ac0771c08e7bfc7196878d0d4b7996d09cd
BLAKE2b-256 checksum
How to use checksums
0c56f007fed462f6af0224e046662a97c9152ddaa9227e0152e59f47f6440da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndbioimage-2027.0.7-cp310-abi3-win_arm64.whl

Download URL ndbioimage-2027.0.7-cp310-abi3-win_arm64.whl
Size 21.6 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
31ce4b6f75063ec56c2fca13f911d3a765b239f1ef14169a3e0c4a619196b96f
BLAKE2b-256 checksum
How to use checksums
7d73704990f16f708a5e04bb3e3067a5638f589e64c48d4d9ae4d3302501f31e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndbioimage-2027.0.7-cp310-abi3-win_amd64.whl

Download URL ndbioimage-2027.0.7-cp310-abi3-win_amd64.whl
Size 23.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f8326e47e9393c44d03fcccb060ff2470a21662273e355e1d6e6d4ddf9d8ca7d
BLAKE2b-256 checksum
How to use checksums
68990df4e1b5ee5763b56d7d5690565e33da882a85ddeaa2f5230c345526c430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndbioimage-2027.0.7-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL ndbioimage-2027.0.7-cp310-abi3-musllinux_1_2_x86_64.whl
Size 23.2 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
c52b975bb929f939af658437e5098688b2b55bfd0e1c4d765137cdf76c2314f1
BLAKE2b-256 checksum
How to use checksums
35ca1614f9a03964de544fd596dac69c2a7afeb6e3b3d2acf82c185b3324c88b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndbioimage-2027.0.7-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL ndbioimage-2027.0.7-cp310-abi3-musllinux_1_2_aarch64.whl
Size 21.6 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
2da99175d872a77960c0d377a704b935c33662cf37a8776450400fb61ad379d2
BLAKE2b-256 checksum
How to use checksums
f74a966954a96d37b77734d190f58543c815c673f2118e6e48a0c17c7b6038c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndbioimage-2027.0.7-cp310-abi3-manylinux_2_34_x86_64.whl

Download URL ndbioimage-2027.0.7-cp310-abi3-manylinux_2_34_x86_64.whl
Size 23.2 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
5b793cb3eccfd2f4561611c042c4484b49023893e5ac9a3bdd5ea23142fccb95
BLAKE2b-256 checksum
How to use checksums
0cf2aa3782ec17269196ef9b996ee3b453b5c76e061749e4659ea3840a47ffd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndbioimage-2027.0.7-cp310-abi3-manylinux_2_34_aarch64.whl

Download URL ndbioimage-2027.0.7-cp310-abi3-manylinux_2_34_aarch64.whl
Size 21.6 MB
Tags CPython 3.10 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
f39bcae589d21ea172bc5327b9905efe1a1338c47397395ad770d14cc32ae5ef
BLAKE2b-256 checksum
How to use checksums
eba86611af933eca85ca58e700275cd55f2d36a1acbf87147693e83f9a05f6a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndbioimage-2027.0.7-cp310-abi3-macosx_11_0_arm64.whl

Download URL ndbioimage-2027.0.7-cp310-abi3-macosx_11_0_arm64.whl
Size 33.1 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
dd715a073d920f18e840fb007d7ae9ff35c5ea824989c4eb08861fdc21103bb8
BLAKE2b-256 checksum
How to use checksums
2cb0e39e9f909cb32716b615fe11db285ee306a5060e49951b04e1eb143db111
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndbioimage-2027.0.7-cp310-abi3-macosx_10_12_x86_64.whl

Download URL ndbioimage-2027.0.7-cp310-abi3-macosx_10_12_x86_64.whl
Size 34.8 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7947f7c50d41f9868746086ae3ced955453a2de2cd800d49d8e5fac88c6d5c9c
BLAKE2b-256 checksum
How to use checksums
aacd39ff6a9bb445e2f7274e18c5f7f1de1cd05683718f065f580cd053aac048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ndbioimage 2027.0.7

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

2027.0.7 This release

9 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