task
Prefect task for the CST/CRT calculation step.
Consumes two RAW inference caches — retinal-layers segmentation predictions and fovea v7 landmark predictions — plus the scan filter's filenames, and computes per-file Central Subfield Thickness / Central Retinal Thickness.
Delegates the per-file orchestration to the shared
run_thickness_calculation runner (which GCC reuses unchanged) and the
metric maths to compute_cst_metrics_for_scan.
Runs in background mode: an in-memory result does not cross the phase boundary,
so the per-file metrics are persisted to the cst_calculation cache table
(keyed by (task_hash, file_id), project_id provenance-only) and a downstream
step reads them via the cst_calculation.cache accessor.
Module
Functions
cst_calculation_task
def cst_calculation_task( datasource: BaseSource, config: CSTCalculationConfig, layer_predictions: CacheAccessor, center_predictions: CacheAccessor, filenames: list[str], cache: CacheProtocol, task_hash: str, project_id: str | None = None, run_id: str | None = None,) ‑> CSTCalculationResult:Compute CST/CRT metrics for each file and persist them to cache.
Arguments
datasource: The datasource providing DICOM metadata (slice thickness, pixel spacing row/column) for each file.config: CST calculation configuration.layer_predictions: Cache accessor for retinal-layers model inference results (background stepretinal_layers_inference.cache).center_predictions: Cache accessor for fovea model inference results (background stepfovea_inference.cache).filenames: List of file IDs to process.cache: Cache instance to persist the CST metrics into.task_hash: Partition key for thecst_calculationtable; a config change lands in a fresh partition.project_id: Provenance only — the project that triggered this run. NOT part of the cache key: rows are keyed by(task_hash, file_id)so two projects on the same datasource share them.run_id: Optional provenance run ID.
Returns
CSTCalculationResult carrying the number of rows persisted and a
CacheAccessor scoped to this task_hash (cst_calculation.cache).