Skip to main content

MedVol

PyPI Python Version Tests Docs 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.

Documentation: mic-dkfz.github.io/MedVol. 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"))
medvol convert ct.nii.gz ct.mla --nifti-form sform
medvol inspect dicom_dir/

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.1

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

Built distribution (wheel)

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

Total release size: 235.3 kB

Release files / medvol-1.0.1.tar.gz

Download URL medvol-1.0.1.tar.gz
Size 126.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bf7960f104fa7eab6664715ef3b54734838ac48ba652fc7a76505bf222bd2174
BLAKE2b-256 checksum
How to use checksums
a74d9806bb8713d7db2a323d0d9aaa6e59d3baef192aeb0c3e00e8eaa7da5c72
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.1-py3-none-any.whl

Download URL medvol-1.0.1-py3-none-any.whl
Size 108.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
603a9a6623b71f26c17729540f7311d36b606d9dab86e7defffc849991fb52d9
BLAKE2b-256 checksum
How to use checksums
e3bb96185f0f392d64c86494accbaf48edd049a07065e730cfd077ad8ad68bcc
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.1

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.1.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