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

Tests on Pyvista Examples #8

Closed
Jimmy-KL opened this issue Jul 21, 2024 · 9 comments
Closed

Tests on Pyvista Examples #8

Jimmy-KL opened this issue Jul 21, 2024 · 9 comments

Comments

@Jimmy-KL
Copy link

Jimmy-KL commented Jul 21, 2024

I did some tests on Pyvista Examples for local rendering using WASM, here are the results:

  1. ./example/pyvista/basic.py: Failed with error -
    JS Error => WASM update failed
    JS Error => RuntimeError: null function or function signature mismatch
  2. ./example/pyvista/big_image.py: Failed with error -
    2024-07-21 11:28:44.737 ( 1.905s) [24B2BB1042894DD8] vtkSerializer.cxx:90 ERR| vtkSerializer (000001EC62E93DC0): Failed to add state for object=vtkImageActor (000001EC633080C0) with id=49
    ERROR:root:Failed to add state for object=vtkImageActor (000001EC633080C0) with id=49
    JS Error => WASM update failed
    JS Error => RuntimeError: null function or function signature mismatch
  3. ./example/pyvista/drap2dsurf.py: Succeeded, but the rotation is not smooth on my local machine, maybe the model is too big?
  4. ./example/pyvista/eye_dome_lighting.py: Failed with error -
    2024-07-21 11:35:27.656 ( 3.025s) [69F3DC7C481EFBBB] vtkSerializer.cxx:90 ERR| vtkSerializer (000001EB5335B290): Failed to add state for object=vtkEDLShading (000001EB52FDB290) with id=69
    ERROR:root:Failed to add state for object=vtkEDLShading (000001EB52FDB290) with id=69
    ERROR:wslink.protocol:Exception raised
    ERROR:wslink.protocol:AttributeError("'NoneType' object has no attribute 'GetMTime'")
    ERROR:wslink.protocol:Traceback (most recent call last):
    File "C:\Users\wwy\miniconda3\envs\vtklocal\Lib\site-packages\wslink\protocol.py", line 309, in onCompleteMessage results = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\wwy\miniconda3\envs\vtklocal\Lib\site-packages\trame_vtklocal\module\protocol.py", line 92, in get_status ids_mtime = [map_id_mtime(self.vtk_object_manager, v) for v in ids] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\wwy\miniconda3\envs\vtklocal\Lib\site-packages\trame_vtklocal\module\protocol.py", line 9, in map_id_mtime return (vtk_id, vtk_obj.GetMTime()) ^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'GetMTime'
  5. ./example/pyvista/glyph.py: Succeeded
  6. ./example/pyvista/isolines.py: Succeeded
  7. ./example/pyvista/labels.py: Failed with error -
    2024-07-21 11:39:19.778 ( 2.201s) [2DEF34B86EB3A545] vtkSerializer.cxx:90 ERR| vtkSerializer (0000022904238900): Failed to add state for object=vtkLabelPlacementMapper (0000022901D9B040) with id=52
    ERROR:root:Failed to add state for object=vtkLabelPlacementMapper (0000022901D9B040) with id=52
    JS Error => WASM update failed
    JS Error => RuntimeError: null function or function signature mismatch
  8. ./example/pyvista/linked_view.py: Succeeded
  9. ./example/pyvista/pbr.py: Failed with error - This error is not related to vtklocal rendering.
    File "C:\Users\wwy\miniconda3\envs\vtklocal\Lib\zipfile\__init__.py", line 1416, in _RealGetContents raise BadZipFile("File is not a zip file")
    zipfile.BadZipFile: File is not a zip file
  10. ./example/pyvista/spline.py: Succeeded
  11. ./example/pyvista/texture.py: Failed with error -
    2024-07-21 11:46:55.400 ( 24.117s) [58A33434455786F5] vtkSerializer.cxx:90 ERR| vtkSerializer (0000029F24F020B0): Failed to add state for object=vtkOpenGLTexture (0000029F24D44D80) with id=9 ERROR:root:Failed to add state for object=vtkOpenGLTexture (0000029F24D44D80) with id=9
    JS Error => WASM update failed
    JS Error => RuntimeError: null function or function signature mismatch
  12. ./example/pyvista/widget.py: Failed with error -
    2024-07-21 11:48:30.416 ( 2.836s) [247903E1FCD2DC27] vtkSerializer.cxx:90 ERR| vtkSerializer (0000018DA1177AF0): Failed to add state for object=vtkSliderRepresentation2D (0000018DA1495160) with id=24
    ERROR:root:Failed to add state for object=vtkSliderRepresentation2D (0000018DA1495160) with id=24
    JS Error => WASM update failed
    JS Error => RuntimeError: null function or function signature mismatch

