Skip to main content

A wrapper for loading medical 3D image volumes such as NIFTI or NRRD images.

Project description

MedVol

License Apache Software License 2.0 PyPI Python Version

A wrapper for loading medical 2D, 3D and 4D NIFTI or NRRD images.

Features:

  • Supports loading and saving of 2D, 3D and 4D Nifti and NRRD images
    • (Saving 4D images is currently not supported due to a SimpleITK bug)
  • Simple access to image array
  • Simple access to image metadata
    • Affine
    • Spacing
    • Origin
    • Direction
    • Translation
    • Rotation
    • Scale (Same as spacing)
    • Shear
    • Header (The raw header)
  • Copying/Modification of all or selected metadata across MedVol images

Installation

You can install medvol via pip:

pip install medvol

Example

from medvol import MedVol

# Load NIFTI image
image = MedVol("path/to/image.nifti")

# Print some metadata
print("Spacing: ", image.spacing)
print("Affine: ", image.affine)
print("Rotation: ", image.rotation)
print("Header: ", image.header)

# Access and modify the image array
arr = image.array
arr[0, 0, 0] = 1

# Create a new image with the new array, a new spacing, but copy all remaining metadata
new_image = MedVol(arr, spacing=[2, 2, 2], copy=image)

# Save the new image as NRRD
new_image.save("path/to/new_image.nrrd")

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the Apache Software License 2.0 license, "medvol" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

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

medvol-0.0.20.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

medvol-0.0.20-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file medvol-0.0.20.tar.gz.

File metadata

  • Download URL: medvol-0.0.20.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for medvol-0.0.20.tar.gz
Algorithm Hash digest
SHA256 9a3d4f64a2a140856d17d42b3f8d0605313703f0ea4f2778383f095674b75cd3
MD5 633bd2986e2964b60fa1cf5302524791
BLAKE2b-256 913a1db542fd4d9c7ec472acd56deab62f646ed471c0fb7ea996c9a2f8487913

See more details on using hashes here.

File details

Details for the file medvol-0.0.20-py3-none-any.whl.

File metadata

  • Download URL: medvol-0.0.20-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for medvol-0.0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 57b64448ba9e6c3dc378fea5ee326d1f2cbd37157fe804102c5316cb79cb1709
MD5 b4dfcd2c85e2aea399c6b015676ce679
BLAKE2b-256 bd9ada89152c9593604dda20b7713c121ac20407c99186ec1f3e870639b06782

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