Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ivimfit-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ivimfit-0.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file ivimfit-0.1.1.tar.gz.

File metadata

  • Download URL: ivimfit-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for ivimfit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 29f383d888d38813f28c41519bcc19b9023bd99fbc5106cfba15c485791d2e0f
MD5 4320d088c0c02afcdc7fc0bd727e3600
BLAKE2b-256 99a8927220a79588d178a50a44d2c236fc40b9ba739ef21395e0a3af2435319a

See more details on using hashes here.

File details

Details for the file ivimfit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ivimfit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for ivimfit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4251ddafc59b8b3334d2ed5441738bb29828ab1c6c6963a8c9235ff04c34797
MD5 efa94ac7912041954c844f3f27868b7e
BLAKE2b-256 4ef36d2708372a0cf38ebdca69203ae46f817d1772e2bfa99d8e07a250c51ad4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page