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.17.tar.gz (10.0 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.17-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for medvol-0.0.17.tar.gz
Algorithm Hash digest
SHA256 5d24a284aceefe6429072e27e10ac04533c1f15ecd82fba1305fdc51546d59ca
MD5 2551904daf7a89637373bb95e823d91c
BLAKE2b-256 58fc66f2f9dd23edf220be8dd043e9c05150bfaca9b1eb21ffc7183c88870e18

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for medvol-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 b54513bad06425edba08bf4d03eda8e2790cefa934f737c0f912a7cccdbcb6c5
MD5 73fd9cf727d77352c45910e8b0b5ce0d
BLAKE2b-256 5b2df4cb0cdc0e6e9045572d1e647184baff02332fb3d192b6321c2a9c87eb03

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