KineticVoxelFeatures

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 KineticVoxelFeatures(timestamps: str | Mapping[str, Mapping[str, str]], phases: Sequence[str] = ('pre_contrast', 'LAP', 'PVP', 'delay_3min'), roi: str | None = None, time_format: str = '%H-%M-%S', modalities: Sequence[str] = (), expression: str | None = None)[source]

Bases: object

Per-voxel enhancement slopes across a dynamic contrast series.

A voxel’s absolute intensity depends on the scanner; how fast it takes up and releases contrast depends on its perfusion, so kinetic slopes separate tissue that looks identical on any single phase. Three slopes are produced: wash-in (unenhanced to arterial), and two wash-out segments (arterial to portal-venous, portal-venous to delayed).

Slopes are divided by the true inter-phase intervals, which differ between subjects, so the extractor needs each subject’s acquisition times. The unenhanced phase is placed PRE_CONTRAST_LEAD_SECONDS before the arterial phase, and negative wash-in is clipped to zero – both v0.1 conventions, preserved so published values stay reproducible.

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 – Modality keys of the series in acquisition order: unenhanced, arterial, portal-venous, delayed.

  • roi – Mask key defining the region of interest; None uses the subject’s single mask.

  • time_format – strptime format of the timestamp values.

  • modalities – Accepted for configuration compatibility and ignored; phases defines which images are read, because the four phases have fixed roles that a flat list cannot express.

  • expression – The original v0 method expression, carried for provenance when this extractor was reached by config translation.

Raises:

HABITAPIError – If phases does not name exactly four modalities.

__init__(timestamps: str | Mapping[str, Mapping[str, str]], phases: Sequence[str] = ('pre_contrast', 'LAP', 'PVP', 'delay_3min'), roi: str | None = None, time_format: str = '%H-%M-%S', modalities: Sequence[str] = (), expression: str | None = None) → None[source]
property spec: Spec

Return the algorithm specification used for provenance.

__call__(subject: Subject) → VoxelFeatureField[source]

Compute per-voxel kinetic slopes for one subject.

Parameters:

subject – Subject providing the four phase images and the mask.

Returns:

One row per ROI voxel and one column per slope.

Raises:
  • GeometryError – If a phase and the mask are on different grids.

  • HABITAPIError – If a phase image or an acquisition time is absent.