Skip to content

osipy

Unified OSIPI-compliant MRI perfusion analysis.

Get Started View on GitHub

GSoC Contributors — Read This First

Do not open issues or pull requests before reaching out. Join the OSIPI Slack workspace and introduce yourself in the project channel. Discuss your proposed contribution with a maintainer before writing any code or filing issues. Issues and PRs containing AI-generated content (ChatGPT, Copilot, etc.) will be closed without review. We value quality contributions — come talk to us first so we can help you succeed.

Dev Release (v0.1.0)

osipy is under active development and has not been validated for clinical, research, or any other use. Do not use in professional imaging pipelines — testing and validation are still in progress. APIs may change between releases.

  • OSIPI Standards


    All naming, units, and symbols follow CAPLEX and the ASL Lexicon.

  • CPU & GPU


    Array-module abstraction (xp) runs identical code on NumPy or CuPy without changes.

  • Registry-Driven


    Add a model or method with one file and one decorator. No wiring code needed.

  • Fast


    Vectorized Levenberg-Marquardt fitting and batch processing — fast on both CPU and GPU.

Modalities

DCE-MRI

Pharmacokinetic modeling: Tofts, Extended Tofts, Patlak, 2CXM, 2CUM. T1 mapping, signal-to-concentration conversion, population and patient-specific AIFs.

Tutorial

DSC-MRI

SVD-based deconvolution (sSVD, cSVD, oSVD, Tikhonov). Bolus arrival detection, leakage correction, concentration-time curve processing.

Tutorial

ASL

CBF quantification for pCASL and PASL. Single and multi-PLD support, M0 calibration, arterial transit time estimation.

Tutorial

IVIM

Bi-exponential diffusion fitting: segmented, full, and Bayesian strategies for D, D*, and perfusion fraction.

Tutorial

Quick Start

# Interactive wizard — walks you through every option
osipy --help-me-pls

# Or start from a default template
osipy --dump-defaults dce > config.yaml

# Then run
osipy config.yaml /path/to/dce_data.nii.gz
import numpy as np
import osipy

# Load DCE-MRI data
dataset = osipy.load_nifti("dce_data.nii.gz")

# Time array (seconds)
time_array = np.arange(dataset.shape[-1]) * 3.5

# Population AIF
aif = osipy.ParkerAIF()(time_array)

# Fit Extended Tofts model
result = osipy.fit_model(
    "extended_tofts",
    concentration=dataset.data,
    aif=aif,
    time=time_array,
)

# Parameter maps
ktrans = result.parameter_maps["Ktrans"].values
ve = result.parameter_maps["ve"].values
vp = result.parameter_maps["vp"].values

Installation

pip install osipy
uv add osipy
pip install osipy[gpu]
git clone https://github.com/OSIPI/osipy.git
cd osipy
pip install -e ".[dev]"