metadata_parser.resolve_channel_roles()
Resolve channel role assignments (nucleus / cell) from channel names.
Usage
metadata_parser.resolve_channel_roles(channel_data)Resolution rules, in priority order:
- Suffix
_nucleus(case-insensitive) → rolenucleus. - Suffix
_cell(case-insensitive) → rolecell. - Name (lower-cased) in
NUCLEUS_ALIASES→ rolenucleus. - Name contains
"Tub"(legacy) → rolecell. - 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
Keys are a subset of{role: channel_name}containing at most one entry per role.{"nucleus", "cell"}.
Raises
ChannelAnnotationError- If no nucleus role can be resolved, or if two channels resolve to the same role.