task
Prefect task for the GCC calculation step.
Consumes two RAW inference caches — retinal-layers segmentation predictions and fovea v7 landmark predictions (reused here as the macula centre) — plus the scan filter's filenames, and computes per-file Ganglion Cell Complex (GCC) asymmetry / glaucoma-staging metrics.
Delegates the per-file orchestration to the shared run_thickness_calculation
runner (which CST also reuses unchanged) and the metric maths to
compute_gcc_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 gcc_calculation cache table
(keyed by (task_hash, file_id), project_id provenance-only) and a downstream
step reads them via the gcc_calculation.cache accessor. An uncomputable file
is recorded as a reason string in error with a null metrics_json — never a
partial metrics object.
Module
Functions
gcc_calculation_task
def gcc_calculation_task( datasource: BaseSource, config: GCCCalculationConfig, layer_predictions: CacheAccessor, center_predictions: CacheAccessor, filenames: list[str], cache: CacheProtocol, task_hash: str, project_id: str | None = None, run_id: str | None = None,) ‑> GCCCalculationResult:Compute GCC 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: GCC 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). The fovea landmark is reused as the macula centre proxy until a dedicated macula landmark is available (TODO: [BIT-7356]).filenames: List of file IDs to process.cache: Cache instance to persist the GCC metrics into.task_hash: Partition key for thegcc_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
GCCCalculationResult carrying the number of rows persisted and a
CacheAccessor scoped to this task_hash (gcc_calculation.cache).