How to initialize specific pages for each user in a multi-user environment? #461
-
I've implemented multi-user remote rendering support using Docker, but there's an issue I haven't resolved yet. I want to individually render specific images for each user who opens a page. I found a way to get the query string from the URL in discussion #83, but import SimpleITK as sitk
from trame.widgets import trame
import pyvista
...
@ctrl.set("get_search")
def get_search(search):
# Here, the file name was obtained
file = search[1:].split("&")[0].split("=")[1]
print("search", search)
# initialize belike
image = sitk.ReadImage("data/xxx.nii.gz") # I hope to load files here
imageViewer1 = vtkImageViewer2()
volume = pv.ImageData()
colorMap = vtkImageMapToColors()
pColorTable = vtkLookupTable()
imageBlend = vtkImageBlend()
volume.origin = image.GetOrigin()
volume.spacing = image.GetSpacing()
volume.dimensions = sobel_np.shape
volume.point_data["values"] = sobel_np.flatten(order="F")
pColorTable.SetTableRange(0, 23)
pColorTable.SetNumberOfTableValues(24)
pColorTable.SetTableValue(0, 0.0, 0.0, 0.0, 0.0)
colorMap.SetInputData(volume)
colorMap.SetLookupTable(pColorTable)
colorMap.Update()
imageBlend.AddInputData(colorMap.GetOutput())
imageViewer.SetInputData(imageBlend.GetOutput())
...
# layout block
with SinglePageWithDrawerLayout(server) as layout:
trame.ClientStateChange(value="window.location.search", trigger_on_create=True, change=(
ctrl.get_search, "[window.location.search]")
with layout.content:
........
view = vtk_widgets.VtkRemoteView(imageViewer.GetRenderWindow(),box_selection=("vtk_selection",)**VTK_VIEW_SETTINGS)
if __name__ == "__main__":
server.start() environment:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Actually if you are using our docker to handle the multi-user setup, you just need to make your app take a command line argument and template it from the URL in the |
Beta Was this translation helpful? Give feedback.
Actually if you are using our docker to handle the multi-user setup, you just need to make your app take a command line argument and template it from the URL in the
apps.yml