Skip to content
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 Synchronized #1248

Merged
merged 39 commits into from Jun 11, 2020
Merged

VTK Synchronized #1248

merged 39 commits into from Jun 11, 2020

Conversation

xavArtley
Copy link
Collaborator

@xavArtley xavArtley commented Apr 9, 2020

supersede: #1070

Remaining tasks:

  • clean code (remove old serializer, refactor render function on js side, ...)
  • Split the old VTK pane in:
    • VTKJS (to load vtkjs files)
    • VTKSynchronized to handle vtkrender window
  • to handle vtkScalarBarActor (colorbar [VTK] Add colorbar on vtk renderer #1270)
  • Documentation:
    • split old VTK notebook
    • update gallery interactive demo

Future tasks (in an other PR)

  • discussion on the API we want to expose
  • extend the serializer
    • to handle volumes (will need vtk-js modifications)
  • new Notebook to document capabilites of VTKSynchronized pane

@philippjfr I think the PR is ready for review, everithing should almost work as before.
There are some small API breaks (for colorbars and mostly on javascript side)

I'll make more doc improvement in an other PR

ezgif com-video-to-gif (1)

@xavArtley xavArtley added status: WIP type: enhancement Minor feature or improvement to an existing feature labels Apr 9, 2020
@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from c7b850b to 60497f2 Compare April 9, 2020 13:26
@codecov
Copy link

codecov bot commented Apr 9, 2020

Codecov Report

❗ No coverage uploaded for pull request head (xav/python-link-interactivity@8487cf5). Click here to learn what that means.
The diff coverage is n/a.

@xavArtley
Copy link
Collaborator Author

For the vtkLookupTable, I think you want to create vtk.Rendering.Core.vtkColorTransferFunction not the basic one that use the HueRange.

Originally posted by @jourdain in #1070 (comment)

Indeed it works. I thought vtkColortransferfunction was for volumes

image

@@ -0,0 +1,359 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why check this in if regular old package-lock.json is now checked in?

Copy link
Collaborator Author

@xavArtley xavArtley Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I haven't succeed to use jszip and vtk in typescript for the moment
jszip I have an error with readable-stream
and vtkjs on importation.
bokeh/bokeh#9198 (comment)

Copy link
Member

@philippjfr philippjfr Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually currently at a strong -1 on bundling vtk.js with panel.js. Once bokeh allows multiple bundles in an extension we can add a panel-vtk.js bundle but for now it's too large to be included by default.

Copy link
Collaborator Author

@xavArtley xavArtley Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the error I get when trying to add jszip and @types/jszip to node modules:

Compiling TypeScript (30 files)
Linking modules
Error: can't resolve 'stream' from 'C:\Users\XA235208\Workspace\PythonWorkspace\modules\panel\panel\node_modules\readable-stream\readable.js'
    at Linker.resolve_absolute (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149877:20)
    at Linker.resolve_file (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149883:29)
    at Linker.new_module (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149969:43)
    at Linker.resolve (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:150012:37)
    at Linker.link (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149660:36)
    at Object.build (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:148534:32)
    at main (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:205:46)
    at Object._ (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:237:5)
    at require (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:88:23)
    at C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:96:16
Error: can't resolve 'events' from 'C:\Users\XA235208\Workspace\PythonWorkspace\modules\panel\panel\node_modules\readable-stream\lib\_stream_readable.js'
    at Linker.resolve_absolute (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149877:20)
    at Linker.resolve_file (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149883:29)
    at Linker.new_module (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149969:43)
    at Linker.resolve (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:150012:37)
    at Linker.link (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149660:36)
    at Object.build (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:148534:32)
    at main (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:205:46)
    at Object._ (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:237:5)
    at require (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:88:23)
    at C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:96:16
Error: can't resolve 'util' from 'C:\Users\XA235208\Workspace\PythonWorkspace\modules\panel\panel\node_modules\readable-stream\lib\_stream_readable.js'
    at Linker.resolve_absolute (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149877:20)
    at Linker.resolve_file (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149883:29)
    at Linker.new_module (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149969:43)
    at Linker.resolve (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:150012:37)
    at Linker.link (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149660:36)
    at Object.build (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:148534:32)
    at main (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:205:46)
    at Object._ (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:237:5)
    at require (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:88:23)
    at C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:96:16
Error: can't resolve 'stream' from 'C:\Users\XA235208\Workspace\PythonWorkspace\modules\panel\panel\node_modules\readable-stream\lib\internal\streams\stream.js'
    at Linker.resolve_absolute (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149877:20)
    at Linker.resolve_file (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149883:29)
    at Linker.new_module (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149969:43)
    at Linker.resolve (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:150012:37)
    at Linker.link (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149660:36)
    at Object.build (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:148534:32)
    at main (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:205:46)
    at Object._ (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:237:5)
    at require (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:88:23)
    at C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:96:16
Error: can't resolve 'buffer' from 'C:\Users\XA235208\Workspace\PythonWorkspace\modules\panel\panel\node_modules\safe-buffer\index.js'
    at Linker.resolve_absolute (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149877:20)
    at Linker.resolve_file (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149883:29)
    at Linker.new_module (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149969:43)
    at Linker.resolve (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:150012:37)
    at Linker.link (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149660:36)
    at Object.build (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:148534:32)
    at main (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:205:46)
    at Object._ (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:237:5)
    at require (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:88:23)
    at C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:96:16
Error: can't resolve 'util' from 'C:\Users\XA235208\Workspace\PythonWorkspace\modules\panel\panel\node_modules\inherits\inherits.js'
    at Linker.resolve_absolute (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149877:20)
    at Linker.resolve_file (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149883:29)
    at Linker.new_module (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149969:43)
    at Linker.resolve (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:150012:37)
    at Linker.link (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149660:36)
    at Object.build (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:148534:32)
    at main (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:205:46)
    at Object._ (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:237:5)
    at require (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:88:23)
    at C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:96:16
Error: can't resolve 'util' from 'C:\Users\XA235208\Workspace\PythonWorkspace\modules\panel\panel\node_modules\readable-stream\lib\internal\streams\BufferList.js'
    at Linker.resolve_absolute (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149877:20)
    at Linker.resolve_file (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149883:29)
    at Linker.new_module (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149969:43)
    at Linker.resolve (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:150012:37)
    at Linker.link (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149660:36)
    at Object.build (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:148534:32)
    at main (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:205:46)
    at Object._ (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:237:5)
    at require (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:88:23)
    at C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:96:16
Error: can't resolve 'util' from 'C:\Users\XA235208\Workspace\PythonWorkspace\modules\panel\panel\node_modules\util-deprecate\node.js'
    at Linker.resolve_absolute (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149877:20)
    at Linker.resolve_file (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149883:29)
    at Linker.new_module (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149969:43)
    at Linker.resolve (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:150012:37)
    at Linker.link (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:149660:36)
    at Object.build (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:148534:32)
    at main (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:205:46)
    at Object._ (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:237:5)
    at require (C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:88:23)
    at C:\Users\XA235208\Workspace\PythonEnvs\py38\lib\site-packages\bokeh\server\static\js\compiler.js:96:16

may be @mattpap has an idea to solve it

@jourdain
Copy link

jourdain commented Apr 9, 2020

Python serializer:
I've updated our version here. I still need to validate it inside PVW to make sure I didn't break anything.

In the mean time it should be pretty close to the one you had (except your last lut change). Could you test it? If we can I would like to have (if possible) the exact same file... ;-)

