A wrapper for loading medical 3D image volumes such as NIFTI or NRRD images.
Project description
MedVol
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
Release history Release notifications | RSS feed
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.15.tar.gz
(9.8 kB
view details)
Built Distribution
File details
Details for the file medvol-0.0.15.tar.gz
.
File metadata
- Download URL: medvol-0.0.15.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b1df750f7783c3ede45f55d6b747e24cc98f5af9dd797d1485dad16b84b1b3e |
|
MD5 | 346b280a5adbaef37fe1ce43f901b580 |
|
BLAKE2b-256 | b7ff9cb11e1d5439e571635dd716dbd86e9138e65d463ca5ab50f7ed97078e36 |
File details
Details for the file MedVol-0.0.15-py3-none-any.whl
.
File metadata
- Download URL: MedVol-0.0.15-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26c1342232e8bd762cc32531c635f359ae1b946cb7d8f61bb5018561996921d7 |
|
MD5 | 18c6093218b0bd6760d8064fa1f23876 |
|
BLAKE2b-256 | 76a8341c7e291f4a7b4cfdf98febf6df6c6cb0e6a11425851493730d92884bf1 |