cedalion.vis.anatomy.image_recon
- cedalion.vis.anatomy.image_recon(
- X: Annotated[DataArray, DataArraySchema(dims='time', coords='time', 'time', 'samples')],
- head: TwoSurfaceHeadModel,
- cmap: str | Colormap = 'seismic',
- clim=None,
- view_type: str = 'hbo_brain',
- view_position: str = 'superior',
- p0=None,
- title_str: str = None,
- off_screen: bool = False,
- plotshape=(1, 1),
- iax=(0, 0),
- show_scalar_bar: bool = False,
- wdw_size: tuple = (1024, 768),
Render a single frame of brain or scalp activity on a specified view.
This function creates (or reuses) a PyVista plotter, applies a custom colormap, sets the camera view according to the given view_position, adds the surface mesh with the scalar data (extracted from X), and returns the plotter, the mesh, and a text label.
- Parameters:
X – cdt.NDTimeSeries (or similar) Scalar data for the current frame. Expected to have a boolean attribute is_brain indicating brain vs. non-brain vertices, and HbO / HbR chromophore dimension
head – TwoSurfaceHeadModel A head model containing attributes such as head.brain and head.scalp.
cmap – str or matplotlib.colors.Colormap, default ‘seismic’ The colormap to use.
clim – tuple, optional Color limits. If None, they are computed from the data.
view_type – str, default ‘hbo_brain’ Indicates whether to plot brain (‘hbo_brain’ or ‘hbr_brain’) or scalp (‘hbo_scalp’ or ‘hbr_scalp’) data.
view_position – str, default ‘superior’ The view direction. Options are: ‘superior’, ‘anterior’, ‘posterior’,’left’, ‘right’, and ‘scale_bar’.
p0 – PyVista Plotter instance, optional If provided the mesh is added to this plotter; else a new plotter is created
title_str – str, optional Title to use on the scalar bar.
off_screen – bool, default False Whether to use off-screen rendering.
plotshape – tuple, default (1, 1) The subplot grid shape.
iax – tuple, default (0, 0) The target subplot index (row, col).
show_scalar_bar – bool, optional Flag to control scalar bar visibility
wdw_size – tuple, default (1024, 768) The window size for the plotter (the plot resolution)
- Returns:
p0: the PyVista Plotter instance.
surf: the wrapped surface mesh (a pyvista mesh).
surf_label: a text actor (e.g., the scalar bar label).
- Return type:
A tuple (p0, surf, surf_label) where
Initial Contributors: - David Boas | dboas@bu.edu | 2025 - Laura Carlton | lcarlton@bu.edu | 2025 - Alexander von Lühmann | vonluehmann@tu-berlin.de | 2025