Hi Raj,<div><br></div><div>The reason why you are not seeing the same settings across your data is because you need to apply your <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; ">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 </span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; ">SetDisplayProperties requires a "proxy" and a "view", if you do not provide them, ParaView will use the last one created.</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, sans-serif">So to solve what you are facing you have to call the following code:</font></div><div>
<font class="Apple-style-span" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "> </span></font><span class="Apple-style-span" style="font-size: medium; ">pv.SetDisplayProperties( {</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "> proxy: data1,<br> view : view1,<br> SelectMapper : 'GPU',<br>
Representation : 'Volume',<br> LookupTable : lut1,<br> ColorArrayName : 'ImageFile',<br> ScalarOpacityFunction : f,<br> } );</span></font></div><div>
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "><span class="Apple-style-span" style="font-size: small; "><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "><br>
</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; ">But the best way to go might be to define a method that do that</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; ">function setDisplayProperties( data ) {</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "> </span></font><span class="Apple-style-span" style="font-size: medium; ">pv.SetDisplayProperties( {</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "><span class="Apple-style-span" style="font-size: small; "><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "> proxy: data,<br>
view : view1,<br> SelectMapper : 'GPU',<br> Representation : 'Volume',<br> LookupTable : lut1,<br> ColorArrayName : 'ImageFile',<br> ScalarOpacityFunction : f,<br>
} );</span></font></div></span>}</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; "><br></span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="font-family: arial; font-size: medium; ">and then just call</span></font></div><div><span class="Apple-style-span" style="font-size: medium;"><br>
</span></div><div><span class="Apple-style-span" style="font-size: medium;">setDisplayProperties(data1);</span></div></span></span></font></div><span class="Apple-style-span" style="font-size: medium; ">setDisplayProperties(data2);</span><div>
<span class="Apple-style-span" style="font-size: medium;"><br></span></div><div><span class="Apple-style-span" style="font-size: medium;">Seb<br></span><div><br><div class="gmail_quote">On Wed, Apr 27, 2011 at 6:32 PM, Rajvikram Singh <span dir="ltr"><<a href="mailto:rajvikrams@yahoo.com">rajvikrams@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit">Hi everyone .. Greetings !<br>
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. <br>
<br>
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.<br>
<br>
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.<br>
<br>
Javascript Code :<br>
<br>
// Set the web service base URL<br>
var serverUrl =
"<%=request.getScheme()%>://<%=request.getServerName()%>:<%=request.getServerPort()%>/PWService";<br>
//<br>
// Create a paraview proxy<br>
//<br>
var pv = new Paraview(serverUrl);<br>
pv.createSession("Test Visualization", "Ver 0.1", "default");<br>
var view1 = pv.CreateIfNeededRenderView();<br>
pv.Render();<br>
<br>
// Load the data files in RAM<br>
var data1 = pv.OpenDataFile('test1.vtk');<br>
var Representation1 = pv.Hide({proxy: data1});<br>
<br>
var data2 = pv.OpenDataFile('test2.vtk');<br>
var Representation2 = pv.Hide({proxy : data2});<br>
<br>
<br>
// Init view parameters<br>
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'});<br>
<br>
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] });<br>
<br>
<br>
pv.SetDisplayProperties( {<br>
view : view1,<br>
SelectMapper : 'GPU',<br>
Representation : 'Volume',<br>
LookupTable : lut1,<br>
ColorArrayName : 'ImageFile',<br>
ScalarOpacityFunction : f,<br>
} );<br>
<br>
// Show one dataset only<br>
pv.Show({proxy : data2});<br>
<br>
<br>
Thanks in advance<br>
Raj</td></tr></tbody></table><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br></div></div>