[Paraview] Problem loading multiple volumes in ParaviewWeb

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu Apr 28 08:49:40 EDT 2011


Hi Raj,

The reason why you are not seeing the same settings across your data is
because you need to apply your SetDisplayProperties for each loaded data.
The reason why only the last one is set correctly, it's because ParaView has
a stack of active objects. And since the SetDisplayProperties requires a
"proxy" and a "view", if you do not provide them, ParaView will use the last
one created.

So to solve what you are facing you have to call the following code:

 pv.SetDisplayProperties( {
            proxy: data1,
            view  : view1,
            SelectMapper : 'GPU',
            Representation : 'Volume',
            LookupTable : lut1,
            ColorArrayName : 'ImageFile',
            ScalarOpacityFunction : f,
            } );

But the best way to go might be to define a method that do that

function setDisplayProperties( data ) {
   pv.SetDisplayProperties( {
            proxy: data,
            view  : view1,
            SelectMapper : 'GPU',
            Representation : 'Volume',
            LookupTable : lut1,
            ColorArrayName : 'ImageFile',
            ScalarOpacityFunction : f,
            } );
}

and then just call

setDisplayProperties(data1);
setDisplayProperties(data2);

Seb

On Wed, Apr 27, 2011 at 6:32 PM, Rajvikram Singh <rajvikrams at yahoo.com>wrote:

> Hi everyone .. Greetings !
>    I'm trying to create a web visualization page where biologists in our
> lab can see their multi-channel volume data. Each channel is a separate file
> and since there could be as many as 11-12 channels I want to give them the
> ability to switch the volumes on/off or even see two volumes in the same
> space.
>
> To test this I wrote the following Javascript code to load two volume files
> (.vtk) and then show only one. The problem is though I get no errors, I can
> only see the last file that's loaded (I've tried different combination of
> files). When I try to show the first file, all I see is a gray box instead
> of the data.
>
>  It almost feels like the OpenDataFile() function is using the same object
> and overwrites it. I'm new to Javascript and would not be surprised if I'm
> doing something silly but any advice is sincerely appreciated.
>
> Javascript Code :
>
>             // Set the web service base URL
>             var serverUrl =
> "<%=request.getScheme()%>://<%=request.getServerName()%>:<%=request.getServerPort()%>/PWService";
>             //
>             // Create a paraview proxy
>             //
>             var pv = new Paraview(serverUrl);
>             pv.createSession("Test Visualization", "Ver 0.1", "default");
>             var view1 = pv.CreateIfNeededRenderView();
>             pv.Render();
>
>             // Load the data files in RAM
>             var data1 = pv.OpenDataFile('test1.vtk');
>             var Representation1 = pv.Hide({proxy: data1});
>
>             var data2 = pv.OpenDataFile('test2.vtk');
>             var Representation2 = pv.Hide({proxy : data2});
>
>
>             // Init view parameters
>             var lut1 = 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 f = 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( {
>             view  : view1,
>             SelectMapper : 'GPU',
>             Representation : 'Volume',
>             LookupTable : lut1,
>             ColorArrayName : 'ImageFile',
>             ScalarOpacityFunction : f,
>             } );
>
>             // Show one dataset only
>             pv.Show({proxy : data2});
>
>
> Thanks in advance
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110428/645b3e52/attachment.htm>


More information about the ParaView mailing list