Hi,
I’m using Bokeh with Dash to render 3D Data using VTKVolume.
The bokeh server executed :
#!/usr/bin/python3.8
import os
import sys
import time
import panel as pn
pn.extension('vtk')
def make_vtk_vol(meta, volume_datas):
DX = float(meta["dx"])
DY = float(meta["dy"])
DT = float(meta["dt"])
print(meta)
vol = pn.pane.VTKVolume(
volume_datas,
spacing=(DX, DY, DT),
sizing_mode='stretch_both',
interpolation='fast_linear',
colormap="Rainbow Blended White",
render_background="#c0c0c0",
edge_gradient=1,
sampling=1.0,
rescale=True,
shadow=False,
orientation_widget=True,
)
return vol
def app3d():
meta, datas = getVisuData() # datas is 3D Numpy array, metas is a dictionnary of property
vol = make_vtk_vol(meta, datas)
controls = vol.controls(jslink=True)
# print(controls)
# Select index of interesting controls widget
good_index = [7, 8, 10, 11, 12, 13, 15, 18, 21, 22, 23]
subcontrols = [controls[0][i] for i in good_index]
controls[0] = pn.WidgetBox(name='Controls')
for (i, x) in enumerate(subcontrols):
controls[0].append(x)
html_title = pn.pane.HTML(
"""
<h3>Visualization <h3/>
<hr>
"""
)
controls[0].insert(0, html_title)
row = pn.Row(controls[0], vol, sizing_mode="stretch_both", scroll=False)
row.servable()
app3d()
Now the volume rendering works fine, but there is an issue with viewing slices.
Whenever I interact with the Slider to change slice it has a buggy behaviour and jump to numbers that have nothing to do with the range I clicked at on the slider.
If I click on the middle of the slider it will either go down to a very small number or increase to numbers outside volume range. Using slice is simply unusable because I can’t select a correct index on a slider.
What could cause this behaviour ? How can I fix it ?