Thanks @xavArtley !

@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from 6135cb4 to fa66555 Compare April 9, 2020 15:10
@xavArtley
Copy link
Collaborator Author

xavArtley commented Apr 9, 2020

Python serializer:
I've updated our version here. I still need to validate it inside PVW to make sure I didn't break anything.

In the mean time it should be pretty close to the one you had (except your last lut change). Could you test it? If we can I would like to have (if possible) the exact same file... ;-)

Thanks @xavArtley !

@jourdain I think you should not keep this :
https://gitlab.kitware.com/vtk/vtk/-/merge_requests/6707/diffs#0ad8a8250f77efb2ca8213329f7c901a030a1477_314_494
in vtkjs there is no proper set function for the rotation matrix and it's just a (temporary?) workaround for the orientation not taking into account, moreover I think it works only if the actor position is in (0,0,0)
it's just suppositions, I'm really not an expert in 3d transformations

@jourdain
Copy link

jourdain commented Apr 9, 2020

I had to make some changes, but now it works as-is in my pvw legacy codes. @xavArtley see if that works for you?
https://gitlab.kitware.com/vtk/vtk/-/merge_requests/6707

@xavArtley
Copy link
Collaborator Author

xavArtley commented Apr 10, 2020

Another, potentially lighter-weight option could be to subclass vtkArchiver in Python and reimplement vtkPartitionedArchiver and its compression routines entirely in Python. I have experience subclassing C++ classes in Python to be useable in C++ using pybind11, so it is definitely doable. This would provide the additional benefit of confining the temperamental logic of serializing a VTK scene into vtk-js to one place.

Originally posted by @tjcorona in #1070 (comment)

I'll be interesting to learn how to do this.
I have never tried to subclass a vtkclass
Do you have some reference code that I can inspired or any guidance to achieve it?

@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from 7689045 to 0f45264 Compare April 10, 2020 09:17
@xavArtley
Copy link
Collaborator Author

@jourdain I had to modify the hashDataArray to use md5 hexdigest instead of digest otherwise I have some problems to decode zipped array on javascript side due to / special char

@jourdain
Copy link

Thanks I've noticed and keep up with it. But I had to remove the numpy dependency for the LUT. But that could be achieved using a file on the side...

@xavArtley
Copy link
Collaborator Author

I think I can remove numpy dependency if you want.
Was just more convenient to extract values of a vtkArray

@jourdain
Copy link

If you want, to use the file from vtk 9.0 as-is then yes...

@jourdain
Copy link

I'm ready to merge... So if you want to take the latest version of that file from my MR and add the LUT handling without numpy while making sure that everything works as expected for you that would be great.

With your latest edit/add-on, I'll trigger another test dashboard along with a pvw deployment to be sure...

And if everything is good to go, I'll merge it into VTK.

@xavArtley
Copy link
Collaborator Author

xavArtley commented Apr 10, 2020

I'm ready to merge... So if you want to take the latest version of that file from my MR and add the LUT handling without numpy while making sure that everything works as expected for you that would be great.

With your latest edit/add-on, I'll trigger another test dashboard along with a pvw deployment to be sure...

And if everything is good to go, I'll merge it into VTK.

I have tested your last file it's seems working except for the mapper:
I have a vtkOpenGLPolyDataMapper but there is no alias for it in vtk.js:
https://github.com/Kitware/vtk-js/blob/c4459d8682107f241dec3c2e3d77f00a4d266d4e/Sources/Rendering/Misc/SynchronizableRenderWindow/vtkObjectManager.js#L413

image

I think these lint error will not pass our tests

@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from 80ef025 to 503f211 Compare April 10, 2020 16:22
@jourdain
Copy link

I can add the mapping in vtkJS, it is easy enough. Do you want to do a PR?
I've already merged the py file in vtk/master+release but I can fix (remove) the unused import...

@jourdain
Copy link

jourdain commented Apr 11, 2020

vtk 13.13.2 has the new mapping.

@xavArtley
Copy link
Collaborator Author

@jourdain is there any sticking point to extent the synchronize renderer to handle vtkVolumes?

@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from a302918 to 04efc63 Compare April 11, 2020 17:53
@xavArtley
Copy link
Collaborator Author

Example of vtkActor animation and possibility to link and unlink camera beetween panels:
In the example after the first rotation of the both views shared camera and after the second rotation camera are unlinked
ezgif com-video-to-gif (3)

@jourdain
Copy link

jourdain commented Apr 12, 2020

No specific reason for not handling volume, we just didn't had the need so far.
In term of work we would just need new serializers on the Python side and the proper mapping on the client side. But as you may know by now, it is not too difficult or too long to do.

@xavArtley
Copy link
Collaborator Author

xavArtley commented Apr 12, 2020

Thx good to know, I didn't want to start this and go in a dead end

@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from 3673add to dc24b61 Compare April 12, 2020 14:14
@xavArtley
Copy link
Collaborator Author

xavArtley commented Apr 15, 2020

I think most of all fonctionalities of the old panel are functionals
ezgif com-video-to-gif (5)

@xavArtley
Copy link
Collaborator Author

xavArtley commented Apr 16, 2020

I run into a problem that I cannot solve.
This involves displaying the same panel several times
As long as we don't try to display elements like the orientation widget or the axes, there is no problem. But all the elements that do not belong to the python-side rendering window are complicated to manage because the scene is just updated and no longer rebuilt from scratch.

@xavArtley
Copy link
Collaborator Author

I can't reproduce the traverse error

@jbednar
Copy link
Member

jbednar commented May 13, 2020

My suggestions would be to make VTK a baseclass with a new method, which creates the appropriate subclass, which can be either VTKJS or VTKRenderWindow, does that sound reasonable?

I very much hope this can be done, because otherwise users have to learn which object to select, a much more difficult task than learning which option on an object to select. Figuring out options with help(obj) is easy once you have an obj; figuring out which object to use out of all the objects in Panel is difficult, and once they start with one of them many users won't realize that others are available.

@xavArtley
Copy link
Collaborator Author

xavArtley commented May 13, 2020 via email

@xavArtley
Copy link
Collaborator Author

@philippjfr I reproduced on linux

@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from 6ebd4f1 to 6fd801b Compare May 13, 2020 15:19
@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from 6fd801b to 841cb59 Compare May 13, 2020 15:22
Copy link
Member

@jbednar jbednar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! I've done a good bit of editing of the notebook text, and I hope none of that breaks the JSON file format. It shouldn't, but it's worth loading the notebook into Jupyter after applying the changes just to make sure.

