Skip to main content

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)

wmfod = odx.from_mrtrix("wmfod.mif")  # bare SH image (.mif[.gz] or 4-D .nii[.gz])

Features

  • Native ODX I/O — read/write .odx archives or directories, mmap-backed for zero-copy NumPy views. odx.load(path, skip_odf=True, skip_sh=True) (and skip_odf= on from_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.Odx and dipy's PeaksAndMetrics. 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=True scores 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 (or Odx.apply_graddev) reorients SH/FODs, dense ODFs and fixels with a per-voxel deviation field, as the odx graddev CLI 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 T per voxel with g_eff = Tᵀ g (qsiprep / TORTOISE, identity="included"; HCP/FSL grad_dev stores T − 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.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 odx 0.3.1
File Size Uploaded Provenance Actions
odx-0.3.1.tar.gz 436.5 kB With provenance Details for odx-0.3.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for odx 0.3.1
File Actions
odx-0.3.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for odx-0.3.1-cp39-abi3-win_amd64.whl
odx-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for odx-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
odx-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for odx-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
odx-0.3.1-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for odx-0.3.1-cp39-abi3-manylinux_2_28_x86_64.whl
odx-0.3.1-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for odx-0.3.1-cp39-abi3-manylinux_2_28_aarch64.whl
odx-0.3.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for odx-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
odx-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for odx-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 22.1 MB

Release files / odx-0.3.1.tar.gz

Download URL odx-0.3.1.tar.gz
Size 436.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2aff3aa344b006a1b70bb7aa205809412875c49bb7ab532e3cc1303333dea5e9
BLAKE2b-256 checksum
How to use checksums
0aca035e16262ff528e368aa2ea7cee8610de145793910ff5b3f4d9b02822029
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 Oct 28, 2026.

Transparency log

Release files / odx-0.3.1-cp39-abi3-win_amd64.whl

Download URL odx-0.3.1-cp39-abi3-win_amd64.whl
Size 4.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7c5dc98f2bbc63d957359691955d0125de444d10a2b46657d196362edce5a261
BLAKE2b-256 checksum
How to use checksums
45c89f4e474ebb12adc1aebaf3e54a0f3b271efd589c87f12c8cd125bdf83941
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 Oct 28, 2026.

Transparency log

Release files / odx-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL odx-0.3.1-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
71b7a3b595ab8897881d65b617261d9a059a04407b56f339dc2a2ac8900cef9e
BLAKE2b-256 checksum
How to use checksums
892158d0839e71b9a644e91b5e27bc7009f942641adb839229b4ae5f63717755
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 Oct 28, 2026.

Transparency log

Release files / odx-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL odx-0.3.1-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
6870115d9e73d044354855ad7ab497261375b499e865f3ab3ca1dbc020dec88f
BLAKE2b-256 checksum
How to use checksums
2f686a8ebf5b5fe9376a04aa7bf4ca63435f6cfa09b91721223eec00208e498e
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 Oct 28, 2026.

Transparency log

Release files / odx-0.3.1-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL odx-0.3.1-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
4ab56e96cfcfb3ef10863781cdb818668156ebd102c7e629a79824ca168efd46
BLAKE2b-256 checksum
How to use checksums
9d4dba595d69eb80df1e6bea318c9ca1040f8433b2e50b9c401081d0a2e0edae
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 Oct 28, 2026.

Transparency log

Release files / odx-0.3.1-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL odx-0.3.1-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
7524dc435734c624f0df46891e32e2fb48b4c87d688f0da6a414e59dc00b74fd
BLAKE2b-256 checksum
How to use checksums
0ecbc7e8a8cb40a6dc2ef91effbeb74244ac8cb5971705c3eed29cccaafddc56
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 Oct 28, 2026.

Transparency log

Release files / odx-0.3.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL odx-0.3.1-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
77a423f0a29c732a2f359b2bc0659f8c75a0992676d022b3ba9dfde388a42d73
BLAKE2b-256 checksum
How to use checksums
84c7569317a61b811a9528d4d3fe14bc7e99054982fcd1dac9a02ab98812f06b
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 Oct 28, 2026.

Transparency log

Release files / odx-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL odx-0.3.1-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
4559a3a97a3013c7cbce08203e8383da2754a627990647c786279cfb8dda36fb
BLAKE2b-256 checksum
How to use checksums
4db606598f95c5117e2f373fa1ada2c0e55903fc2c3757f761aef49912edaf46
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 Oct 28, 2026.

Transparency log

Security for odx 0.3.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 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for odx-0.3.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 Oct 28, 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