[vtkusers] Re: Rendering speed is window-size dependent - Example Script

WolfgangZillig wollez at gmx.net
Fri Jan 26 09:35:30 EST 2007


Hi Andrea,

it works here fine, even with the maximized window I can turn and zoom 
without any delay. Python uses about 140 MB of RAM (when I can trust the 
task manager).

But running the code I get a warning:
 >python -u "VTKExample.py"
D:\Programme\Python\lib\site-packages\vtk\wx\wxVTKRenderWindow.py:79: 
DeprecationWarning: The wxPython compatibility package is no longer 
automatically generated or activly maintained.  Please switch to the wx 
package as soon as possible.
   from wxPython.wx import *

Hope that helps

PS I'm running Python 2.5 on win XP (laptop)

Andrea Gavana schrieb:
> Hi All,
> 
>    I managed to put together a very small example that demonstrates
> the problem. I am attaching a very small Python script, together with
> the VTK data file here:
> 
> http://fs06n5.sendspace.com/dl/c5243ba232ae95758c05c8a8370602c4/45ba0437/cn12eo/VTKExample.zip 
> 
> 
> The loading process is very fast, you will see a wxNotebook with 2
> pages. If you play a bit with the 2 VTKRenderWindows (switching pages
> back and forth, zooming and panning), and then you try to maximize the
> main frame, the rendering almost stops. It becomes *very* slow on one
> of the two notebook tabs. The other seems unaffected. The unstructured
> grid itself is small, so I wouldn't have expected such a huge
> performance hit.
> 
> Could *please* someone try it and see if he/she gets the same result?
> 
> I am trying to test it also on ParaView, but I don't know it very well
> and I don't know if it is possible to have multiple views (tabs or
> splitters or whatever) at the same time.
> 
> I will try also with Mayavi2 as soon as I can get SVN access (as far
> as I know, Mayavi2 is the only GUI out there that manages views with
> tabs).
> 
> Thank you for your suggestions.
> 
> Andrea.
> 
> "Imagination Is The Only Weapon In The War Against Reality."
> http://xoomer.virgilio.it/infinity77/
> 
> 
> ------------------------------------------------------------------------
> 
> import wx
> 
> import vtk
> from vtk.wx.wxVTKRenderWindow import wxVTKRenderWindow
> 
> class Viewer(wxVTKRenderWindow):
> 
>     def __init__(self, parent):
> 
>         wxVTKRenderWindow.__init__(self, parent, -1)
> 
>         self.ren = vtk.vtkRenderer()
>         self.GetRenderWindow().AddRenderer(self.ren)
>         
>         reader = vtk.vtkUnstructuredGridReader()
>         reader.SetFileName("VTKExample.vtk")
>         reader.SetScalarsName("_I_PORV")
> 
>         surfaceMapper = vtk.vtkDataSetMapper()
>         surfaceMapper.SetInputConnection(reader.GetOutputPort())
>         surfaceMapper.SetScalarRange((1e3, 2e6))
> 
>         surfaceActor = vtk.vtkActor()
>         surfaceActor.SetMapper(surfaceMapper)
> 
>         self.ren.AddActor(surfaceActor)
>             
>         self.ren.ResetCamera()
>         self.ren.BackingStoreOn()
> 
> 
> class MainFrame(wx.Frame):
> 
>     def __init__(self, parent, id, title, size):
> 
>         wx.Frame.__init__(self, parent, id, title, size=size)
>         notebook = wx.Notebook(self, -1)
> 
>         for ii in xrange(2):
>             page = Viewer(notebook)
>             notebook.AddPage(page, "Viewer No %d"%(ii+1))
> 
>         self.CenterOnScreen()
>         self.Show()
> 
> app = wx.PySimpleApp()
> frame = MainFrame(None, -1, "VTK Example", (400, 400))
> app.MainLoop()
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list