base
base
¶
Base class for pharmacokinetic perfusion models.
This module provides the abstract base class for all DCE/DSC pharmacokinetic models following the OSIPI CAPLEX lexicon.
References
.. [1] OSIPI CAPLEX, https://osipi.github.io/OSIPI_CAPLEX/ .. [2] Tofts PS et al. J Magn Reson Imaging 1999;10(3):223-232. .. [3] Sourbron SP, Buckley DL. MRM 2011;66(3):735-745.
BasePerfusionModel
¶
Bases: BaseSignalModel
Abstract base class for perfusion pharmacokinetic models.
All DCE/DSC models must inherit from this class and implement the required methods.
Notes
Type parameter P is a ModelParameters dataclass
type for model-specific parameters.
Examples:
>>> class ToftsParams(ModelParameters):
... ktrans: float
... ve: float
>>> class ToftsModel(BasePerfusionModel[ToftsParams]):
... # Implementation
... pass
References
All implementations MUST include primary literature reference.
time_unit
property
¶
Return the time unit used internally by this model.
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
name
abstractmethod
property
¶
Return human-readable model name.
| RETURNS | DESCRIPTION |
|---|---|
str
|
Model name for display and logging. |
parameters
abstractmethod
property
¶
Return list of parameter names following OSIPI terminology.
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
Parameter names (e.g., ['Ktrans', 've', 'vp']). |
predict
¶
Predict tissue concentration given parameters.
Accepts both dict/dataclass and array parameters transparently.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time points in seconds.
TYPE:
|
aif
|
Arterial input function concentration.
TYPE:
|
params
|
Parameter array
TYPE:
|
xp
|
Array module (numpy or cupy). Inferred from t when omitted.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NDArray[floating]
|
Predicted tissue concentration. |
get_bounds
abstractmethod
¶
Return physiological parameter bounds.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, tuple[float, float]]
|
Mapping of parameter names to (lower, upper) bounds. |
get_initial_guess
abstractmethod
¶
Compute initial parameter guess from data.
| PARAMETER | DESCRIPTION |
|---|---|
ct
|
Tissue concentration curve.
TYPE:
|
aif
|
Arterial input function.
TYPE:
|
t
|
Time points.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
P
|
Initial parameter estimates. |
get_initial_guess_batch
¶
Compute initial parameter guesses for a batch of voxels.
Default implementation loops over voxels using get_initial_guess(). Subclasses should override with vectorized implementations.
| PARAMETER | DESCRIPTION |
|---|---|
ct_batch
|
Tissue concentration curves, shape (n_timepoints, n_voxels).
TYPE:
|
aif
|
Arterial input function, shape (n_timepoints,).
TYPE:
|
t
|
Time points in seconds, shape (n_timepoints,).
TYPE:
|
xp
|
Array module (numpy or cupy).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NDArray[floating]
|
Initial parameter guesses, shape (n_params, n_voxels). |
predict_batch
¶
Predict tissue concentration for multiple voxels simultaneously.
Reshapes t and aif to column vectors and delegates to
:meth:predict, which uses broadcasting to handle the batch
dimension automatically. No per-voxel loop is needed.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
Time points in seconds, shape (n_timepoints,).
TYPE:
|
aif
|
Arterial input function, shape
TYPE:
|
params_batch
|
Parameter values for all voxels, shape (n_params, n_voxels). Row order must match self.parameters.
TYPE:
|
xp
|
Array module to use (numpy or cupy).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NDArray[floating]
|
Predicted tissue concentrations, shape (n_timepoints, n_voxels). |