Skip to main content

Read and write MetaImages with minimal dependencies

Project description

MetaIO

Read MetaImages (.mha or .mhd) and NIFTI images (.nii or .nii.gz) and write .mha images in python with minimal dependencies.

Installation

Available on pypi.org: pip install tiny-metaio.

Usage

Writing a MHA file

>>> import metaio
>>> img = metaio.MetaImage([[0, 1], [42, 43]], spacing=[1, 2])
>>> img.save("some-name.mha")

Reading a MHA file

>>> img = metaio.read("some-name.mha")
>>> img.spacing
array([1., 2.])
>>> img.data
array([[ 0,  1],
       [42, 43]])
>>> img.direction
array([1., 0., 0., 1.])
>>> img.origin
array([0., 0.])

Philosophy

  • numpy as only runtime dependency.
  • idiomatic python.
  • similar behavior than SimpleITK's GetArrayFromImage, GetImageFromArray, GetDirection, GetOrigin, GetSpacing, ReadImage, WriteImage.

Why should I use this over SimpleITK?

If you just need the IO parts and do not want the large SimpleITK package, this package might be for you. If you do not care about having SimpleITK as a dependency for your project, this package is not for you.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiny_metaio-0.2.0.tar.gz (54.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiny_metaio-0.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file tiny_metaio-0.2.0.tar.gz.

File metadata

  • Download URL: tiny_metaio-0.2.0.tar.gz
  • Upload date:
  • Size: 54.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tiny_metaio-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e64c64b4f1de5563bdd51c6b7fe9e6f038622af37d9ffb25905fa65f5fa0d74a
MD5 ec93881a0329650f3b82e33e15e93521
BLAKE2b-256 65eb69e48553b8d77467f7f762cfba0f309bd7f226d3c24efec09a82721de22d

See more details on using hashes here.

File details

Details for the file tiny_metaio-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tiny_metaio-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tiny_metaio-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b707790ada8b49144663d9ab5f4967b6d909e18a4ecaeff3c587bdfa4255bc9
MD5 fec7335a6e9544c3ada0a7d73849da4c
BLAKE2b-256 97b9f5d4e83c188177ae265bebb0052c0ec04e63ed47e9e1825d2d529dd5d558

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page