dwi-to-adc
Rust command-line program and Python package for generating scalar apparent diffusion coefficient (ADC) maps from diffusion-weighted MRI.
Supported data
- NIfTI DWI (
.niior.nii.gz) with matching FSL.bvaland optional.bvecvalidation. The diffusion volumes are along the final NIfTI axis; vectors are validated but not used by scalar ADC fitting. - A directory of single-frame DICOM images from one diffusion series. The reader checks standard diffusion sequences/tags, Siemens CSA headers, and known Siemens, GE, Philips, Canon/Toshiba, and UIH private b-value tags. If b-values cannot be extracted, provide a manual FSL
.bvalfile with--bval; the tool reports this fallback and asks users to open an issue if the format is not supported. Multi-frame Enhanced DICOM is not yet supported. - NIfTI ADC output (
.niior.nii.gz) or a directory of derived DICOM slices.
ADC is estimated by linear least squares of $\ln(S/S_0)$ versus b-value using all positive b-values and the mean available b=0 image. Non-positive/non-finite signals and non-decaying fits produce zero. ADC values are in mm²/s when input b-values use s/mm².
Standalone binary
cargo build --release
./target/release/dwi-to-adc DWI.nii.gz adc.nii.gz --bval DWI.bval --bvec DWI.bvec
./target/release/dwi-to-adc ./dicom-series adc-dicom/ --input-format dicom
Published releases attach standalone archives for Linux x86_64 and Apple Silicon macOS. The dwi-to-adc command is also installed by the Python package. A minimal container image is published to ghcr.io/<owner>/<repository> for each release.
An input directory is inferred as DICOM; a file is inferred as NIfTI. DICOM output is selected by passing an output directory; NIfTI output by .nii or .nii.gz extension. DICOM output requires an empty, non-existing destination directory. DICOM pixel values are stored as unsigned 16-bit integers with rescale slope set to preserve ADC magnitude. Review derived DICOM metadata with your clinical imaging workflow before clinical use.
Python package
python -m pip install lavlab-adc
dwi-to-adc DWI.nii.gz adc.nii.gz --bval DWI.bval
dwi-to-adc ./dicom-series adc-dicom --input-format dicom
On supported platforms, prebuilt wheels are published for Linux x86_64 and Apple Silicon macOS. The extension uses PyO3's stable ABI, so each wheel supports Python 3.9 and newer CPython versions on those platforms.
To build from source locally:
python -m pip install maturin
maturin develop --release
import dwi_to_adc
dwi_to_adc.convert("DWI.nii.gz", "adc.nii.gz", bval="DWI.bval", bvec="DWI.bvec")
dwi_to_adc.convert("dicom-series", "adc-dicom", input_format="dicom")
Development
cargo test
cargo clippy --all-targets --all-features -- -D warnings
Metadata
Release files for lavlab-adc 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lavlab_adc-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| lavlab_adc-0.1.1-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 2.2 MB
Release files / lavlab_adc-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | lavlab_adc-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fa83017b7966c508e3be286b641ea21745459eb961f6aa119592a2b771baf6d5
|
|
BLAKE2b-256 checksum How to use checksums |
ac9a00edf1225fc47bc923e90939ef4a9fdff27f2b3718ee71461923e9e24fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 14, 2026.
Transparency logRelease files / lavlab_adc-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | lavlab_adc-0.1.1-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1f9cb5656a5bc470a5c851c16c8e3bf556392a34068bb2cfed0303db85fe2600
|
|
BLAKE2b-256 checksum How to use checksums |
59b3efcdeb194a1f3335bbc9a16d3efa6a4bd85091cb236212daaad28d55098f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 14, 2026.
Transparency logSecurity for lavlab-adc 0.1.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for lavlab_adc-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl
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 Oct 14, 2026.
Transparency logA 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.