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.18.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.18-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: medvol-0.0.18.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.18.tar.gz
Algorithm Hash digest
SHA256 9e539c02cb73f2e138fdca2fb96c8150f1bac146f41590f3364ac47b537dee97
MD5 dfc89290df2ef0bba9f850e03808d8a0
BLAKE2b-256 18822490efd91cb18c827e32943edbda5f546707ea963fdff01c4dee362274e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: medvol-0.0.18-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.18-py3-none-any.whl
Algorithm Hash digest
SHA256 608d0ab68563f84442978fb88a58a9af9f95363fc4ffec6c984c7d5c1dfed230
MD5 a01d81bf6007fbbc20d2c79821713e05
BLAKE2b-256 f32a64543a33a3ebf4c2d8130f0a027259f4fd5a1fc59f2d6bdfba2948fc2c3b

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