scene¶
Scene management and mesh rendering helpers.
RenderResult
dataclass
¶
Result of one render pass.
Scene
dataclass
¶
Scene(
plotter,
active_actor=None,
xdmf_mesh=None,
xdmf_actor=None,
xdmf_surface=None,
xdmf_point_ids=None,
xdmf_cell_ids=None,
)
One plotter and the actors its in-place updates act on.
TrameCtrl
¶
set_background
¶
Set the gradient background of scene for dark_mode.
clear_scene
¶
Remove every actor from scene, drop its tracked actors and set the background for dark_mode.
push_scene
¶
Render scene, reset the camera when reset_camera and push the scene to the client.
update_actor_palette
¶
Swap the active actor's categorical LUT to the first n of colors in place and push the scene.
update_scalar_field_view
¶
update_scalar_field_view(
scene,
ctrl,
ddir,
mesh_file,
field,
categorical_fields,
zone_labels,
palette,
cmap,
percentile=_PERCENTILE_CLAMP,
)
Switch the active actor's mapper to field in place and return (legend, scalar bar).
update_scalar_range
¶
Set the active actor's scalar range to clim in place and return the scalar bar dict.
redraw_xdmf
¶
redraw_xdmf(
scene,
ctrl,
path,
xdmf_meta,
dark_mode,
opacity,
field=None,
step=0,
reset_camera=True,
cmap="viridis",
mesh_meta=None,
)
Render step step of the time series at path and return the RenderResult.
update_xdmf_step
¶
Copy step step onto the live frame and its skin in place and return (updated, stats, scalar bar).
redraw_ircadb
¶
Render every organ mesh in patient_dir as one merged actor and return the RenderResult.
redraw_stl_surface
¶
redraw_stl_surface(
scene,
ctrl,
dataset_dir,
dark_mode,
opacity,
filename,
palette=None,
reset_camera=True,
)
Render the closed, geometry-only STL/OBJ surface filename in one solid colour and return the RenderResult.
redraw_region_surface_step
¶
redraw_region_surface_step(
scene,
ctrl,
pvd_path,
dark_mode,
opacity,
step,
palette=None,
reset_camera=True,
solid=True,
)
Render phase step of the region-coloured PVD surface series at pvd_path (GRASP MRI) and return the RenderResult.
redraw_scalar_field
¶
redraw_scalar_field(
scene,
ctrl,
dataset_dir,
dark_mode,
opacity,
mesh_file,
field,
categorical_fields,
zone_labels,
palette=None,
cmap="viridis",
percentile=_PERCENTILE_CLAMP,
reset_camera=True,
)
Render mesh_file coloured by field, as zones with a legend when categorical or a ramp clamped at percentile, and return the RenderResult.