itasc.contact_analysis.quantifiers.cell_density

Cell-density quantifier — per-frame cell counts per field-of-view area.

Counts cells straight off the tracked cell labels (unique non-zero labels per frame), so it is a cell-labels quantity, not a contacts-derived one. The field-of-view area is required — it comes from the shared params bar and there is no silent image-area fallback; density = n_cells / fov_area_mm2 in cells/mm². One all total row per frame (label-agnostic). A pooled quantity: compute_object_table() builds the tidy table in memory (no per-position artifact).

Classes

CellDensityQuantifier()

Per (frame, label) cell count and density (cells/mm²).

class itasc.contact_analysis.quantifiers.cell_density.CellDensityQuantifier[source]

Bases: Quantifier

Per (frame, label) cell count and density (cells/mm²).

quantity_id: ClassVar[str] = 'cell_density'

Stable key; an empty value marks an intermediate (non-registered) base.

display_name: ClassVar[str] = 'Cell density'

Human-readable label shown wherever a quantity is selected.

requires: ClassVar[tuple[str, ...]] = ('cell_labels_path',)

PositionInputs field names this quantifier needs to build.

table_keys: ClassVar[tuple[str, ...]] = ('frame', 'label')

The index columns of this quantifier’s object_table — its natural grain (e.g. ("frame", "cell_id")). A non-empty value marks the quantity as aggregated: itasc.contact_analysis.shape_tables pools it across positions into a table named by quantity_id, keyed on these columns. Empty ⇒ not aggregated into an index-keyed table (e.g. contacts). Value columns are namespaced by quantity_id so a later joined view across tables never has colliding names.

wants_build_params: ClassVar[bool] = True

Whether the studio threads the shared plot/build params (z-score shuffle count, density field-of-view) into build() via params. Off by default so a quantifier with its own params schema (contacts edge extraction, shape, dynamics) is never handed the shared bar’s keys.

required_build_params: ClassVar[dict[str, str]] = {'fov_area_mm2': 'FOV area (mm²)'}

Shared build-param keys that must be present and positive for this quantifier to build, mapped to the human label shown in the UI (e.g. cell density needs {"fov_area_mm2": "FOV area (mm²)"}). The studio greys the metric out — rather than letting the build fail — until they are supplied. Empty for a quantifier that needs no shared param.

compute_object_table(inputs, *, params=None)[source]

The pooled tidy table for one position, computed directly from inputs.

A pooled quantifier (one that declares table_keys) implements this: it returns the same column-major table that object_table used to return after a disk round-trip, but never touches disk. None when this position yields no rows. Producers (contacts) are not pooled and do not implement it. params carries the shared build knobs (e.g. fov_area_mm2) for the quantifiers that opt in; per-position values (pixel size, frame interval) arrive via inputs.

Return type:

Mapping[str, ndarray]

Parameters: