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

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.3
File Size Uploaded Provenance Actions
odx-0.3.3.tar.gz 447.7 kB With provenance Details for odx-0.3.3.tar.gz

Built distributions (wheels)

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

Total release size: 22.3 MB

Release files / odx-0.3.3.tar.gz

Download URL odx-0.3.3.tar.gz
Size 447.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b09c66936ad1c98db8559a061a13ee83bab5f0ed29ba76e46d0328ff237d7616
BLAKE2b-256 checksum
How to use checksums
70897da585118222dbcfd7eef79800f9663cee62d647f21cc405a3f9511976bd
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 15, 2026.

Transparency log

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

Download URL odx-0.3.3-cp39-abi3-win_amd64.whl
Size 4.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b8dd95c0aa655cea872afc6b8b58d1d3e34e567b31fc291784a1d2fa9f37a099
BLAKE2b-256 checksum
How to use checksums
157f92897ab8fc2e6ba627616aea639fcccfcabecff84bcf0e2d79b05499086e
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 15, 2026.

Transparency log

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

Download URL odx-0.3.3-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
a3df092823a07cbc2a1a09e747ab8aa711696397e881b905bb8d6e802eb001d9
BLAKE2b-256 checksum
How to use checksums
b1d7a03ce29e77a11cc89046436943b740c2db2c918153b1a237d8d37e5952c9
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 15, 2026.

Transparency log

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

Download URL odx-0.3.3-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
37320d0f2a697e1db6e85b6d39bc97d51c6163e3309a75b44d1c5b706a4229b6
BLAKE2b-256 checksum
How to use checksums
cdf16b9da7686b798671a62f36a109d72d11fbc90e0e199beaf53ee7232a40f8
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 15, 2026.

Transparency log

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

Download URL odx-0.3.3-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
20f53dcd126f55d3613dab62942763ba7cf788b1a63656d64ea96eea7b4aedd6
BLAKE2b-256 checksum
How to use checksums
cc4341b797c9526a4bfea1b9380cc944d2410cb630666d83092030fdacacce3e
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 15, 2026.

Transparency log

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

Download URL odx-0.3.3-cp39-abi3-manylinux_2_28_aarch64.whl
Size 2.9 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
34969517c9d1fa0d9cde9dbbd8244f2a21a5959479568142fce7313d1fb181e7
BLAKE2b-256 checksum
How to use checksums
ec9aa5bc36ebc79f82a23a3c2b6de324043d5a077f08bdc0839891a40ebfd900
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 15, 2026.

Transparency log

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

Download URL odx-0.3.3-cp39-abi3-macosx_11_0_arm64.whl
Size 2.4 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c74b2f487353409b251a124b4aa329ff143f1127a5f61f51d9f894ba75eb219e
BLAKE2b-256 checksum
How to use checksums
914266c452d5b77ca50f28884c0aa156dffd460c1d82da9335bb1d884434afe0
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 15, 2026.

Transparency log

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

Download URL odx-0.3.3-cp39-abi3-macosx_10_12_x86_64.whl
Size 2.7 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a0ae5f4edcb90cf55621542196bf5ef9f247fc92ad1a9ff6bc1f0ac93729e85f
BLAKE2b-256 checksum
How to use checksums
8d5f0163a84baa8ae60a6a225a8f61315172ecf34a0d688e90f43a8a8c59f1e1
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 15, 2026.

Transparency log

Security for odx 0.3.3

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.3.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 15, 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