vtklocal

class trame.widgets.vtklocal.LocalView(render_window, throttle_rate=10, **kwargs)

Bases: AbstractElement

LocalView allow to mirror a server side vtkRenderWindow on the client side using VTK.wasm.

Args:
render_window (vtkRenderWindow):

Specify the VTK window to mirror

throttle_rate (number):

Number of update per second the render_throttle() method will actually perform.

cache_size (number):

Size of client side cache for geometry and arrays in Bytes.

eager_sync (bool):

If enabled, the server will push states rather than waiting for the client to request them. Usually improve fast update behavior.

listeners (dict):

Dynamic structure describing what to observe and how to map internal WASM state to trame state variable.

updated (event):

Emitted after each completed client side update.

memory_vtk (event):

Event which provides the current memory used by vtk object structures.

memory_arrays (event):

Event which provides the current memory used by vtk arrays.

camera (event):

Event emitted when any camera is changed. The actual state of the camera is passed as arg.

property api

Return API from helper

property object_manager

Return object_manager

eval(state_mapping)

Evaluate WASM state extract and map it onto trame state variables

>>> html_view.eval({
...    "trame_state_name": {
...        "prop_name1": (wasm_id, "PropName"),
...        "origin": (wasm_id, "WidgetRepresentation", "origin"),
...        "widget_state": widget_id,
...    }
... }
property update_throttle

Throttled update method on which you can update its rate by doing

>>> html_view.update_throttle.rate = 15  # time per second
>>> html_view.update_throttle()
update(push_camera=False)

Sync view by pushing updates to client

register_widget(w)

Register external element (i.e. widget) into the scene so it can be managed and return its wasm_id

uregister_widgets()

Unregister external element (i.e. widget) from the scene so it can removed from tracking

export(format='zip', **kwargs)

Export standalone scene for WASMViewer

Parameters:

format – Can be either be “zip” or “json”.

reset_camera(renderer_or_render_window=None, **kwargs)

Reset camera by making the call on the client side

property ref_name

Return the assigned name as a vue.js ref

get_wasm_id(vtk_object)

Return vtkObject id used within WASM scene manager