KineticCombiner

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class KineticCombiner(timestamps: str | Mapping[str, Mapping[str, str]], phases: Sequence[str] = (), time_format: str = '%H-%M-%S')[source]

Bases: object

Per-unit enhancement slopes across a dynamic contrast series.

The block-level counterpart of the kinetic voxel extractor: the four phase intensities arrive as child blocks – typically raw(phase) leaves in acquisition order – instead of being read from the subject’s images. Both forms share the same slope math and column names (FEATURE_NAMES), so the combiner is the explicit-tree spelling of the same algorithm.

Example:

kinetic(
    raw("pre_contrast"), raw("LAP"), raw("PVP"), raw("delay_3min"),
    timestamps="times.csv",
)
Parameters:
  • timestamps – Acquisition times per subject, either as a mapping {subject_id: {phase: "HH-MM-SS"}} for API callers, or a path to the v0.1 timestamp table.

  • phases – Phase labels in acquisition order (unenhanced, arterial, portal-venous, delayed). Empty resolves to the merged child column names – for raw children, their modality names.

  • time_format – strptime format of the timestamp values.

__init__(timestamps: str | Mapping[str, Mapping[str, str]], phases: Sequence[str] = (), time_format: str = '%H-%M-%S') → None[source]
property spec: Spec

Return the algorithm specification used for provenance.

__call__(blocks: Sequence[DataFrame], *, context: Mapping[str, Any] | None = None) → DataFrame[source]

Compute the three kinetic slopes from the child phase blocks.

Parameters:
  • blocks – Child blocks whose merged column count is exactly four, in acquisition order (unenhanced, arterial, portal-venous, delayed).

  • context – Must carry "subject_id" so the subject’s acquisition times can be resolved.

Returns:

One column per slope, named as FEATURE_NAMES.

Raises:

HABITAPIError – If the merged block does not hold exactly four columns, the subject id is missing from the context, or the subject has no acquisition times.