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

Inconsistent plotting results with PyVistaQT versus Jupyter (Trame) backends #361

Open
robertsoakes opened this issue Apr 14, 2023 · 3 comments

Comments

@robertsoakes
Copy link

Issue: plotting volume and mesh data in the same viewport results in misalignment for the QTInteractor in X and Z planes, but not for Jupyter (Trame) backend.

Example 1: plot in QTInteractor. Bone models are shifted up and to the right.
image

Example 2: plot in JupyterLab with the Trame server backend.
image

I've spent most of the last day trying to track down the issue, and can't seem to figure it out. The Trame backend seems to have some kind of unified coordinate system that isn't present in the QTInteractor, but I've been through both the PyVista and Trame code bases and it isn't clear to me what that would be.

@larsoner
Copy link
Contributor

Can you check to see if pv.Plotter itself (rather than QtInteractor / BackgroundPlotter) also has this problem?

@robertsoakes
Copy link
Author

@larsoner I'll try and stage a test for this tomorrow.

I'll be honest, I'm not completely sure how, though. Is there a way to pass a pv.Plotter instance to QT -- I guess I could probably just do a screen capture. The Jupyter server backend seems to work, but volume rendering is not supported in the current client renderer, and I wasn't able to get the deprecated renderers to display anything.

I spent some additional time poking at things, and the issue seems to be partly due to PyVista ignoring data in the vtkImageData direction matrix. I wasn't able to figure out how to apply the rotation matrix to the image data, but the results for a unit matrix and the directional matrix look exactly the same.

This is what the Jupyter Trame backend plots without the direction matrix:
image

After having poked more at the Trame backend, it looks like PyVista is just passing the underlying VTK classes through? (Trame is super cool, BTW. Really looking forward to seeing where it goes.)

@larsoner
Copy link
Contributor

I'll be honest, I'm not completely sure how, though. Is there a way to pass a pv.Plotter instance to QT

No, I'm suggesting you avoid Qt entirely for the pv.Plotter test. Just use that interface with whatever window it pops up and see if it has the same problem or not. It will help identify if it's really a Qt-specific problem or not.

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