-
-
Notifications
You must be signed in to change notification settings - Fork 567
Vtk plot #312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vtk plot #312
Conversation
|
Exmaple inspired from : |
|
Looks like a great start! Note that I'd expect the Vtk pane to accept Vtk object directly and convert them to a VtkPlot model internally. Generally users should not be creating bokeh models directly since they are not meant to be reused, while a pane can be reused as often as desired. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very happy to have VTK support in Panel; that should be very handy. I don't have much opinion about the actual code that interfaces to VTK, other than that there seems to be a lot of it! :-) . And I haven't tested to see how well it works in practice.
| @@ -0,0 +1,519 @@ | |||
| # coding: utf-8 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has quite a bit of code; was it really all developed from scratch for Panel? Or was it adapted from some other starting point? If the latter, probably need to include the license of the original code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code is an adaptation from this Macro
https://raw.githubusercontent.com/Kitware/vtk-js/master/Utilities/ParaView/export-scene-macro.py
It allows to convert a paraview scene to a zip file
Most of developpement are inspired from
https://kitware.github.io/vtk-js/examples/SceneExplorer.html
I'm not very aware about licensing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think you'd need to paste in the license from: https://github.com/Kitware/vtk-js/blob/master/LICENSE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(And should include the link to the original example, for reference.)
|
There are two parts to the vtk panel work:
|
738f980 to
4b3a728
Compare
|
Now panel are construct using: import vtk
import panel as pn
pn.extension('vtk')
from vtk.util.colors import tomato
cylinder = vtk.vtkCylinderSource()
cylinder.SetResolution(8)
cylinderMapper = vtk.vtkPolyDataMapper()
cylinderMapper.SetInputConnection(cylinder.GetOutputPort())
cylinderActor = vtk.vtkActor()
cylinderActor.SetMapper(cylinderMapper)
cylinderActor.GetProperty().SetColor(tomato)
cylinderActor.RotateX(30.0)
cylinderActor.RotateY(-45.0)
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
ren.AddActor(cylinderActor)
ren.SetBackground(0.1, 0.2, 0.4)
ren.ResetCamera()
ren.GetActiveCamera().Zoom(1.5)
VTK(renWin)or import panel as pn
pn.extension('vtk')
import urllib
data_url = urllib.request.urlopen(r'https://raw.githubusercontent.com/Kitware/vtk-js/master/Data/StanfordDragon.vtkjs')
pn.pane.VTK(data_url) |
With a file extension as specific as vtkjs I'd be happy for the pane to accept filepaths and URLs which end in |
|
Another question, you say that the data is converted to a zip file stream. Are there any other formats which are potentially more efficient, e.g. could you imagine extracting any binary buffers such as arrays and sending those independently via a ColumnDataSource and then reconstituting it client-side? |
Okay, once you're finished with this PR, let's just file an issue providing a rough outline of such an approach. Certainly doesn't have to happen in this PR. |
Codecov Report
@@ Coverage Diff @@
## master #312 +/- ##
==========================================
- Coverage 89.41% 86.79% -2.63%
==========================================
Files 83 77 -6
Lines 6776 7105 +329
==========================================
+ Hits 6059 6167 +108
- Misses 717 938 +221
Continue to review full report at Codecov.
|
|
Resolved the merge conflict I introduced as part of the KaTeX/MathJax PR. |
fbc0236 to
d9c393c
Compare
|
example reference: |
|
It looks like the CI is crashing when the VTK render window is loaded, does that expect a windowing system to exist by any chance? |
|
I hope it's not the windowing system system, |
|
I think it is down to missing windowing, I've seen a couple of issues filed by people seeing similar errors despite the fact that they used SetOffScreenRendering. |
|
Okay rebased, just run: |
|
Linking carmera between views should not be hard if we expose camera settings in vtk model |
|
With some experimentation I realized 'shift + left button' pans in the code I pasted. I was able to set the size on the pane object, i.e. Linked camera would be really useful. I have a set of unstructured objects at different mesh resolutions that I want to create a panel dashboard to compare. |
|
Guys is awesome and great work! @xavArtley the python serializer that you found is indeed a better approach and will be improved while things progress on our end. It should be paired with the SynchronizedRenderWindow. Right now it is used with wslink (our WebSocket connection to VTK or ParaView backend) but can be adapted to exchange data with whatever communication protocol you would like. Please find below some links of the usage of it. Feel free to reach out on the vtk.js bug tracker as well... |
|
So how close is this to being merged? i.e. what is still needed? |
|
It sounds like a lot of the existing serialization code could be swapped out for the code that @jourdain helpfully pointed to. The next release is scheduled for about a week from today, @xavArtley do you think you'll be able to do that swapping before then? If not I'd be okay with merging it using the current serialization approach and filing an issue to swap that out at a later date. |
|
Seems unlikely I can pass some times on this PR next week. |
|
Okay, how would you feel about merging this in its current state (after I've made a quick pass to clean it up), and then improve the serialization in a subsequent PR? |
|
Can we wait the end of the week?
Le ven. 22 mars 2019 à 19:10, Philipp Rudiger <notifications@github.com> a
écrit :
… Okay, how would you feel about merging this in its current state (after
I've made a quick pass to clean it up), and then improve the serialization
in a subsequent PR?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#312 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ARrDS2Hyq2tjKJkeHLk7BeUr9uXoSWfFks5vZRyngaJpZM4b3rP7>
.
|
|
@philippjfr do you know if it is possible in bokehjs to trigger a python function to transfer data from python to javascript? |
Not sure there is a straightforward mechanism particularly on the model itself. You could add a sync boolean property to the model and then subscribe to it on the Pane, because at the model level you don't know whether to sync via a JS callback (which triggers an event python side) or via a bokeh server callback. |
|
After passing some times this week end on refactoring serializers, I need more time to reconstruct vtk rendering on the javascript side. |
Okay, I'll maybe make a pass over it tonight and will merge tomorrow. |
|
Okay, I'll merge this now and let you improve it in a subsequent PR. |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |



Panel model for vtk representations
A minimal example is the following

Should not work for the moment (need next bokeh version)
TODO:
Add tests
clean api to work with vtk renderers
Examples: