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