Skip to main content

MedVol

PyPI version Python versions Build status License

Faithful N:N conversion of medical image formats through one neutral model: the MLArray v1 metadata model. Formats: NIfTI-1/2, NRRD, MetaImage, MGH/MGZ, DICOM (single-frame and enhanced multi-frame series, SEG) and .mla.

Design: docs/design/spec.md.

Guarantees

  • Faithful round trips. X → .mla → X reproduces the array bit-identically and the header to the accuracy of the format (identical binary floats, identical numeric values for text formats).
  • Nothing implicit. No reorientation, resampling, rescaling or dtype change, and no metadata removal. The array keeps its stored values and order; scaling becomes values.scale/offset.
  • Exact geometry. MedVol computes geometry from the format's own fields (backends do byte-level IO only). Every voxel keeps its world position across formats, including oblique, mirrored and gantry-tilted (sheared) grids.
  • Everything reported. Each read, write and convert returns a report of choices, warnings and dropped fields; it is also stored in the image's history.

Usage

import medvol

image, report = medvol.read("ct.nii.gz")              # Image(array, mlarray Meta) + Report
print(report)
medvol.write(image, "ct.mla")
medvol.convert("dicom_dir/", "ct.mla", dicom_tilt="exact")
medvol.convert("ct.mla", "out_dir/", target_format="dicom")   # re-emits the original series
print(medvol.inspect("scan.nrrd"))

Ambiguities are resolved by explicit policies (medvol.Policy), for example nifti_form when qform and sform disagree, world_frame (dicom_patient = LPS by default, or ras), dicom_stacks, dicom_tilt, dicom_irregular_spacing and on_loss (warn or error when the target cannot represent something).

The original header is kept, readable, in image.meta.source, and is used again only when writing the same format.

Installation

pip install medvol            # NIfTI, NRRD, MetaImage, MGH/MGZ, .mla
pip install "medvol[dicom]"   # plus DICOM (pydicom, highdicom)

Plugins for further formats can be added through the medvol.formats entry point group.

License

Apache-2.0

Metadata

Release files for medvol 1.0.0

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 1.0.0
File Size Uploaded Provenance Actions
medvol-1.0.0.tar.gz 124.4 kB With provenance Details for medvol-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 231.6 kB

Release files / medvol-1.0.0.tar.gz

Download URL medvol-1.0.0.tar.gz
Size 124.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a741a76976be90025238050e63c1179bb3737043c9ec6ed02c5321f543be0761
BLAKE2b-256 checksum
How to use checksums
955b3afeaa3cd2fc9c0cd9399915e46b96486c257168d8dfe5bcd88926adb140
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / medvol-1.0.0-py3-none-any.whl

Download URL medvol-1.0.0-py3-none-any.whl
Size 107.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdcfd5bc942aee53734f6f307dc1a5e8fdd6c3685776547d9f0915d6585e7233
BLAKE2b-256 checksum
How to use checksums
269fd30c96cbaf5f8bf50cc7d43b450772ee7f57c77f8bcd4db773085af87118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for medvol 1.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for medvol-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

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