brain_deer.infrastructure.bids.subject_switch

Differential unload/reload of BIDS layers when changing subject/session.

Functions

unload_bids_layers(→ list[str])

Remove BIDS-backed layers from the scene. Returns removed keys.

switch_bids_subject(→ list[str])

Swap BIDS layers to subject while preserving scene settings.

Module Contents

brain_deer.infrastructure.bids.subject_switch.unload_bids_layers(main_window, *, dataset_root: str | None = None, subject: str | None = None) → list[str]

Remove BIDS-backed layers from the scene. Returns removed keys.

brain_deer.infrastructure.bids.subject_switch.switch_bids_subject(main_window, dataset: brain_deer.infrastructure.bids.layout.BIDSDataset, subject: str, *, session: str | None = None, bundle: str | None = None, mapper: brain_deer.infrastructure.bids.mapper.BIDSMapper | None = None) → list[str]

Swap BIDS layers to subject while preserving scene settings.

Roles present in both the current scene and the new subject’s bundle are hot-swapped (new path/image, same opacity/colormap/visibility/…). Roles only on the old subject are removed; roles only on the new subject are added. Non-BIDS layers (atlases, manual loads) are left alone.