brain_deer.surface.figures¶
Publication output for Surface Studio: multi-view figures, video, glTF, presets.
export_multiview_figure()renders the scene from several canonical views and lays them out in a labelled grid with a shared colour bar (PNG/SVG, high-DPI).export_rotation_video()spins the camera and writes a video (optionalimageio) or a numbered PNG frame sequence as a fallback.export_scene_gltf()writes the current scene to glTF for Blender.Scene presets (
scene_to_preset()/apply_preset()) save & restore the presentation settings (colormap, vmin/vmax, threshold, views, background) as JSON, without the heavy geometry.
The pure compositor (compose_grid()) and preset (de)serialisation are numpy/JSON
only and unit-tested headlessly; the rendering entry points need a live viewer.
Functions¶
|
Tile RGB images (H,W,3 uint8) into a padded grid; cells are size-normalised. |
|
Render |
|
Spin the camera 360° and save a video (imageio) or PNG frame sequence. |
|
Export the current surface scene to a glTF file for Blender/other engines. |
|
Serialise presentation settings (not geometry) to a JSON-able dict. |
|
Apply a preset's presentation settings onto an existing scene in place. |
Module Contents¶
- brain_deer.surface.figures.compose_grid(images: Sequence[numpy.ndarray], *, ncols: int | None = None, pad: int = 12, bg: tuple[int, int, int] = (255, 255, 255)) numpy.ndarray¶
Tile RGB images (H,W,3 uint8) into a padded grid; cells are size-normalised.
All cells use the max height/width across inputs so ragged sizes still align.
- brain_deer.surface.figures.export_multiview_figure(viewer, scene: brain_deer.surface.scene_model.SceneModel, path: str, *, views: Sequence[str] | None = None, size: tuple[int, int] = (700, 700), dpi: int = 200, ncols: int | None = None, show_labels: bool = True) str¶
Render
scenefromviewsand save a labelled grid figure (PNG/SVG).
- brain_deer.surface.figures.export_rotation_video(viewer, path: str, *, n_frames: int = 36, size: tuple[int, int] = (700, 700), fps: int = 20, axis: str = 'azimuth') str¶
Spin the camera 360° and save a video (imageio) or PNG frame sequence.
- brain_deer.surface.figures.export_scene_gltf(viewer, path: str) str¶
Export the current surface scene to a glTF file for Blender/other engines.
- brain_deer.surface.figures.scene_to_preset(scene: brain_deer.surface.scene_model.SceneModel) dict¶
Serialise presentation settings (not geometry) to a JSON-able dict.
- brain_deer.surface.figures.apply_preset(scene: brain_deer.surface.scene_model.SceneModel, preset: dict) brain_deer.surface.scene_model.SceneModel¶
Apply a preset’s presentation settings onto an existing scene in place.