<span class="Apple-style-span" style><div>adding the following line did not change anything </div><div>renderers.current.unbindToElementId('renderercontainer');</div><div>and I do not know how to check the view id </div>
<div> </div>Calling disconnect and connecting again would <div>indeed solve the problem but why would anyone </div><div>want to do that? I am already connected, all I want</div><div>to do is load some other data. You do not </div>
<div>connect/disconnect for every query you are going </div><div>to execute on database, so why do it here ? </div><div><br></div><div>Is there a paravievweb document I can read somewhere,</div><div>like the ITK or VTK books? That would help greatly. </div>
<div><br></div><div>Thank you, </div><div>Cagatay</div></span><br><div class="gmail_quote">On Fri, May 4, 2012 at 6:01 AM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hum,<br>
<br>
I will have to do it myself to see exactly what is going on.<br>
Unfortunately there is no clean way to cleanup the proxies of<br>
ParaView, so you know that you start from fresh for each data.<br>
I'm wondering if calling Diconnect() before loading the new data could<br>
solve the issue.<br>
<br>
On the other hand, in your current code, I don't see any "unbind" of<br>
your renderer which could end-up being on the top of the new one you<br>
just create. Did you double check that the view id that you get is<br>
different ?<br>
<br>
Seb<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, May 3, 2012 at 6:47 PM, Cagatay Bilgin <<a href="mailto:bilgincc@gmail.com">bilgincc@gmail.com</a>> wrote:<br>
> Hi Seb,<br>
><br>
> The first option will not scale. We will<br>
> have a growing number of tissue samples<br>
> to be visualized and this option will be<br>
> infeasible soon.<br>
><br>
> I am already re-initializing the renderer<br>
> with the new activeview. The minimal<br>
> example illustrating the issue is here<br>
><br>
> var renderers = {};<br>
> var paraview;<br>
> var activeView;<br>
> var basePath = 'data/';<br>
> var dataFile = 'sphere.pvsm';<br>
><br>
> paraview = new Paraview(serverUrl);<br>
> paraview.createSession("Shuttle", "", "default");<br>
><br>
> function start(){<br>
> paraview.LoadState({filename: basePath + dataFile});<br>
> activeView = paraview.CreateIfNeededRenderView();<br>
> paraview.ResetCamera();<br>
> activeView.setCenterOfRotation(activeView.getCameraFocalPoint());<br>
><br>
> paraview.updateConfiguration(true, "JPEG", "WebGL");<br>
> renderers.webgl = new WebGLRenderer("webglRenderer", serverUrl);<br>
> renderers.webgl.init(paraview.sessionId, activeView.__selfid__);<br>
><br>
> // Use webgl as default<br>
> renderers.current = renderers.webgl;<br>
> renderers.current.bindToElementId("renderercontainer");<br>
> renderers.current.start();<br>
><br>
> // Update render size<br>
> updateSize();<br>
> }<br>
> ...<br>
> function switchData(){<br>
> dataFile = 'cone.pvsm';<br>
> start();<br>
> }<br>
><br>
> This script successfully loads the sphere but<br>
> does not switch to cone. If I move the<br>
> paraview.createSession("Shuttle", "", "default");<br>
> in to start function, things start working as expected:<br>
> Sphere is visualized first, and cone is loaded and<br>
> visualized when the button is clicked at the cost of<br>
> an unnecessary session. I am trying to do things<br>
> cleanly, and do not want to have dangling sessions<br>
> for no reason.<br>
><br>
> Thank you for your help,<br>
> Cagatay<br>
><br>
> On Thu, May 3, 2012 at 3:15 PM, Sebastien Jourdain<br>
> <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>> wrote:<br>
>><br>
>> Well there is several way to deal with what you want to achieve.<br>
>><br>
>> 1) if all the data that you are interested are kind of small then you<br>
>> can all load them and just call "paraview.Show({proxy: objA})" or<br>
>> "paraview.Hide({proxy: objA})"<br>
>><br>
>> To get the proper references of objA, objB, ..., from the state file,<br>
>> you can query ParaView for that like that:<br>
>><br>
>> var objA = paraview.FindSource( { name: "nameInPipelineBrowserInParaView"<br>
>> });<br>
>><br>
>> 2) if you really want to load and unload them, you will have to<br>
>> re-init the renderers as I was saying in one of my previous mail. Just<br>
>> let me know if you want to take that route, I can try to explain more.<br>
>><br>
>> Hope that give you enough hints,<br>
>><br>
>> Seb<br>
>><br>
>> On Thu, May 3, 2012 at 5:40 PM, Cagatay Bilgin <<a href="mailto:bilgincc@gmail.com">bilgincc@gmail.com</a>> wrote:<br>
>> > It only re-initializes if I create another session like this<br>
>> > paraview.createSession("Shuttle", "", "default");<br>
>> > but I think I shouldn't be creating a new session<br>
>> > just to see a different object.<br>
>> ><br>
>> > I am completely ok with using different file formats. All<br>
>> > I am trying to do is to minimize the paraviewweb-js-python<br>
>> > scripting part as I have very limited experience there. That's<br>
>> > why I was using state files. Is it better to use something else ?<br>
>> ><br>
>> > Thank you,<br>
>> > Cagatay<br>
>> ><br>
>> > On Thu, May 3, 2012 at 2:09 PM, Sebastien Jourdain<br>
>> > <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>> wrote:<br>
>> >><br>
>> >> Normally loading a state file should re-initialize everything, so the<br>
>> >><br>
>> >> activeView = paraview.CreateIfNeededRenderView();<br>
>> >> paraview.ResetCamera();<br>
>> >> activeView.setCenterOfRotation(activeView.getCameraFocalPoint());<br>
>> >><br>
>> >> should be redone and all the renderer should be re-init with the new<br>
>> >> view<br>
>> >> id.<br>
>> >><br>
>> >> Seb<br>
>> >><br>
>> >><br>
>> >> On Thu, May 3, 2012 at 5:02 PM, Sebastien Jourdain<br>
>> >> <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>> wrote:<br>
>> >> > Hi Cagatay,<br>
>> >> ><br>
>> >> > does your data needs to be a ParaView state file, our would it be<br>
>> >> > better if it was some other VTK compatible file ?<br>
>> >> ><br>
>> >> > Seb<br>
>> >> ><br>
>> >> > On Thu, May 3, 2012 at 3:18 PM, Cagatay Bilgin <<a href="mailto:bilgincc@gmail.com">bilgincc@gmail.com</a>><br>
>> >> > wrote:<br>
>> >> >> I am trying to build a web application that<br>
>> >> >> can visualize different objects by the use<br>
>> >> >> of a drop down bar. I do not want to create<br>
>> >> >> new connections or sessions every time the<br>
>> >> >> user changes object to be visualized. I've<br>
>> >> >> been trying the whole morning and could not<br>
>> >> >> figure out how to i) delete the current view,<br>
>> >> >> ii) set it to the view view and iii) refresh the<br>
>> >> >> page. Here is what I have so far.<br>
>> >> >><br>
>> >> >><br>
>> >> >><br>
>> >> >> var renderers = {};<br>
>> >> >> var paraview;<br>
>> >> >> var activeView;<br>
>> >> >> var basePath =<br>
>> >> >><br>
>> >> >><br>
>> >> >> '/bioimaging/home/ccbilgin/opt/apache-tomcat-6.0.35/webapps/PWShuttle/data/';<br>
>> >> >> var dataFile = 'tmp.pvsm';<br>
>> >> >> * paraview = new Paraview(serverUrl);<br>
>> >> >> * paraview.createSession("Shuttle", "", "default");<br>
>> >> >><br>
>> >> >> function start(){<br>
>> >> >> //paraview.LoadState({filename: basePath +<br>
>> >> >> '/state.pvsm'});<br>
>> >> >> paraview.updateConfiguration(true, "JPEG", "-");<br>
>> >> >> paraview.LoadState({filename: basePath +<br>
>> >> >> dataFile});<br>
>> >> >> activeView =<br>
>> >> >> paraview.CreateIfNeededRenderView();<br>
>> >> >> paraview.ResetCamera();<br>
>> >> >><br>
>> >> >> activeView.setCenterOfRotation(activeView.getCameraFocalPoint());<br>
>> >> >><br>
>> >> >> // Create renderers<br>
>> >> >> renderers.java = new<br>
>> >> >> HttpAppletRenderer("javaRenderer",<br>
>> >> >> serverUrl);<br>
>> >> >> renderers.java.init(paraview.sessionId,<br>
>> >> >> activeView.__selfid__);<br>
>> >> >> renderers.java.setSize("1","1");<br>
>> >> >><br>
>> >> >> renderers.flash = new<br>
>> >> >> FlashRenderer("flashRenderer",<br>
>> >> >> serverUrl);<br>
>> >> >> renderers.flash.init(paraview.sessionId,<br>
>> >> >> activeView.__selfid__);<br>
>> >> >><br>
>> >> >> renderers.js = new<br>
>> >> >> JavaScriptRenderer("jsRenderer",<br>
>> >> >> serverUrl);<br>
>> >> >> renderers.js.init(paraview.sessionId,<br>
>> >> >> activeView.__selfid__);<br>
>> >> >><br>
>> >> >> paraview.updateConfiguration(true, "JPEG",<br>
>> >> >> "WebGL");<br>
>> >> >> renderers.webgl = new<br>
>> >> >> WebGLRenderer("webglRenderer",<br>
>> >> >> serverUrl);<br>
>> >> >> renderers.webgl.init(paraview.sessionId,<br>
>> >> >> activeView.__selfid__);<br>
>> >> >><br>
>> >> >> // Remove Java when use in IE<br>
>> >> >> if (navigator.appName.indexOf ('Microsoft') !=<br>
>> >> >> -1)<br>
>> >> >> {<br>
>> >> >> var e = document.getElementById("java")<br>
>> >> >> var parent = e.parentNode;<br>
>> >> >> if(e){<br>
>> >> >> parent.removeChild(e);<br>
>> >> >> }<br>
>> >> >> }<br>
>> >> >><br>
>> >> >> // Use webgl as default<br>
>> >> >> renderers.current = renderers.webgl;<br>
>> >> >><br>
>> >> >> renderers.current.bindToElementId("renderercontainer");<br>
>> >> >> renderers.current.start();<br>
>> >> >><br>
>> >> >> // Update render size<br>
>> >> >> updateSize();<br>
>> >> >><br>
>> >> >> // Action images<br>
>> >> >> updateActionButtons(true);<br>
>> >> >> }<br>
>> >> >><br>
>> >> >> ....<br>
>> >> >><br>
>> >> >> function switchData(){<br>
>> >> >> var type =<br>
>> >> >> document.getElementById("data-type").value;<br>
>> >> >> dataFile = 'cone.pvsm';<br>
>> >> >> start();<br>
>> >> >> }<br>
>> >> >><br>
>> >> >> ....<br>
>> >> >><br>
>> >> >> <select id="data-type" name="data-type"<br>
>> >> >> style="z-index: 5;width: 100px; position: absolute;<br>
>> >> >> right:<br>
>> >> >> 40px; top: 30px;"<br>
>> >> >> onchange="switchData()" ><br>
>> >> >> <option value="1">1.mhd</option><br>
>> >> >> <option value="2">2.mhd</option><br>
>> >> >> <option value="3">3.mhd</option><br>
>> >> >> </select><br>
>> >> >><br>
>> >> >><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<br>
>> >> >> <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:<br>
>> >> >> <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>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>