And another problem is that for those examples that can run successfully, a local window will always be there. It's not user friendly if the app is running locally. For vtk.js solution, we can use off_screen parameter to hide this local window pv.Plotter(off_screen=True). But using vtklocal solution, the render window will be black. Any solution for this problem?

20240721115046

20240721115653

@jspanchu
Copy link
Member

Hey, apologies for late reply.

For 1, 2, 4, 7 and 11, I think all you need is a newer VTK as we are actively working on enabling the serialization capability for more vtk classes. If the VTK version you're using is any older than 9.3.20240720, please uninstall it and install newer one.

pip install "vtk==9.3.20240720.dev0" --extra-index-url https://wheels.vtk.org

For 12, I think you mean examples/pyvista/widget.py? vtkSliderRepresentation2D is not yet marshalled so it is expected. We are working on widget serialization.

@jspanchu
Copy link
Member

But using vtklocal solution, the render window will be black. Any solution for this problem?

Ah. What's going on is the property from server side render window is getting applied in wasm. We can look into excluding the vtkRenderWindow::ShowWindow property from serialization.

@Jimmy-KL
Copy link
Author

For 12, I think you mean examples/pyvista/widget.py? vtkSliderRepresentation2D is not yet marshalled so it is expected. We are working on widget serialization.

Yes, what I meant is "widget.py" - a mistake when copied and pasted.
After I installed the latest version vtk==9.3.20240720.dev0, I found the following problems.

  • In example 1 basic.py the axes at the left corner is not rotated along with the mesh. I think it's because it's a widget?
    image
  • In example 4 eye_dome_lighting.py still cannot work with the following error.
Exception raised
AttributeError("'NoneType' object has no attribute 'GetMTime'")
Traceback (most recent call last):
 File "C:\Users\wwy\miniconda3\envs\vtklocal\Lib\site-packages\wslink\protocol.py", line 309, in onCompleteMessage
   results = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\wwy\miniconda3\envs\vtklocal\Lib\site-packages\trame_vtklocal\module\protocol.py", line 92, in get_status
   ids_mtime = [map_id_mtime(self.vtk_object_manager, v) for v in ids]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\wwy\miniconda3\envs\vtklocal\Lib\site-packages\trame_vtklocal\module\protocol.py", line 9, in map_id_mtime
   return (vtk_id, vtk_obj.GetMTime())
                   ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'GetMTime'
  • In example 7 labels.py, the line is not rendered as tube and the points are not rendered as sphere. Please check the screenshot below. Left is the render window from server side.
    image

@Jimmy-KL
Copy link
Author

We can look into excluding the vtkRenderWindow::ShowWindow property from serialization.

Or it can also be a parameter similar to off_screen=True?

@jspanchu
Copy link
Member

jspanchu commented Jul 28, 2024

In example 1 basic.py the axes at the left corner is not rotated along with the mesh. I think it's because it's a widget?

Correct, we're working on that in #7.

In example 4 eye_dome_lighting.py still cannot work with the following error.

So that example works for me. If it matters (it shouldn't), I'm on linux, I will try on a windows machine and get back.

In example 7 labels.py, the line is not rendered as tube and the points are not rendered as sphere. Please check the screenshot below. Left is the render window from server side.

Yup, this makes sense because the wasm mapper doesn't implement rendering points as spheres. It is something we will get around to after major stuff like widgets are resolved.

@Jimmy-KL
Copy link
Author

So that example works for me. If it matters (it shouldn't), I'm on linux, I will try on a windows machine and get back.

Yes, I'm testing it on Windows, it may be the problem. I will take a try on Linux too.

@jspanchu
Copy link
Member

@jourdain here's the windows problem with eye_dome_lighting.py

@jspanchu
Copy link
Member

The issue with eye_dome_lighting.py no longer occurs in windows with master branch.

@jourdain
Copy link
Collaborator

I guess with the new version of trame-vtklocal and latest VTK most of it is taking care. Except off_screen flag which will happen sometime next week but closing to keep clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants