Closed knopkem closed 3 years ago
Indeed, that is because the RemoteView assume a single ImageStream. But you can provide it from the WsClient.
function render(url, id)
{
const divRenderer = document.createElement('div');
divRenderer.style.position = 'relative';
divRenderer.style.width = '50vw';
divRenderer.style.height = '50vh';
divRenderer.style.overflow = 'hidden';
document.querySelector('body').appendChild(divRenderer);
const config = { sessionURL: url };
vtkWSLinkClient.setSmartConnectClass(SmartConnect);
const clientToConnect = vtkWSLinkClient.newInstance();
clientToConnect.onConnectionReady((validClient) => {
console.log('connection ready');
const session = validClient.getConnection().getSession();
const viewStream = validClient.getImageStream().createViewStream(id);
const remoteView = vtkRemoteView.newInstance({ session, viewStream });
remoteView.setContainer(divRenderer);
remoteView.render();
});
clientToConnect.onConnectionError(console.error);
clientToConnect.onConnectionClose(console.error);
clientToConnect.connect(config);
}
Thanks for the quick answer, unfortunately when updating with your code it now doesn't render anything. Mouse interaction on the blank canvas throws exceptions. I tried both with -1 for id and dedicated view Ids (1 and 2), still nothing.
I created an example here: https://github.com/knopkem/paraview-app
Fixed in v17.2.4
I'm trying to setup 2 vtkRemoteViews, each using a different 'app' (server side render code). This works with paravieweb but not with vtk.js. I tried setting a different viewNr to each vtkRemoteView but that doesn't seem to work either. With paraview, both views render correctly and interaction works too (minus some minor quirks) With vtk.js, both canvas render the same view, and interaction is only possible in one of them, changing both views.
Working Example paraviewweb:
Non working example with vtk.js:
I'm a bit lost here, any help would be highly appreciated. Thanks