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

Slow mesh state update, lack of access #70

Open
m-vik opened this issue May 6, 2023 · 1 comment
Open

Slow mesh state update, lack of access #70

m-vik opened this issue May 6, 2023 · 1 comment

Comments

@m-vik
Copy link

m-vik commented May 6, 2023

Description

Hello,
I am trying to handle around 100 to 200 GeometryRepresentations in a vtk view. Each representation is defined by around 200 points.

At some point I update the positions/orientations of the representations and generate a new mesh state with the "to_mesh_state" method in a callback.

I found out that the slowest method in the chain is the following and all following methods like GetStrips():

points = b64_encode_numpy(vtk_to_numpy(polydata.GetPoints().GetData()))

It is the GetPoints() method, not the vtk_to_numpy or encode method.

A topic which was already discussed here:
https://discourse.vtk.org/t/faster-method-for-getpoint/3189
and
https://discourse.vtk.org/t/what-is-best-way-to-get-the-highest-point-z-axis-in-a-polydata/1833/5

For one representation it takes around 40-80ms to get the points. When I have many representations, it gets very fast, very slow. Unable to animate anything.

Solution 1:
I combine all my polydata into one vtkAppendPolydata and create only one GeometryRepresentation. But then I have no possibility to select individual polydata/representation. If I would have access to the renderer/interactor/picker or at least the cellid within the click callback, then I could manage to get the selected polydata through global ids on vtk side.

Solution 2:
More efficient way to transfer the data from vtk to dash? Other method the GetPoints...etc.

Solution 1 seems to me more feasible. Is there a possibility to access the renderer/interactor/picker and/or cellid in the callback?

Thank you very much!

@jourdain
Copy link
Collaborator

jourdain commented May 7, 2023

The data transfer is as efficient as possible with dash. But when you do the picking, you should do the resolution on the server side as the client send you the ray info. Then the lookup on block id or else can then be achieved directly on the server like we do with the F1 example.

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

2 participants