Introduction To Trame
Introduction To Trame
Sebastien Jourdain
Outline (~2 hours)
⬣ Trame and vtk(.js)
⬣ Introduction ● Usage exploration
● What is trame? ⬣ Cheat sheets
● How trame works? ● Syntax explained
● Why is it revolutionary? ⬣ Cookiecutter
⬣ Getting started ● Standardisation for python
● Documentation ⬣ ParaView gotcha
● Tutorial & examples ● pvpython is not your python
● Cookie cutter ⬣ Deployment
● Desktop, jupyter and cloud
Introduction
15 minutes
What is trame?
⬣ Simple
All the logic and UI definition can be done in plain Python
⬣ Powerful
Python offer scientific and information data visualization with
capable data processing (numpy, Plotly, Matplotlib, VTK, ParaView…)
⬣ Ubiquitous
Runs on laptops, desktops, clusters, and the cloud while displaying
everywhere (phone, tablet, laptop, workstation)
How trame works?
Maintenance
cost
⬣ Documentation
● https://kitware.github.io/trame/
● https://trame.readthedocs.io/
⬣ Tutorial & Examples
● https://github.com/Kitware/trame-tutorial
● https://github.com/Kitware/trame => ./examples
⬣ Cookiecutter
● https://github.com/Kitware/trame-cookiecutter
Trame and VTK
50 minutes
VTK (C++, Python) Vtk.js
⬣ Server only (python) ⬣ Client only (browser)
⬣ I/O ⬣ Rendering
⬣ Data processing ⬣ Limited processing
⬣ Rendering ⬣ Limited I/O
trame
How many ways can you make the same application?
vtk_class=
python ./trame/examples/06_vtk/00_ClientOnly/client-side-cone.py
VTK mesh rendering
python ./trame/examples/06_vtk/01_SimpleCone/LocalRendering.py
VTK rendering with rendering
python ./trame/examples/06_vtk/01_SimpleCone/RemoteRendering.py
What you’ve seen?
⬣ Layout (trame.ui.*)
⬣ Widgets (trame.widgets.*)
⬣ Trame server, state, controller (trame.app.get_server)
● State usage, initial value, monitoring changes
● Method binding with UI and/or controller
⬣ VTK can be integrated with various granularity
● vtk.js only
● VTK mesh and vtk.js rendering
● VTK rendering with either local or remote rendering
Cheat sheets
10 minutes
State handling
Shared
State
Method handling and controller helper
Method calls
From JavaScript to Python
@click=... click=...
Any invalid Python character become “_” for any given attribute key.
https://vuetifyjs.com/en/components/tooltips/
Cookiecutter
25 minutes
Making your own application (Cookiecutter)
visualis --app
jupyter-lab
show(height=200)
ParaView
10 minutes
ParaView Gotcha
⬣ Desktop
● pywebview + pyinstaller
● Use tk for file dialog and skip browser security limitation
⬣ Cloud service
● Docker image with multi users routing for a single node
● Reverse connection + relay (infinity scaling)
⬣ Jupyter
● Trame provides helpers to run and display your
application within your Jupyter cells
Examples
Applications
Questions / Discussions
[email protected]
Additional materials
⬣ Trame
● https://kitware.github.io/trame/
⬣ Course video
● https://vimeo.com/761096621/af2287747f
⬣ Course materials
● https://github.com/Kitware/trame-tutorial/tree/master/course/introduction