A Python library for IVIM diffusion MRI model fitting
Project description
ivimfit
ivimfit is a modular Python library for fitting Intravoxel Incoherent Motion (IVIM) diffusion MRI models.
It supports monoexponential ADC fitting, biexponential (free and segmented) models, as well as Bayesian inference using PyMC.
Designed for researchers and clinicians working with DWI/IVIM datasets, this package offers signal filtering, robust modeling, and visualization tools for parameter evaluation.
📦 Features
- ✅ Monoexponential ADC fitting
- ✅ Full biexponential model (nonlinear free fit)
- ✅ Segmented biexponential model (2-step D + [f, D*])
- ✅ Bayesian IVIM modeling using MCMC via PyMC
- ✅ Optional exclusion of b = 0
- ✅ Automatic filtering of b-values > 1000
- ✅ R² calculation and signal-fit visualization utilities
🧳 License
This project is licensed under the MIT License - see the [LICENSE] file for details.
📥 Installation
For local development:
pip install ivimfit .
Example:
import numpy as np
from ivimfit.biexp import fit_biexp_free
from ivimfit.utils import plot_fit, calculate_r_squared
from ivimfit.biexp import biexp_model
import matplotlib.pyplot as plt
# Simulated IVIM signal
b = np.array([0, 50, 100, 200, 400, 600, 800])
s = 0.12 * np.exp(-b * 0.02) + 0.88 * np.exp(-b * 0.0012)
# Fit
f, D, D_star = fit_biexp_free(b, s, omit_b0=False)
# Plot
fig, ax = plot_fit(b, s, biexp_model, [f, D, D_star], model_name="IVIM Free Fit")
plt.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ivimfit-0.1.0.tar.gz.
File metadata
- Download URL: ivimfit-0.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
501badfb048d80e90836cdaf78caeb77f8fc03be781cf22822fbd342c9348d31
|
|
| MD5 |
03f103ba112bf82985c22400bc5c11bb
|
|
| BLAKE2b-256 |
5e7a9dc9a86ddbc40884358c7b66df615dadcdad068effbb2907952288108120
|
File details
Details for the file ivimfit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ivimfit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
facd2c68ae71d8ef3cf62923806033178270d27177f6ef3e8055eeda9e50832a
|
|
| MD5 |
6f523cdddb1a84d89345f87fd0084f58
|
|
| BLAKE2b-256 |
f3d676839ef1dc39a81d495b135e1de9e56f58e0ba9e0e392803481d74230c45
|