MetaImageIO

Support for reading and writing images in MetaIO file format.

View the Project on GitHub auneri/MetaImageIO

MetaImageIO

Support for reading and writing images in MetaIO file format.

license build pypi conda-forge matlab-file-exchange

Getting started in Python

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)

Getting started in MATLAB

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');

Releasing a new version

  1. Update project.version in pyproject.toml and CHANGELOG with commit message “Release vX.X.X”.
  2. Add tag vX.X.X with message “Release vX.X.X”.
  3. Push the tag and create a new release on metaimageio.
  4. Merge the auto-generated pull request on metaimageio-feedstock.