[Paraview] Problem loading multiple volumes in ParaviewWeb
Rajvikram Singh
rajvikrams at yahoo.com
Wed Apr 27 18:32:01 EDT 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110427/d1975d85/attachment.htm>
More information about the ParaView
mailing list