metadata_parser.resolve_channel_roles()

Resolve channel role assignments (nucleus / cell) from channel names.

Usage

Source

metadata_parser.resolve_channel_roles(channel_data)

Resolution rules, in priority order:

  1. Suffix _nucleus (case-insensitive) → role nucleus.
  2. Suffix _cell (case-insensitive) → role cell.
  3. Name (lower-cased) in NUCLEUS_ALIASES → role nucleus.
  4. Name contains "Tub" (legacy) → role cell.
  5. Otherwise → no role (channel is a feature channel only).

Parameters

channel_data: dict[str, int]
Mapping of channel name → channel index. Names are preserved verbatim; this function does not mutate the input.

Returns

dict[str, str]

Mapping {role: channel_name} containing at most one entry per role.

Keys are a subset of {"nucleus", "cell"}.

Raises

ChannelAnnotationError
If no nucleus role can be resolved, or if two channels resolve to the same role.