Skip to content

registry

registry

DCE model registry for dynamic lookup.

This module provides the model registry and associated functions for registering, retrieving, and listing DCE pharmacokinetic models.

register_model

register_model(name)

Decorator to register a DCE pharmacokinetic model.

Registers a BasePerfusionModel subclass in MODEL_REGISTRY so it can be looked up by name via get_model() and used in fit_model() and the DCE pipeline.

PARAMETER DESCRIPTION
name

Registry key for the model (e.g. 'my_model').

TYPE: str

RETURNS DESCRIPTION
Callable

Class decorator.

Examples:

>>> from osipy.dce.models.registry import register_model
>>> from osipy.dce.models.base import BasePerfusionModel
>>> @register_model("my_model")
... class MyModel(BasePerfusionModel):
...     # implement abstract methods ...
...     pass
>>> from osipy.dce.models.registry import get_model
>>> model = get_model("my_model")

get_model

get_model(name)

Get model instance by name.

PARAMETER DESCRIPTION
name

Model name: 'tofts', 'extended_tofts', 'patlak', '2cxm', or any name added via register_model().

TYPE: str

RETURNS DESCRIPTION
BasePerfusionModel

Model instance.

RAISES DESCRIPTION
DataValidationError

If model name is not recognized.

list_models

list_models()

Return names of all registered DCE models.

RETURNS DESCRIPTION
list[str]

Sorted list of registered model names.