[Paraview] Embedding the Visualizer app in the browser within an iframe

Sebastien Jourdain sebastien.jourdain at kitware.com
Tue Jan 17 14:13:31 EST 2017


No worries. Thanks Claude for your help on the mailing list... ;-)

On Tue, Jan 17, 2017 at 8:52 AM, claude <claude at theweak.link> wrote:

> Thank you Sebastien! Good catch.
>
> One addition to make sure the path to the file is correct: in the JS of
> the HTML file in the gist, I specified data as being "data:
> getUrlParameter('data') + '.vti'". In your case, the extension of the
> file is .ex2, not vti. So make sure the whole filename is correct, for
> instance specify the extension in the URL and not in the JS:
>
> HTML -> "data: getUrlParameter('data')"
>
> URL  -> http://paraview/?data=can.ex2
>
> (Otherwise it will look for can.ex2.vti which does not exist)
>
> Thanks very much Sebastien!
>
> cheers
>
> On 01/17/2017 09:13 AM, Sebastien Jourdain wrote:
>
> As you can see the issue is right there:
>
> "--load-file", "${data_dir}/can.ex2"
>
>
> As explained by Claude earlier in that same thread:
>
> The option --data specifies the directory, so whatever file you want to
>> load, it must be relative to that directory.
>
>
>
> On Tue, Jan 17, 2017 at 1:38 AM, Debopam Ghoshal <debopamg at gmail.com>
> wrote:
>
>> Hi Claude,
>>
>> Thanks a lot for your time and patience. As I have configured a virtual
>> host in apache, I am using the name of the virtual host (paraview) instead
>> of localhost. So instead of <http://localhost>http://localhost, my url
>> is http://paraview. Please find my response below:
>>
>> - a successful POST request to localhost/paraview
>>
>> The only log that I saw in the developer console was: Navigated to:
>> <http://paraview/>http://paraview/ (Note: I did not give the data
>> because it is already hardcoded in the launcher.config file)
>>
>> - a successful GET request to localhost/proxy
>>
>> Nothing else was displayed in the console. I have attached a snapshot of
>> the network tab (not sure whether it has any relevant information)
>>
>> - then do you get an error such as "can't connect to ws://localhost..."?
>>
>> I get this error only when I specify "sessionURL" : "ws://paraview:80/ws".
>> When I specify "sessionURL" : "ws://paraview:80/proxy?sessio
>> nId=${id}&path=ws" then there is no error.
>> Before starting the test today, I deleted all the log file, and after the
>> test the following are my observations:
>>
>> 1. the *error.log* file is empty
>> 2. the *launcher.log* has some entries, but none of them are errors:
>> 2017-01-17 13:43:17,786:INFO:twisted:Site starting on 9000
>> 2017-01-17 13:43:17,786:INFO:twisted:Starting factory
>> <twisted.web.server.Site instance at 0x0000021F750708C8>
>> 2017-01-17 13:43:53,460:INFO:twisted:"127.0.0.1" - -
>> [17/Jan/2017:08:13:52 +0000] "POST /paraview/ HTTP/1.1" 200 206 "
>> http://paraview/" "Mozilla/5.0 (Windows NT 10.0; WOW64)
>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
>> 2017-01-17 13:45:01,183:INFO:twisted:Received SIGINT, shutting down.
>> 2017-01-17 13:45:01,183:INFO:twisted:(TCP Port 9000 Closed)
>> 2017-01-17 13:45:01,183:INFO:twisted:Stopping factory
>> <twisted.web.server.Site instance at 0x0000021F750708C8>
>> 2017-01-17 13:45:01,183:INFO:twisted:Main loop terminated.
>> 2017-01-17 13:45:01,183:WARNING:root:Server factory shutting down.
>> Stopping all processes
>>
>> 3. The *session log* file also did not have any errors:
>> 2017-01-17 13:43:52+0530 [-] Log opened.
>> 2017-01-17 13:43:52+0530 [-] Site starting on 9999
>> 2017-01-17 13:43:52+0530 [-] Starting factory <twisted.web.server.Site
>> instance at 0x000001C32C76BF08>
>> 2017-01-17 13:43:54+0530 [HTTPChannel,0,127.0.0.1] Client has
>> reconnected, cancelling reaper
>> 2017-01-17 13:43:54+0530 [HTTPChannel,0,127.0.0.1] on_connect: connection
>> count = 1
>> 2017-01-17 13:43:54+0530 [HTTPChannel,0,127.0.0.1] Property
>> BeginValueCapture has no GetData() method, skipping
>> 2017-01-17 13:43:54+0530 [HTTPChannel,0,127.0.0.1] Property
>> CaptureValuesFloat has no GetData() method, skipping
>> 2017-01-17 13:43:54+0530 [HTTPChannel,0,127.0.0.1] Property
>> CaptureZBuffer has no GetData() method, skipping
>> 2017-01-17 13:43:54+0530 [HTTPChannel,0,127.0.0.1] Property
>> EndValueCapture has no GetData() method, skipping
>> 2017-01-17 13:43:54+0530 [HTTPChannel,0,127.0.0.1] Property
>> StartCaptureLuminance has no GetData() method, skipping
>> 2017-01-17 13:43:54+0530 [HTTPChannel,0,127.0.0.1] Property
>> StopCaptureLuminance has no GetData() method, skipping
>>
>>
>> What is confusing me is that the native rendering panel is coming up on
>> the desktop, but does not show the image to be rendered. The same panel is
>> also coming up as part of the Visualizer pane, and if I move the
>> orientation axis in the browser, then the axes are also moved in the native
>> window. In the attached snapshot, the native window is on your left.
>>
>> Cheers & Best Wishes,
>> Debopam
>> -------------------------------
>> Cell: +91 98304 10041 <+91%2098304%2010041>
>>
>> On Tue, Jan 17, 2017 at 5:28 AM, claude < <claude at theweak.link>
>> claude at theweak.link> wrote:
>>
>>> Hi Debopam,
>>>
>>> Would you mind trying to connect while the web developer console is on
>>> (for Chrome it's under "Tools > Javascript console") and copy/pasting the
>>> errors (if any).
>>>
>>> Do you see:
>>>
>>> - a successful POST request to localhost/paraview
>>>
>>> - a successful GET request to localhost/proxy
>>>
>>> - then do you get an error such as "can't connect to ws://localhost..."?
>>>
>>> Also, what do the logs tell you (/path/to/logs/error.log,
>>> /path/to/logs/launcherLog.log and /path/to/logs/<SOME_UID>.txt => fetch the
>>> last one created)?
>>>
>>> cheers
>>>
>>> claude
>>>
>>>
>>> On 01/16/2017 03:56 AM, Debopam Ghoshal wrote:
>>>
>>> Hi Claude,
>>>
>>> I tried using the filename hard coded in the config json as well as the
>>> index.html. But I am not able to view the file in the Visualizer.
>>> It is only showing the blank window/pane with no figure. I can move the
>>> orientation axes, but nothing is being rendered. Even when I choose a file
>>> from the Files tab, nothing is being displayed.
>>>
>>> My launcher config has:
>>>
>>> .......
>>> "properties" : {
>>>     "python_exec" : "C:/paraview/ParaView5.2.0/bin/pvpython.exe",
>>> "visualizer": "C:/paraview/ParaView5.2.0/sha
>>> re/paraview-5.2/web/visualizer/server/pvw-visualizer.py",
>>> "data_dir": "C:/paraview/ParaView5.2.0/data"
>>>   },
>>>   "apps": {
>>>     "visualizer": {
>>>         "cmd": [
>>>             "${python_exec}", "-dr", "${visualizer}", "--port",
>>> "${port}", "--data", "${data_dir}", "--authKey", "${secret}",
>>> "--load-file", "${data_dir}/can.ex2"
>>>         ],
>>>         "ready_line" : "Starting factory"
>>>     }
>>>   }
>>> ......
>>>
>>>
>>> (You can see that the file name is hard coded)
>>>
>>> The launcher.bat script has:
>>>
>>> set PV_HOME=C:\paraview\ParaView5.2.0
>>> %PV_HOME%\bin\pvpython.exe %PV_HOME%\bin\Lib\site-packages\vtk\web\launcher.py
>>> %PV_HOME%\launcher.config
>>>
>>>
>>> However, I am able to view the file when I launch the pvpython.exe
>>> script directly using:
>>> .\bin\pvpython.exe "C:\paraview\ParaView5.2.0\sha
>>> re\paraview-5.2\web\visualizer\server\pvw-visualizer.py" --content
>>> "C:\paraview\ParaView5.2.0\share\paraview-5.2\web\visualizer\www"
>>> --data "C:\paraview\ParaView5.2.0\data" --port 8080
>>>
>>> So, I am guessing I may have mixed up some configuration items because
>>> of which the display is not coming when I try to launch it through the
>>> launcher scirpt/config. Surprisingly, there are no error messages in the
>>> log files. Could you please suggest something.
>>>
>>> I have added the details in the gist for your reference:
>>> <https://gist.github.com/clavicule/7b8b3963ceb17302cff725f8dc36bc57>
>>> https://gist.github.com/clavicule/7b8b3963ceb17302cff725f8dc36bc57
>>>
>>> The screenshots are also attached for your reference.
>>>
>>>
>>> Cheers & Best Wishes,
>>> Debopam
>>> -------------------------------
>>> Cell: +91 98304 10041 <+91%2098304%2010041>
>>>
>>> On Fri, Jan 13, 2017 at 6:04 PM, Claude < <claude at theweak.link>
>>> claude at theweak.link> wrote:
>>>
>>>> Hi Debopam,
>>>>
>>>> Thanks for the added details on the gist and congratulations for
>>>> setting up the server, you are almost there.
>>>> For Visualizer to be able to load a file, it will need the argument
>>>> --load-file (it seems to have disappeared in your config launcher). The
>>>> option --data specifies the directory, so whatever file you want to load,
>>>> it must be relative to that directory. For example to load the data file
>>>> C:/my_data/dir/example1/my_file.vti you could do:
>>>> --data is C:/my_data/dir
>>>> --load-file is example1/my_file.vti
>>>>
>>>> Here is a question for you: do you want to always have the same data
>>>> loaded by default or to be able to specify it?
>>>> * If it's always the same, you can directly hardcode it in the launcher
>>>> config file. Then it will be loaded when you navigate to the paraview URL.
>>>> * if it's not always the same, you could use the solution on the gist
>>>> which is specifying it in the URL directly (there are other alternatives of
>>>> course). In that case, the URL must contain the file to load (otherwise
>>>> paraview cannot guess it :)). For instance:
>>>> http://localhost:9000/?data=example1/my_file
>>>>
>>>> (The JavaScript code automatically adds the extension .vti, you may
>>>> change that behavior of course).
>>>>
>>>> I'll be posting the detailed changes on your code in the gist comment
>>>> shortly.
>>>>
>>>> Let me know
>>>> Cheers
>>>> Claude
>>>>
>>>>
>>>> On Jan 13, 2017, at 5:05 AM, Debopam Ghoshal < <debopamg at gmail.com>
>>>> debopamg at gmail.com> wrote:
>>>>
>>>> Hi Claude,
>>>>
>>>> I followed your instructions with some modifications since I was having
>>>> problems. Finally, I was able to configure the Apache front end with the
>>>> ParaView Web launcher, and now I can view the index page of the visualizer.
>>>> However, when I choose any of the sample files, they are not being rendered
>>>> in the visualizer pane.
>>>>
>>>> I have added the details in the gist you created at:
>>>> <https://gist.github.com/>https://gist.github.com/cl
>>>> avicule/7b8b3963ceb17302cff725f8dc36bc57
>>>>
>>>> Would appreciate your thoughts on this.
>>>>
>>>>
>>>> Cheers & Best Wishes,
>>>> Debopam
>>>> -------------------------------
>>>>
>>>>
>>>> On Thu, Jan 12, 2017 at 5:22 PM, Debopam Ghoshal < <debopamg at gmail.com>
>>>> debopamg at gmail.com> wrote:
>>>>
>>>>> Hi Claude
>>>>>
>>>>> Thank you so much for your detailed explanation. The gist has been
>>>>> very useful. I am working on it at present, and is in the process of
>>>>> smoothening out a few creases because of the operating system I am using
>>>>> (Windows 10).
>>>>>
>>>>> Will let you know once I am able to use paraview web properly. And in
>>>>> case of any issue, I will bother you once again.
>>>>>
>>>>> Hi Seb,
>>>>>
>>>>> Thanks for the link. Much appreciated.
>>>>>
>>>>>
>>>>> Cheers & Best Wishes,
>>>>> Debopam
>>>>> -------------------------------
>>>>>
>>>>> On Wed, Jan 11, 2017 at 9:48 PM, Sebastien Jourdain <
>>>>> <sebastien.jourdain at kitware.co>sebastien.jourdain at kitware.com> wrote:
>>>>>
>>>>>> Thanks Claude,
>>>>>>
>>>>>> Here is the add-on of what functions can be called on Visualizer.
>>>>>> (All the function with export)
>>>>>>
>>>>>> <https://github.com/Kitware/vis>https://github.com/Kitware/vis
>>>>>> ualizer/blob/master/src/app.js
>>>>>>
>>>>>> We are planning to add some helper for extracting arguments from the
>>>>>> URL. We actually add a class in the ParaViewWeb repo, but we haven't got to
>>>>>> the point of using it and making it available in visualizer.
>>>>>>
>>>>>> Seb
>>>>>>
>>>>>> On Wed, Jan 11, 2017 at 7:32 AM, claude < <claude at theweak.link>
>>>>>> claude at theweak.link> wrote:
>>>>>>
>>>>>>> Hi Debopam,
>>>>>>>
>>>>>>>
>>>>>>> I think there is one thing to consider first before taking care of
>>>>>>> data being passed through: if you manually start one instance of
>>>>>>> pvw-visualizer, it means all people connecting to port 8080 will see the
>>>>>>> same thing and act on the same viewer, which means potentially conflicting
>>>>>>> with each other action (e.g. a probable disconnection for everyone if one
>>>>>>> decide to exit maybe?). In that case, you need to have a virtual server
>>>>>>> that will launch a new process every time someone connect to port 8080.
>>>>>>> That way, all viewers are independent, the same person can open several
>>>>>>> viewers, etc.
>>>>>>>
>>>>>>>
>>>>>>> Now regarding the data being loaded at startup: you html index file
>>>>>>> should have a function grabbing the 'data' parameter from a URL, a form, a
>>>>>>> dropdown menu, etc. then sending it as a key to the Visualizer application
>>>>>>> (so that the launcher knows which file to load at startup).
>>>>>>>
>>>>>>> It would have been complicated to explain all the details in a
>>>>>>> email, so I made a gist with all the files and "code" addressing both
>>>>>>> points (launcher and data):
>>>>>>>
>>>>>>> <https://gist.github.com/clavic>https://gist.github.com/clavic
>>>>>>> ule/7b8b3963ceb17302cff725f8dc36bc57
>>>>>>>
>>>>>>> Note that this gist was gathered info from the Paraview Web and
>>>>>>> Visualizer online documentations: kuddos to Paraview people.
>>>>>>> 2nd note: in that gist I'm giving the instructions for Apache server
>>>>>>> (you could technically choose any other, e.g. NGinx) for Linux.  I see you
>>>>>>> are on Windows: I don't know how Apache works on Windows but I assume (and
>>>>>>> hope) the steps and config file should be similar.
>>>>>>>
>>>>>>> I hope it helps! Good luck!
>>>>>>> cheers
>>>>>>> claude
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 01/11/2017 04:10 AM, Debopam Ghoshal wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> We have a requirement where our application will send a request to
>>>>>>> the paraview web server to render a specific file (which will be available
>>>>>>> in the data given directory) in the visualizer app, and this will be
>>>>>>> embedded within our application page as a iframe, whose source is the
>>>>>>> Visualizer app's index.html.
>>>>>>>
>>>>>>> We are using the pvpython.exe executable to start the paraview web
>>>>>>> server. The command used to start the server is:
>>>>>>>
>>>>>>> .\bin\pvpython.exe "C:\ParaView-5.2.0-Qt4-OpenGL2
>>>>>>> -MPI-Windows-64bit\share\paraview-5.2\web\visualizer\server\pvw-visualizer.py"
>>>>>>> --content "C:\ParaView-5.2.0-Qt4-OpenGL2
>>>>>>> -MPI-Windows-64bit\share\paraview-5.2\web\visualizer\www" --data
>>>>>>> "C:\ParaView-5.2.0-Qt4-OpenGL2-MPI-Windows-64bit\data" --port 8080
>>>>>>>
>>>>>>>
>>>>>>> From the command, we can see that the web content is being served
>>>>>>> from the C:\ParaView-5.2.0-Qt4-OpenGL2-MPI-Windows-64bit\share\pa
>>>>>>> raview-5.2\web\visualizer\www directory. The index.html file uses
>>>>>>> the Visualizer.js script and calls the following functions:
>>>>>>>
>>>>>>> Visualizer.connect({ application: 'visualizer' });
>>>>>>> Visualizer.autoStopServer(10);
>>>>>>>
>>>>>>> Is there any way to find out the available functions in the
>>>>>>> Visualizer.js script and call them from our custom html file? What we
>>>>>>> intend to do is to update the index.html file and
>>>>>>> a. add a javascript function which will accept a filename to be
>>>>>>> rendered
>>>>>>> b. once the filename is received by this function, it will call the
>>>>>>> visualizer and display the specified file
>>>>>>> c. in the visualizer page, the open files tab should be hidden.
>>>>>>>
>>>>>>> Please let me know if you require any clarification.
>>>>>>>
>>>>>>> Cheers & Best Wishes,
>>>>>>> Debopam
>>>>>>> -------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>>>
>>>>>>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>>>>>>
>>>>>>> Follow this link to subscribe/unsubscribe:http://public.kitware.com/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 Search the list archives at:
>>>>>>> http://markmail.org/search/?q=ParaView Follow this link to
>>>>>>> subscribe/unsubscribe: http://public.kitware.com/mail
>>>>>>> man/listinfo/paraview
>>>>>>
>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170117/e44152ac/attachment.html>


More information about the ParaView mailing list