PyVista interactive visualization
Minimal example of interactive visualization using pyvista and the synthetic test data¶
As we need to build the full mesh first, initial loading times for large grids can be slow. After loading, rendering updates should be fairly fast for small window sizes.
Note: pyvista must be installed with pyvista[jupyter]
Note: if the display remains blank (does not show loading screen), try restarting the kernel and rerunning
In [4]:
Copied!
import pyvista as pv
from occpy import OccPy
from occpy.visualization import vis_pv_interactive
import pyvista as pv
from occpy import OccPy
from occpy.visualization import vis_pv_interactive
In [5]:
Copied!
root_occpy_dir = r"C:\Users\Kueken\dev\occpy_dev\OccPy"
grid = f"{root_occpy_dir}/tests/fixtures/two_sensor_case/expected/Classification.npy"
min_bound = [0, 0, 0]
max_bound = [10, 10, 10]
config_file = f"{root_occpy_dir}/tests/fixtures/two_sensor_case/case_config.json"
pc_file = f"{root_occpy_dir}/tests/fixtures/two_sensor_case/input/laz/001_synthetic.laz"
root_occpy_dir = r"C:\Users\Kueken\dev\occpy_dev\OccPy"
grid = f"{root_occpy_dir}/tests/fixtures/two_sensor_case/expected/Classification.npy"
min_bound = [0, 0, 0]
max_bound = [10, 10, 10]
config_file = f"{root_occpy_dir}/tests/fixtures/two_sensor_case/case_config.json"
pc_file = f"{root_occpy_dir}/tests/fixtures/two_sensor_case/input/laz/001_synthetic.laz"
In [6]:
Copied!
plotter = vis_pv_interactive(grid, min_bound, max_bound, config_file, pointcloud_file=pc_file, point_size=5)
plotter = vis_pv_interactive(grid, min_bound, max_bound, config_file, pointcloud_file=pc_file, point_size=5)
occmap shape: (20, 20, 20) Constructing meshes, can be slow for large grids Mesh construction done
In [7]:
Copied!
pv.set_jupyter_backend('trame')
plotter.show()
pv.set_jupyter_backend('trame')
plotter.show()
Widget(value='<iframe src="http://localhost:57877/index.html?ui=P_0x16cd4802e90_0&reconnect=auto" class="pyvis…