brain_deer.surface.scene_model¶
Backend-agnostic description of a Surface Studio scene.
These are pure dataclasses plus canonical-view camera math. The renderer
(brain_deer.rendering.surface_studio) consumes a SceneModel;
keeping it VTK-free means scene construction and view geometry are unit-testable
without a display.
Coordinate convention: all geometry is in RAS+ millimetres (surfaces sit in
their native template mm; the template scene uses an identity world<->scene map).
Camera “views” are named the same as yabplot (left_lateral etc.) so figures
are directly comparable.
Classes¶
Camera placement relative to the focal point at the scene centre. |
|
How a layer's scalar values map to colour. |
|
A triangulated surface with optional per-vertex scalar values. |
|
Spheres at 3D positions (connectome nodes, subcortical centroids). |
|
Tubes connecting node positions (connectome edges). |
|
White-matter streamlines rendered as tubes. |
|
A full Surface Studio scene: layers + presentation settings. |
Functions¶
|
Return a |
|
Which hemisphere a view emphasises ('lh'/'rh'), or None for symmetric views. |
Module Contents¶
- class brain_deer.surface.scene_model.CameraPose¶
Camera placement relative to the focal point at the scene centre.
positionandview_upare unit-ish direction vectors; the renderer scalespositionby the scene bounds to frame the brain.
- brain_deer.surface.scene_model.camera_for_view(view: str) CameraPose¶
Return a
CameraPosefor a canonical (or aliased) view name.
- brain_deer.surface.scene_model.hemi_for_view(view: str) str | None¶
Which hemisphere a view emphasises (‘lh’/’rh’), or None for symmetric views.
- class brain_deer.surface.scene_model.Coloring¶
How a layer’s scalar values map to colour.
modeis ‘scalar’ (colormap over [vmin, vmax]), ‘direct’ (per-vertex RGBA baked into the layer, matching 2D slice colours), ‘solid’ (single colour), or ‘label’ (per-region RGB baked into the layer).thresholdhides values whose magnitude is below it (NaN’d out -> transparent), matching yabplot masking.
- class brain_deer.surface.scene_model.SurfaceLayer¶
A triangulated surface with optional per-vertex scalar values.
verticesis (N,3) float mm,facesis (M,3) int.valuesis either per-vertex (len N) or None (solid/label colouring).vertex_rgbis optional baked per-vertex colour (N,3 or N,4 in 0..1) for label parcellations.
- class brain_deer.surface.scene_model.PointsLayer¶
Spheres at 3D positions (connectome nodes, subcortical centroids).
- class brain_deer.surface.scene_model.EdgesLayer¶
Tubes connecting node positions (connectome edges).
- class brain_deer.surface.scene_model.TractLayer¶
White-matter streamlines rendered as tubes.
streamlinesis a list of (P_i, 3) polylines in mm.scalars(optional) is a matching list of per-point values (tractometry) coloured viacoloring; if absent,solid_coloris used.
- class brain_deer.surface.scene_model.SceneModel¶
A full Surface Studio scene: layers + presentation settings.
- all_positions() numpy.ndarray¶
Stack every layer’s coordinates for computing scene bounds/centre.