Support for reading and writing images in MetaIO file format.
Support for reading and writing images in MetaIO file format.
Install using pip install metaimageio
or conda install -c conda-forge metaimageio
.
import metaimageio as mio
image, meta = mio.read('/path/to/input.mha')
mio.write('/path/to/output.mha', image, ElementSpacing=meta['ElementSpacing'])
(Highly optional) Add to imageio plugins.
import imageio.v2 as iio
mio.imageio.add_format()
image = iio.imread('/path/to/input.mha', format='MetaImageIO')
meta = image.meta
import imageio.v3 as iio
from metaimageio.imageio import MetaImageIOPlugin
image = iio.imread('/path/to/input.mha', plugin=MetaImageIOPlugin)
meta = iio.immeta('/path/to/input.mha', plugin=MetaImageIOPlugin)
Install using the Add-On Manager.
[image, meta] = metaimageio.read('/path/to/input.mha');
metaimageio.write('/path/to/output.mha', image, 'ElementSpacing', meta.ElementSpacing);
(Optional) Add to image file format registry.
metaimageio.imformats();
image = imread('/path/to/input.mha');
meta = imfinfo('/path/to/input.mha');
project.version
in pyproject.toml
and CHANGELOG
with commit message “Release vX.X.X”.