Hi Raj, first of all you only need one session. A session is basically a dedicated connection to a ParaView server. So by creating 2 session, you were creating 2 server where you could have created 2 views in the same session and setup a mechanism to keep both camera of the views in synch. Moreover, as you are using the same session, you can reuse your objects such as the LUT. To keep object in synch, you will have to write some piece of code on the server side that you could call from your javascript client. I don't have a simple example in mind but you could look at the pwsimple.py where I had some binding between the widget and the implicit functions that it represent. Of course the event type won't be the same but the idea is there.
In fact inside a Python plugin you should define a method like that: def bindViews(view1, view2): # add some python code to bind the two camera together # or maybe set the active camera of view1 to be the active # camera of view 2. I know that it does not give you the full answer but at least it give you some hints. Seb On Mon, May 9, 2011 at 5:29 PM, Rajvikram Singh <rajvikr...@yahoo.com>wrote: > Hi everyone > I would like to load two volume datasets (called FISH and SIMS in the > code below) in ParaviewWeb and then render them side by side in two > different views. The users should be able to 'lock' the camera amongst the > two views so that moving the object in one window also affects the camera in > the other. > > I tried the following piece of code but ran into a error which made me > think maybe I don't understand the concept of sessions and Display > properties well. Hoping somebody could help shed some light. There are two > functions that I've copy pasted below. Most of the variables are global for > now and shared between the functions. > > > // The init function loads and displays the two datasets > this.init = function() { > // Set the web service base URL > var i; > var serverUrl = > "<%=request.getScheme()%>://<%=request.getServerName()%>:<%=request.getServerPort()%>/PWService"; > // > // Create paraview sessions .. one each for FISH and SIMS > // > pv_FISH = new Paraview(serverUrl); > pv_FISH.createSession("CAVIAT-session-1", "FISH data", > "default"); > view_FISH = pv_FISH.CreateIfNeededRenderView(); > pv_FISH.Render(); > > pv_SIMS = new Paraview(serverUrl); > pv_SIMS.createSession("CAVIAT-session-2", "SIMS data", > "default"); > view_SIMS = pv_SIMS.CreateIfNeededRenderView(); > pv_SIMS.Render(); > > // Load the data files from disk > data_FISH = pv_FISH.OpenDataFile({filename : file_FISH}); > data_SIMS = pv_FISH.OpenDataFile({filename : file_SIMS}); > > // For volume rendering set the display properties for each > dataset loaded > > this.setupVolumeView(data_FISH, view_FISH, pv_FISH); > this.setupVolumeView(data_SIMS, view_SIMS, pv_SIMS); > > pv_FISH.Show({proxy : data_FISH}); > pv_FISH.UpdatePipeline(); > > pv_SIMS.Show({proxy : data_SIMS}); > pv_SIMS.UpdatePipeline(); > > > // set origin in the middle of dataset > pv_FISH.ResetCamera(); > view_FISH.setCenterOfRotation(view_FISH.getCameraFocalPoint()); > > pv_SIMS.ResetCamera(); > view_SIMS.setCenterOfRotation(view_SIMS.getCameraFocalPoint()); > > // Create and bind renderers for both sessions > var renderer_FISH = new JavaScriptRenderer("rendererName", > serverUrl); > renderer_FISH.init(pv_FISH.sessionId, view_FISH.__selfid__); > renderer_FISH.setSize('720','720'); > renderer_FISH.bindToElementId("FISH-container"); > renderer_FISH.start(); > > var renderer_SIMS = new JavaScriptRenderer("rendererName", > serverUrl); > renderer_SIMS.init(pv_SIMS.sessionId, view_SIMS.__selfid__); > renderer_SIMS.setSize('720','720'); > renderer_SIMS.bindToElementId("SIMS-container"); > renderer_SIMS.start(); > > } > > > // setupVolumeView will prepare the LUT and Scalar Opacity function > needed for volume rendering > this.setupVolumeView = function (_data, _view, _pv) { > > // *** Check to see is scope of lut and sof is valid for a per > volume operation *** > var lut = _pv.GetLookupTableForArray({arrayname : "ImageFile", > num_components : 1, HSVWrap : 0, NanColor : [0.0, 0.66666666666666663, 0.0], > RGBPoints : [1.0, 0.0, 0.0, 0.0, 16564.27904630101, 1.0, > 0.035950255588616767, 0.0, 19924.923666800998, 1.0, 0.035950255588616767, > 0.0, 39728.909301543368, 0.0, 0.66666666666666663, 0.0, 65294.000000000007, > 0.0, 0.0, 0.0], ColorSpace : 'HSV'}); > > var sof = _pv.CreatePiecewiseFunction( {Points:[0.0, 0.0, > 2762.37, 0.0588235, 2882.47, 0, 6965.97, 0.235294, 15373.2, 0.323529, > 25221.6, 0, 26662.9, 0, 36751.5, 0, 44318, 0.0, 52124.7, 0.323529, 63054, > 0.294118, 65336, 0.294118] }); > > > _pv.SetDisplayProperties( { > proxy : _data, > view : _view, > SelectMapper : 'GPU', > Representation : 'Volume', > LookupTable : lut, > ColorArrayName : 'ImageFile', > ScalarOpacityFunction : sof > } ); > > } // end of setDisplayToVolume() > > > > The error occurs when the code calls the following line inside the init() > function. > > this.setupVolumeView(data_SIMS, view_SIMS, pv_SIMS); > > Inside the setupVolumeView() function, while calling > SetDisplayProperties(), the code complains "Uncaught exception: Volume is > not a valid volume." This does not happen for the first data but for the > second one only. > > > Thanks > Raj > > > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the ParaView Wiki at: > http://paraview.org/Wiki/ParaView > > Follow this link to subscribe/unsubscribe: > http://www.paraview.org/mailman/listinfo/paraview > >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview