Skip to content

bioio-devs/bioio-imageio

bioio-imageio

Build Status PyPI version License Python 3.10–3.13

A BioIO reader plugin for reading all these formats using imageio


Documentation

See the full documentation on our GitHub pages site - the generic use and installation instructions there will work for this package.

Information about the base reader this package relies on can be found in the bioio-base repository here

Installation

Stable Release: pip install bioio-imageio
Development Head: pip install git+https://github.com/bioio-devs/bioio-imageio.git

Example Usage (see full documentation for more examples)

Install bioio-imageio alongside bioio:

pip install bioio bioio-imageio

This example shows a simple use case for just accessing the pixel data of the image by explicitly passing this Reader into the BioImage. Passing the Reader into the BioImage instance is optional as bioio will automatically detect installed plug-ins and auto-select the most recently installed plug-in that supports the file passed in.

from bioio import BioImage
import bioio_imageio

img = BioImage("my_file.mp4", reader=bioio_imageio.Reader)
img.data

TwoDWriter

Import the writer:

from bioio_imageio.writers import TwoDWriter

The TwoDWriter writes 2D (YX) or 3D (YXS) image data via imageio.

Examples from Tests

import numpy as np
from bioio_imageio.writers import TwoDWriter

# RGB image, inferred YXS
image = np.zeros((100, 100, 3), dtype=np.uint8)
TwoDWriter.save(image, "output.png")
# Channels-first array (S,Y,X) with explicit dim_order
image = np.zeros((3, 100, 100), dtype=np.uint8)
TwoDWriter.save(image, "output.bmp", "SYX")

TimeseriesWriter

Import the writer:

from bioio_imageio.writers import TimeseriesWriter

The TimeseriesWriter writes 3D (T,Y,X) or 4D (T,Y,X,S) data as animated formats via imageio.

Examples from Tests

import numpy as np
from bioio_imageio.writers import TimeseriesWriter

# Grayscale GIF (T,Y,X)
image = np.zeros((30, 100, 100), dtype=np.uint8)
TimeseriesWriter.save(image, "output.gif")
# Custom dim_order (S,Y,T,X) for GIF
image = np.zeros((3, 100, 30, 100), dtype=np.uint8)
TimeseriesWriter.save(image, "output.gif", "SYTX")
# MP4 output for 30 frames of 112x112
image = np.zeros((30, 112, 112), dtype=np.uint8)
TimeseriesWriter.save(image, "output.mp4")

Issues

Click here to view all open issues in bioio-devs organization at once or check this repository's issue tab.

Development

See CONTRIBUTING.md for information related to developing the code.

About

A BioIO reader plugin for reading simple image and movie formats

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors 6