[Paraview] changing the current view in pvw

Cagatay Bilgin bilgincc at gmail.com
Fri May 4 17:58:00 EDT 2012


Hi Seb,

There is really not much in my pipeline at the
moment. I will do offline rendering using vtk,
save the vtp file, and load it on paraviewweb.
At the moment I play with sphere and cone
objects.

I uploaded the application here with the state files
http://vision.lbl.gov/People/bilgin/PWShuttle.tar.gz

Thank you,
Cagatay

On Fri, May 4, 2012 at 2:01 PM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:

> Hi Cagatay,
>
> could you send me 2 of your state file with your data so I can see how
> complex is your pipeline and see which approach is the best ?
>
> Seb
>
> On Fri, May 4, 2012 at 3:27 PM, Cagatay Bilgin <bilgincc at gmail.com> wrote:
> > Hi Seb,
> > I am completely lost here. I tried the disconnect,
> > and as I was expecting the render window is
> > gone and I do not see any visualization. I would
> > guess I will need to reconnect again.
> >
> > The view id is the same before and after.
> > The datafile is correctly changed though.
> > I guess that is the problem ?
> >
> > Cagatay
> >
> >
> > On Fri, May 4, 2012 at 11:42 AM, Sebastien Jourdain
> > <sebastien.jourdain at kitware.com> wrote:
> >>
> >> By disconnect, I mean the python method Disconnect that basically
> >> reset the ServerManager layer without stoping ParaView.
> >>
> >> To print the view id, if you are using firebug or any development
> >> javascript console you can see the output of some JavaScript code if
> >> you write
> >>
> >> console.log(activeView.__selfid__)
> >>
> >> or if you prefer a popup window, you can call
> >>
> >> alert(activeView.__selfid__)
> >>
> >> Most of the documentation is on the wiki of ParaView or inside the
> >> sample codes in the git repo.
> >>
> >> Seb
> >>
> >> On Fri, May 4, 2012 at 1:41 PM, Cagatay Bilgin <bilgincc at gmail.com>
> wrote:
> >> > adding the following line did not change anything
> >> > renderers.current.unbindToElementId('renderercontainer');
> >> > and I do not know how to check the view id
> >> >
> >> > Calling disconnect and connecting again would
> >> > indeed solve the problem but why would anyone
> >> > want to do that? I am already connected, all I want
> >> > to do is load some other data. You do not
> >> > connect/disconnect for every query you are going
> >> > to execute on database, so why do it here ?
> >> >
> >> > Is there a paravievweb document I can read somewhere,
> >> > like the ITK or VTK books? That would help greatly.
> >> >
> >> > Thank you,
> >> > Cagatay
> >> >
> >> > On Fri, May 4, 2012 at 6:01 AM, Sebastien Jourdain
> >> > <sebastien.jourdain at kitware.com> wrote:
> >> >>
> >> >> Hum,
> >> >>
> >> >> I will have to do it myself to see exactly what is going on.
> >> >> Unfortunately there is no clean way to cleanup the proxies of
> >> >> ParaView, so you know that you start from fresh for each data.
> >> >> I'm wondering if calling Diconnect() before loading the new data
> could
> >> >> solve the issue.
> >> >>
> >> >> On the other hand, in your current code, I don't see any "unbind" of
> >> >> your renderer which could end-up being on the top of the new one you
> >> >> just create. Did you double check that the view id that you get is
> >> >> different ?
> >> >>
> >> >> Seb
> >> >>
> >> >> On Thu, May 3, 2012 at 6:47 PM, Cagatay Bilgin <bilgincc at gmail.com>
> >> >> wrote:
> >> >> > 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.jourdain at 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 <
> bilgincc at 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.jourdain at 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.jourdain at 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
> >> >> >> >> > <bilgincc at 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
> >> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >
> >> >> >
> >> >
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120504/7a378846/attachment-0001.htm>


More information about the ParaView mailing list