Comments (16)
No, I've never seen that before.
Could you elaborate a bit? When you say screenshot, do you mean vtkplotlib.save_fig()
or the PrtSC button on your keyboard? Am I right in saying it's the black ring-shaped thing you want to screenshot but the little windows in the bottom left that shouldn't be there?
Also can you post your VTK version (using pip show vtk
or conda info vtk
)?
from vtkplotlib.
from vtkplotlib.
I hate to think what a lot of these vtk classes get up to underneath. I've just tried on Ubuntu 19.10 and that's all working normally. I'd like to do some tests but firstly does it change if you change the pixels parameter or plot something different (such as vpl.quick_test_plot()
)?
from vtkplotlib.
from vtkplotlib.
OK, I've tried what you said and I can't reproduce it at all. I noticed that screenshot_fig()
doesn't call vtkWindowToImageFilter.Modified()
which I think it aught to and there is also off screen rendering to play with. I've done a stripped down example for you to test. Could you give it a run for me please?
import vtkplotlib as vpl
import vtkplotlib.image_io
import matplotlib.pylab as plt
import vtk
import time
fig = vpl.figure()
vpl.quick_test_plot()
# Try turning this one on and off and see if it changes anything.
#fig.renWin.SetOffScreenRendering(True)
since = time.time()
while time.time() - since < 2:
pass
fig.connect()
fig.reset_camera()
fig.renWin.Render()
win2im_filter = vtk.vtkWindowToImageFilter()
win2im_filter.SetInput(fig.renWin)
win2im_filter.Modified()
win2im_filter.Update()
arr = vpl.image_io.vtkimagedata_to_array(win2im_filter.GetOutput())
win2im_filter.SetInput(None)
vpl.close(fig)
plt.imshow(arr)
plt.show()
from vtkplotlib.
from vtkplotlib.
from vtkplotlib.
from vtkplotlib.
I am attaching the images generated by both
Either you forgot to attach or they didn't work... :)
Did you try the fig.renWin.SetOffScreenRendering(True)
line near the top?
Also are you doing teeth as well? That's what I wrote this library for in the first place.
from vtkplotlib.
This following one is the correct image, output of fig.renWin.SetOffScreenRendering(True)
:
This is the bad screenshot generated by the above routine:
This is the output of screenshot_fig:
Yes I am working on intra-oral scans, small world!!
The fig.renWin.SetOffScreenRendering(True)
line seems to do the job, thanks a lot. The only issue is it is not running from the shell on the server and aborting with error "Aborting - bad X server connection." But that does not belong to this thread. I will edit the screenshot_fig in my environment to reflect this change. Thank you for your inputs.
from vtkplotlib.
OK, I'm glad you highlighted that. It looks like off screen rendering can get ugly. I'll pop it in the next update but as an optional parameter.
from vtkplotlib.
Could you do me a favour and keep me posted on your resolving that bad X-server issue? I'd like to at least add it to the docs if it's not practical to fix outright.
from vtkplotlib.
It works when I make a GUI login to the server, open terminal and run the application. It does not work when I connect to the server through SSH. Do you want me to post a screenshot of the error?
from vtkplotlib.
Might as well although I doubt I can help much. I did a google of "Aborting - bad X server connection" and this comment seems to say you need a special build of VTK with OSMesa. But the fact you can get it to work via the GUI suggests you already have everything you need.
from vtkplotlib.
Yes I am good with the current solution, even if it doesn't work with SSH, I was just suggesting it for your documentation purposes
from vtkplotlib.
OK. I'll leave this issue open until I've pushed and released the changes. Thanks for your help with this.
Just as a warning to future readers of this thread: The fig.renWin.SetOffScreenRendering(True)
option seems to mess the vtkRenderWindow irreversibly so that the figure can no longer be shown normally without crashing. Calling vpl.close(fig=fig)
after screenhot_fig()
or save_fig()
resets the vtkRenderWindow so that the figure can be safely reshown. Hopefully this will all be ironed out in the next release (v1.3.0) so that you shouldn't need to worry about any of this.
from vtkplotlib.
Related Issues (14)
- Rotating the camera around a figure | Rotating the figure itself HOT 3
- Object manipulation with draggable arrows HOT 7
- Background transparency HOT 6
- Performance improvement HOT 8
- TRABAJO CON vtkplotlib HOT 1
- Save stl data into image files (jpg, png,...)
- How to change 2d text dynamicly? HOT 1
- Problem with non interactive visualization? HOT 13
- Displaying images as 3D objects HOT 2
- Display overlapping meshes HOT 2
- How to add stl display to tkinter? HOT 1
- Error with Sys module when trying to make pipenv with extended test dependencies HOT 2
- Saving mesh_plot to image?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vtkplotlib.