examples/reference/panes/VTK.ipynb Outdated Show resolved Hide resolved
examples/reference/panes/VTK.ipynb Outdated Show resolved Hide resolved
"* **``link_camera(other: VTK)``** : Both panel will share the same camera, any change in one panel camera will be applied in the link panel\n",
"\n",
"**Warning** for applying any modification generated by these methods, the `sychronize()` method must be called\n",
"___"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what these underscores are for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for the horizontal separator
image

examples/reference/panes/VTK.ipynb Outdated Show resolved Hide resolved
examples/reference/panes/VTK.ipynb Outdated Show resolved Hide resolved
panel/models/vtk.py Outdated Show resolved Hide resolved
examples/reference/panes/VTKJS.ipynb Outdated Show resolved Hide resolved
examples/reference/panes/VTKJS.ipynb Outdated Show resolved Hide resolved
examples/reference/panes/VTKJS.ipynb Outdated Show resolved Hide resolved
examples/reference/panes/VTKJS.ipynb Outdated Show resolved Hide resolved
xavArtley and others added 2 commits May 13, 2020 17:53
Co-authored-by: James A. Bednar <jbednar@users.noreply.github.com>
Co-authored-by: James A. Bednar <jbednar@users.noreply.github.com>
@xavArtley
Copy link
Collaborator Author

Great stuff! I've done a good bit of editing of the notebook text, and I hope none of that breaks the JSON file format. It shouldn't, but it's worth loading the notebook into Jupyter after applying the changes just to make sure.

I have tested nothing breaks

@xavArtley
Copy link
Collaborator Author

@philippjfr it should work now

@philippjfr
Copy link
Member

@philippjfr it should work now

Can confirm, works now.

@philippjfr
Copy link
Member

philippjfr commented May 13, 2020

Okay, I have one last question, what happened to VTK.construct_colorbars()? I take it this now happens client-side but if we want to remove it we should go through an actual deprecation cycle, i.e. start warning in this release and remove it in the next release. Is that problematic?

For background I have seen multiple user notebooks that used this functionality and breaking it in a minor release isn't ideal.

@philippjfr
Copy link
Member

Apart from that this is all looks great, thanks for all your efforts here, they are hugely appreciated!

@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from 546db69 to 202c777 Compare May 13, 2020 20:00
panel/pane/vtk/vtk.py Outdated Show resolved Hide resolved
@xavArtley
Copy link
Collaborator Author

xavArtley commented May 16, 2020

@philippjfr , @jbednar
I have a concern that emerged this week,
it concerns the moment when the serialization of the object (vtkRenderWindow) takes place.
Currently, it only happens when _get_model or _update is called
Formerly, I had the serialize_on_instantiation parameter which allowed serializing at the construction of the object.
This made it possible to avoid a problem in pyvista because the VTK pane was instantiated then the VTKRenderWindow was cleaned before displaying.
If serialize_on_instantiation was False, an empty pane was displayed. The solution was therefore to serialize at instantiation.
In this case we are no longer really on a synchronized pane, so I was wondering if I should not do two classes:
VTKRenderWindowSynchronized and VTKRenderWindow, where the switch was made depending on whether we are serializing on instantiation or not.

@xavArtley xavArtley force-pushed the xav/python-link-interactivity branch from 63f11da to f10989c Compare May 18, 2020 12:31
@philippjfr
Copy link
Member

VTKRenderWindowSynchronized and VTKRenderWindow, where the switch was made depending on whether we are serializing on instantiation or not.

Is this still needed or did your latest changes address this?

@xavArtley
Copy link
Collaborator Author

My last changed adress it

@philippjfr philippjfr merged commit d4375db into master Jun 11, 2020
@philippjfr philippjfr deleted the xav/python-link-interactivity branch June 11, 2020 19:06
@xavArtley
Copy link
Collaborator Author

xavArtley commented Jun 12, 2020

Hello @jourdain,

I found my mistake I didn't pass range to the serialize lookuptable but I used valueRange

I need your help on an issue.
When trying to solve a panel issue I encounter another issue with the convertion of scalars to colors.

This issue occur when I set the mapper to use the lookup table range mapper.UseLookupTableScalarRangeOn()
This is the result I obtained:
image

However if I set UseLookupTableScalarRangeOff, I get similar results as with VTK C++
image

You can download the zip file of the scene here:
https://drive.google.com/drive/folders/1kgxkS3VyvcZFcTuBL2ty_cTtdUr37wmg?usp=sharing
you can use it in https://kitware.github.io/vtk-js/examples/SynchronizableRenderWindow.html

The scene piece is a composition of 32 actors

I'll try to make a smaller reproducing example later

@jourdain
Copy link

Glad you figure it out... Sorry I could not provide much help. I'm off till the end of the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants