Bio image reading, metadata and some affine registration.
GPL-3.0 License
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.
pip install ndbioimage
Work in progress! Make sure ffmpeg is installed.
pip install ndbioimage[write]
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])
from ndbioimage import Imread
from pprint import pprint
with Imread('image_file.tif') as im:
pprint(im)
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
from ndbioimage import Imread
import numpy as np
with Imread('image_file.tif', axes='cztyx') as im:
array = np.asarray(im[0, 0])
ndbioimage --help
: show help
ndbioimage image
: show metadata about image
ndbioimage image {name}.tif -r
: copy image into image.tif (replacing {name} with image), while registering channels
ndbioimage image image.mp4 -C cyan lime red
copy image into image.mp4 (z will be max projected), make channel colors cyan lime and red
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:
Optional methods:
Optional fields: