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

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.2
File Size Uploaded Provenance Actions
odx-0.3.2.tar.gz 443.7 kB With provenance Details for odx-0.3.2.tar.gz

Built distributions (wheels)

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

Total release size: 22.2 MB

Release files / odx-0.3.2.tar.gz

Download URL odx-0.3.2.tar.gz
Size 443.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b55f19980e25c8f2f759476fbdea9e0c8c3cdb49ac1008a8d2c7a0c0289734e0
BLAKE2b-256 checksum
How to use checksums
6a2a11bb224e60801dc06086e76a239274d3f380df60f63f9d56ed6dff9725fc
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 30, 2026.

Transparency log

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

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

Transparency log

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

Download URL odx-0.3.2-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
303073caa561f994b6b2b6fc1765e5fc30daa67d1825587ac5bfadf0c8108586
BLAKE2b-256 checksum
How to use checksums
4ac56d8db1563a02576cac69e4cfaedf91137c2ff4dfbf1522b20aae9b8ed9d5
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 30, 2026.

Transparency log

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

Download URL odx-0.3.2-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
fb852dfc43f9758f687c6e7e7c49b90588f2d879248d6c07b4beb3465be6d385
BLAKE2b-256 checksum
How to use checksums
40d1ae75e01fb12c240f94a4a1fa2066d1f0dd66e723aeb8b157105fc697633d
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 30, 2026.

Transparency log

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

Download URL odx-0.3.2-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
5c7cf3ba43ddcf7ead5018f06d51c7ffe089954ff6f6ac52fac630593559fc65
BLAKE2b-256 checksum
How to use checksums
3107aba6a495c6b747feabecbe2258f6b4a7ed3bec71dc3d943459a751ab2894
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 30, 2026.

Transparency log

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

Download URL odx-0.3.2-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
d2a1ae3173e93c92278a2dee368f408ce67de457d9a8fbd5b6fa93bdce513f24
BLAKE2b-256 checksum
How to use checksums
2e6ba72c96a852057458bba7aded66552262ff76365a0adec1e1ecadb7ad02fc
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 30, 2026.

Transparency log

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

Download URL odx-0.3.2-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
9521aa709c23fd8dfd93e1a3ea9bb778dab0563de323c9777d7c49c846c4fa6b
BLAKE2b-256 checksum
How to use checksums
30a592bf57928b1e8b1a21f5cc79019c7aeffe1b0731cbced77cc0e7c99b94a7
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 30, 2026.

Transparency log

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

Download URL odx-0.3.2-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
6754e8d73552f66362ad58d57dcc7ecfa24063873a8f86175af87cd6c5e5c46b
BLAKE2b-256 checksum
How to use checksums
8ef0e97f227d9903dad7da429b2e9b6dd05aacf13a43b55d436e540250399037
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 30, 2026.

Transparency log

Security for odx 0.3.2

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.2.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 30, 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