Skip to main content

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.

Metadata

Release files for medvol 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for medvol 0.0.16
File Size Uploaded Provenance Actions
medvol-0.0.16.tar.gz 9.9 kB Without provenance Details for medvol-0.0.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for medvol 0.0.16
File Interpreter ABI Platform Actions
MedVol-0.0.16-py3-none-any.whl Python 3 none any Details for MedVol-0.0.16-py3-none-any.whl

Total release size: 19.4 kB

Release files / medvol-0.0.16.tar.gz

Download URL medvol-0.0.16.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
34319b0a31c4f1516b1dd45991971b60d9db0e75d1cfc47150afdbc79339f51c
BLAKE2b-256 checksum
How to use checksums
be92e3f9eee886cbfed54f2fb308b2759b58b03285bc0fa8a7b29ae5e6bd072d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / MedVol-0.0.16-py3-none-any.whl

Download URL MedVol-0.0.16-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a483eb06e46c06fa45daf4e9678b2f2504f90227ee472b6c67d5c99c0d716fe
BLAKE2b-256 checksum
How to use checksums
adb47cfb52f63a25f821046f9f2a43f6a8c80c59aad6959c3f5fab64444f4d2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Security for medvol 0.0.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page