brain_deer.infrastructure.bids.swap¶
Differential BIDS subject swap: keep scene settings, replace only payloads.
BrainDeer layers that came from a BIDS bundle are identified by a role key
(entities except sub + suffix). Switching subjects builds a swap plan:
keep — same role, same absolute path (noop)
replace — same role, new path → hot-swap image/path/bids, preserve display
remove — role gone in the new subject
add — role present only in the new subject
Shared (non-BIDS) layers are never touched.
Functions¶
|
Map role key → |
|
Diff current BIDS layers against |
|
Hot-swap path/image/bids on an existing layer; keep scene display fields. |
|
Execute a |
Module Contents¶
- brain_deer.infrastructure.bids.swap.index_bids_layers_by_role(main_window, *, dataset_root: str | None = None) dict[str, str]¶
Map role key →
loaded_fileskey for BIDS-backed layers.
- brain_deer.infrastructure.bids.swap.plan_subject_swap(main_window, new_items: list[brain_deer.infrastructure.bids.entities.BIDSItem], *, dataset_root: str, subject: str, session: str | None, bundle: str) SwapPlan¶
Diff current BIDS layers against
new_itemsfor one subject switch.
- brain_deer.infrastructure.bids.swap.replace_layer_payload(main_window, layer_key: str, item: brain_deer.infrastructure.bids.entities.BIDSItem, mapper: brain_deer.infrastructure.bids.mapper.BIDSMapper, *, events_path: pathlib.Path | None = None) None¶
Hot-swap path/image/bids on an existing layer; keep scene display fields.
- brain_deer.infrastructure.bids.swap.apply_subject_swap(main_window, plan: SwapPlan, mapper: brain_deer.infrastructure.bids.mapper.BIDSMapper, dataset) list[str]¶
Execute a
SwapPlan. Returns the active BIDS layer keys afterward.