vtk remote rendering, slider rpc call has no effect untill mouse click on renerwindow.

  • On server size, I have below rpc function to change image slice:

@exportRpc(“image.slice.setz”)
def set_z_slice(self, z_slice):
global masterSlicer, renderWindow, renderWindowInteractor
(x, y, z) = masterSlicer.GetResliceAxesOrigin()
masterSlicer.SetResliceAxesOrigin(x, y, z_slice)
masterSlicer.Update()
renderWindowInteractor.Render()
renderWindow.Render()
self.z = z_slice

  • on javascript clide side, I make call to change slice
    set_z(slice_z)
    {

    this.session.call('image.slice.setz', [slice_z])
    

    }

  • But when I move the slider from ui, the image slice is not updated. I have to use mouse to click the render window, then slicing works good.

any hint?

Calling Render() does nothing to the client. Hence the problem.

You need to say that the view need to be pushed to the client. But also, if you have high interactivity you probably want to do it with some animation loop.

You can see what we do here in that protocol.

thanks, I am not able to figure out how to push the view to the client. Did a little try, no sucess. I called rendered on client side, it works. but seems quite slow.

set_z(slice_z)
{

  this.session.call('image.slice.setz', [slice_z])
  this.view.render()
  
 

}

Indeed, if I search vtk.js in node modules, it seems render method call image push.

BTW, It would be so much easier with trame.