odx — Python bindings for the ODX format
Python bindings for odx-rs, a TRX-style
mmap-friendly container for orientation density functions (ODFs), peaks, and
spherical-harmonic coefficients from diffusion MRI.
Install
pip install odx # core package (numpy + nibabel)
pip install odx[dipy] # with the dipy adapter for PeaksAndMetrics interop
Quickstart
Compute CSD in dipy, dump to a peaked ODX in one call:
import odx
from dipy.reconst.csdeconv import ConstrainedSphericalDeconvModel
from dipy.direction.peaks import peaks_from_model
# ... fit a model, get csd_fit.shm_coeff (X, Y, Z, K)
peaked = odx.from_sh_coefficients(
csd_fit.shm_coeff, mask=mask, affine=affine,
basis="descoteaux07", sh_order=8, legacy=True,
)
peaked.save("csd.odx") # native, mmap-friendly
peaked.save_fz("autotrack.fz") # → DSI Studio fz
peaked.save_mrtrix("mrtrix_out/") # → MRtrix mif (auto-converts basis)
# Round-trip back to dipy if you want
pam = odx.to_peaks_and_metrics(peaked)
Features
-
Native ODX I/O — read/write
.odxarchives or directories, mmap-backed for zero-copy NumPy views.odx.load(path, skip_odf=True, skip_sh=True)(andskip_odf=onfrom_fibgz/from_fz) never reads dense arrays you don't need. -
Peak finder — sphere-mesh local-maxima detection with MRtrix-style Gauss-Newton sub-vertex refinement on the SH series itself.
-
Foreign format converters — load and save DSI Studio (
.fz,.fib.gz), MRtrix (fixel directories +.mif), Tortoise MAP-MRI, pyAFQ asymmetric ODFs. -
nibabel adapter — DPVs to/from
Nifti1Image; nibabel is a required dependency so NIfTI orientation and affines are always handled the same way. -
dipy adapter (optional) — bidirectional conversion between
odx.Odxand dipy'sPeaksAndMetrics. Lazy-imported so dipy isn't required for the core package. -
Coherence QC —
ds.coherence()gives current DSI Studio's fib-QC coherence index (or"fixel"mode's per-fixel summaries);check_btable=Truescores all 24 gradient-table permutations/flips without refitting. -
SH basis conversion — descoteaux07 ↔ tournier07 round-trips via amplitudes, including legacy/modern variants.
-
Gradient-nonlinearity correction —
odx.apply_graddev(orOdx.apply_graddev) reorients SH/FODs, dense ODFs and fixels with a per-voxel deviation field, as theodx graddevCLI does:img = nib.load("sub-01_space-ACPC_graddev.nii.gz") corrected, report = ds.apply_graddev(img) # brings its own affine # also accepted: a path, or an (X,Y,Z,9) array with affine=
Never reorient the field first (e.g.
nib.as_closest_canonical): its components live in its own voxel axes.The field holds row-major
Tper voxel withg_eff = Tᵀ g(qsiprep / TORTOISE,identity="included"; HCP/FSLgrad_devstoresT − I,identity="absent";"auto"decides). This is a post-hoc correction of fitted data: it fixes orientation, not the per-voxel b-value change. On a Prisma-class whole-body coil the orientation effect is a fraction of a degree.
License
The bulk of odx-rs (and the Python bindings) is dual-licensed under the
MIT and
Apache 2.0
licenses, the typical Rust ecosystem dual-license. Pick whichever you prefer.
Two source files in the underlying Rust crate (src/peak_finder.rs and
src/mrtrix_sh.rs) port code from
MRtrix3 and remain governed by the
Mozilla Public License v. 2.0.
That's a file-scoped (weak) copyleft — modifications to those specific files
must remain MPL and source-available, but the license has no effect on
projects that simply use odx as a dependency.
SPDX summary: (MIT OR Apache-2.0) AND MPL-2.0.
Metadata
Release files for odx 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| odx-0.3.0.tar.gz | 436.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| odx-0.3.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| odx-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ x86-64 | Details |
| odx-0.3.0-cp39-abi3-musllinux_1_2_aarch64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ ARM64 | Details |
| odx-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| odx-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| odx-0.3.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| odx-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 22.1 MB
Release files / odx-0.3.0.tar.gz
| Download URL | odx-0.3.0.tar.gz |
|---|---|
| Size | 436.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40f9f9af65ead09c5a59ac988ed4fc41a5f5dd18458cbc8a92e6e5dc115acf9a
|
|
BLAKE2b-256 checksum How to use checksums |
2ad6f50590e08e76af1a87bce51418be58793a846a1341e56b486ed424b3d4aa
|
| 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 9, 2026.
Transparency logRelease files / odx-0.3.0-cp39-abi3-win_amd64.whl
| Download URL | odx-0.3.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
89f4297ebe8f3da500d6af6c86f516ab324334182709461f038ff8d6dc8a8944
|
|
BLAKE2b-256 checksum How to use checksums |
714c02c6aac442e1bb0c5963e9b08597216a24a8a8c05fee849b86cd9b0759e9
|
| 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 9, 2026.
Transparency logRelease files / odx-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | odx-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e65df057257558dd85763466cfeaaa4b5065660fc4309304bce796fb9b6f1cec
|
|
BLAKE2b-256 checksum How to use checksums |
7bfadff8b50eb3dc532bf0a959b9c4b181d88783cb8f3b93ed24ad73ed956d51
|
| 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 9, 2026.
Transparency logRelease files / odx-0.3.0-cp39-abi3-musllinux_1_2_aarch64.whl
| Download URL | odx-0.3.0-cp39-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.9 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3fdb865199d1698e98a78364c670813ac6d9586e5cc5b6bbd3cdb407879756fe
|
|
BLAKE2b-256 checksum How to use checksums |
1e66ca1c68903de18c24c34cb2b108b195d5896b381be1bb362b07931969b33f
|
| 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 9, 2026.
Transparency logRelease files / odx-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | odx-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c5bc4d82e9984d7b9d2ed51c8d8195eabfcb18c199dcce60ebf0461fa34571a9
|
|
BLAKE2b-256 checksum How to use checksums |
9fe046b2b4dab5753d16bdfc3417ab6558e7fd18d94a55cc256370e43c15418d
|
| 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 9, 2026.
Transparency logRelease files / odx-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl
| Download URL | odx-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
97b51f771c1d0dc09d4694f04cddf80a999a8e88d4a4b66890761b1db22d6675
|
|
BLAKE2b-256 checksum How to use checksums |
8fe32e1c2c45f86a3875f9336a8bae8541464b6e1542aa22100e91006b3b9643
|
| 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 9, 2026.
Transparency logRelease files / odx-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | odx-0.3.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
47a3dde04a455cea9f7c525eaf7f8d9aaa3ccd90dde65819dd128051c1cfdf5d
|
|
BLAKE2b-256 checksum How to use checksums |
72da945c7b1bfe9c4491558ec52cbaf8ca8ebbb03fc3604e02d132b03e8cf6eb
|
| 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 9, 2026.
Transparency logRelease files / odx-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | odx-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
1b13cc93d8b2b687a0f591d82a95e0e4ba13e822dfc72dc9b499e6a52d7a6386
|
|
BLAKE2b-256 checksum How to use checksums |
97a9185cbfebfa7627f777920f946118edba03cd2334cfc2a3765c2575468e95
|
| 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 9, 2026.
Transparency log