ritk-python
PyO3/maturin Python extension module wrapping the RITK Rust crate.
Requirements
- Rust toolchain 1.97.0 (the repository pin)
- Python ≥ 3.9
- maturin ≥ 1.9.4, < 2.0
- NumPy ≥ 2.0.2, < 2.6 on Python < 3.15; NumPy ≥ 2.5, < 2.6 on Python ≥ 3.15
Install the parity-test dependencies from their canonical manifest:
py -m pip install -r crates/ritk-python/requirements-test.txt
Build
Build the stable-ABI wheel from the repository root:
python -m pip install "maturin>=1.9.4,<2.0"
python -m maturin build --release --locked \
--manifest-path crates/ritk-python/Cargo.toml --out dist
The Cargo feature set leaves PyO3's extension-module feature disabled so
Rust tests and binaries retain their normal Python link contract; maturin
1.9.4 or newer supplies the extension-module build environment when producing
a wheel.
Install the wheel selected for the current interpreter:
python -m pip install --force-reinstall --no-index --find-links dist ritk-python
The release workflow builds the abi3-py39 wheel matrix and the abi3t stable
free-threaded wheel, then publishes through GitHub Actions OIDC Trusted
Publishing. It stores no PyPI token or private key.
Free-threaded CPython
The abi3t feature targets CPython 3.15t and declares gil_used = false at
the module boundary. Build it with:
python -m maturin build --release --locked --no-default-features --features abi3t \
--manifest-path crates/ritk-python/Cargo.toml --out dist
test_free_threaded.py runs the value-semantic image contract on a
free-threaded interpreter. The test is skipped on GIL-enabled CPython because
it cannot establish the free-threaded contract there.
The hosted contract job installs the minimal dependencies listed in
requirements-free-threaded.txt. The regular parity matrix keeps the broader
requirements-test.txt set; native parity packages are not required to prove
the binding's free-threaded contract and may not publish prerelease
free-threaded wheels. NumPy 2.5 or newer is required for the free-threaded
contract because the abi3t array bridge uses the NumPy 2.5 C API surface.
Running Tests
# VTK parity tests
py -m pytest crates/ritk-python/tests/test_vtk_parity.py -v
# SimpleITK parity tests (requires installed ritk wheel + SimpleITK)
py -m pytest crates/ritk-python/tests/test_simpleitk_parity.py -v
# CT/MRI DICOM parity tests (requires MRI-DIR test data in test_data/)
py -m pytest crates/ritk-python/tests/test_ct_mri_registration_parity.py -v
# All Python parity tests
py -m pytest crates/ritk-python/tests/ -v
Module API
| Submodule | Key functions |
|---|---|
ritk.filter |
discrete_gaussian, median_filter, bilateral_filter, gradient_magnitude, laplacian, sobel_gradient, n4_bias_correct, anisotropic_diffuse, frangi_vesselness |
ritk.registration |
demons_register, diffeomorphic_demons_register, syn_register, bspline_ffd_register, multires_syn_register, bspline_syn_register, lddmm_register, build_atlas, joint_label_fusion_py |
ritk.segmentation |
otsu_threshold, li_threshold, multi_otsu_threshold, binary_threshold, connected_components, binary_fill_holes, binary_erode, binary_dilate, kmeans_segment |
ritk.statistics |
compute_statistics, masked_statistics, histogram_match, minmax_normalize, zscore_normalize, psnr, ssim, dice_coefficient, hausdorff_distance |
ritk.io |
read_image, write_image, read_transform, write_transform |
Architecture
The extension module (_ritk.cdylib) is compiled from src/lib.rs and registered as
submodules filter, registration, segmentation, statistics, and io. All computation
delegates to Rust crates (zero business logic in the binding layer). The image I/O boundary
uses ritk-io's native readers/writers and converts only at the PyImage boundary. The
PyImage wrapper holds an Arc<ritk_image::Image<f32, MoiraiBackend, 3>> over Coeus/Leto
storage and provides .to_numpy() for zero-copy-where-possible extraction.
DICOM I/O
ritk.io.read_image(path) dispatches to ritk_io::read_image_native, which routes DICOM
directories through the native DICOM series reader before extension inference. A directory with
one image series can be passed directly. A mixed directory must name the acquisition explicitly:
image = ritk.io.read_image(
"test_data/3_head_ct_mridir/DICOM",
series_instance_uid="1.3.6.1.4.1.14519.5.2.1.1706.4996.115936088547498980797393821518",
)
The UID is matched by RITK's scanner before pixels are decoded. Omitting it for a mixed directory,
passing an unknown or empty UID, or passing a non-directory with a UID fails with IOError; no
first-series fallback is used. Obtain the UID from RITK's series discovery or the DICOM metadata.
Native image I/O coverage
Python image reads use the Atlas-native path for NIfTI, MetaImage, NRRD, PNG, DICOM directories, MGH/MGZ, TIFF, JPEG, and Analyze. Python image writes use the Atlas-native path for NIfTI, MetaImage, NRRD, MGH/MGZ, TIFF, JPEG, and Analyze. PNG, DICOM, and VTK image writes are rejected until native writers exist; VTK image reads are rejected until the VTK image reader migrates to the native substrate.
Extension Points
| Abstraction | Mechanism | Adding a target |
|---|---|---|
| Compute backend | ComputeBackend trait |
impl ComputeBackend for new device; no algorithm changes |
| GUI backend | GuiBackend trait |
impl GuiBackend for new shell; no domain logic changes |
| Execution policy | GAT-based ExecutionPolicy |
impl ExecutionPolicy for new regime |
| Scalar type | Scalar trait |
impl Scalar for new numeric type |
All variation dimensions are encoded through traits, generics, associated types, and const generics. No algorithm is cloned per backend, precision, layout, or execution regime.
Metadata
Release files for ritk-python 0.12.79
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ritk_python-0.12.79.tar.gz | 3.9 MB | With provenance | Details for ritk_python-0.12.79.tar.gz |
Built distributions (wheels)
Total release size: 143.9 MB
Release files / ritk_python-0.12.79.tar.gz
| Download URL | ritk_python-0.12.79.tar.gz |
|---|---|
| Size | 3.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e865e4f96dbcf2d1cef4e22dae39c4ce7e8250c30d222b3fc0ab347236e29aa
|
|
BLAKE2b-256 checksum How to use checksums |
20dc412cc52a7f93dcd009605eb3572b6ed226813127d2e06b92c0ef5a18b64a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp315-abi3.abi3t-win_amd64.whl
| Download URL | ritk_python-0.12.79-cp315-abi3.abi3t-win_amd64.whl |
|---|---|
| Size | 12.1 MB |
| Tags | CPython 3.15 Windows x86-64 abi3 abi3t |
|
SHA-256 checksum How to use checksums |
c8383203e044b747983cc8b54c76953c057b2ad6010bb44d27313d475d778f51
|
|
BLAKE2b-256 checksum How to use checksums |
f9ab206eacd79456fa6add6326e9a4a04f6a49120c8f850856c038924a28c650
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp315-abi3.abi3t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ritk_python-0.12.79-cp315-abi3.abi3t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 13.2 MB |
| Tags | CPython 3.15 Linux glibc 2.17+ x86-64 abi3 abi3t |
|
SHA-256 checksum How to use checksums |
e3ecbdd3057d7dab6ac2524a4b1908bfc860174b5b622efa2f30198052e3e0c2
|
|
BLAKE2b-256 checksum How to use checksums |
1b040acd16a7aaf4312da3a92d4eb1f5bb49c7cbe8aab675fbc547f0f5fa68d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp315-abi3.abi3t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | ritk_python-0.12.79-cp315-abi3.abi3t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 10.4 MB |
| Tags | CPython 3.15 Linux glibc 2.17+ ARM64 abi3 abi3t |
|
SHA-256 checksum How to use checksums |
a581dc8513edb8c585e702b3132bd1b16b5182e1a530c909dab6a28be6624062
|
|
BLAKE2b-256 checksum How to use checksums |
65ea13a380415f157bcf18105bd2b214e75d0be0c079ea51419c58c45529a278
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp315-abi3.abi3t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | ritk_python-0.12.79-cp315-abi3.abi3t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 22.4 MB |
| Tags | CPython 3.15 abi3 abi3t macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
aa0f8b5b6c05235f8a722d1ea69a42767db56e67425a268e01e5644d345d01e1
|
|
BLAKE2b-256 checksum How to use checksums |
bfde6abe8fdc404ad960efd7657841276899d139ae1ad7894e43d150c7c9d06b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp39-abi3-win_amd64.whl
| Download URL | ritk_python-0.12.79-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 12.0 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1b748ab3dcb4635d14117aabd464c3bdbf25449b1c8b19698c79b78aea4cb327
|
|
BLAKE2b-256 checksum How to use checksums |
c9a833bb36622f4c31287914463e602e6961bbfc94c15d285159d3b2cf3ac72f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | ritk_python-0.12.79-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 13.6 MB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3d72527a1e7cf8c85502315b6ca97657dc8048a25db728179f19a787b0a5c9d1
|
|
BLAKE2b-256 checksum How to use checksums |
42bfa0536041e1be4f62bb5083f9260e650ada4f43fc9b791c9957936c7d35ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp39-abi3-musllinux_1_2_aarch64.whl
| Download URL | ritk_python-0.12.79-cp39-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.9 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0d41ecab1f2ac8d7f2fe0acbeac2ce4f51e7ad1237ed2c3c8193232095c1135a
|
|
BLAKE2b-256 checksum How to use checksums |
b190a6383a59ff04fe55180ba5cce9458264c7ea1120a4cb964a20f9e9f3ed05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ritk_python-0.12.79-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 13.1 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4d350bec5cefdcd35f8c21987c4659153d75dc5a8c171249df709a9934e750a8
|
|
BLAKE2b-256 checksum How to use checksums |
998c144bd788bea4ba944df3256b37d10c19d290c6880a0cb986cb8d762580c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | ritk_python-0.12.79-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 10.3 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8c053bf1aeb488e629459fd9e31bf8868b3b787bc2fea016c5cac4726f2da3b6
|
|
BLAKE2b-256 checksum How to use checksums |
485cbb15ba0fe18cf147879ae2eb26aea3ab8600d01cf8a82d898b82e5465cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logRelease files / ritk_python-0.12.79-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | ritk_python-0.12.79-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 22.2 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0c148a7621b09c3eeb70e5aadbf7fb0af68daaa747c0deca795ced33859c5adc
|
|
BLAKE2b-256 checksum How to use checksums |
e5880fb4d78275be0c009dd751ca8df0f74d18f17553ba1873685c7f916d9963
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 12, 2026.
Transparency logSecurity for ritk-python 0.12.79
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 11 files in this release have been uploaded with provenance metadata.
Attestation for ritk_python-0.12.79.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 12, 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.