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

Reply via email to