[vtkusers] vtkRenderer vs vtkRenderWindow performance

David Gobbi david.gobbi at gmail.com
Wed Aug 28 01:32:55 EDT 2013


Hi Matt,

Are you reslicing the whole volume on each render?  For it to be going
that slow, the vtkImageReslice class must be producing 200 output
slices for each render, which doesn't make sense because the renderer
is (I'm guessing) only displaying one slice at a time.  In other
words, I think that if you reworked your pipeline you would probably
see things speed up by a factor of about 200.

I recommend that you use vtkImageResliceMapper instead of
vtkImageReslice.  See this wiki page for details:
http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes

About the timings, please note that vtkRenderer::Render() is not a
user method and you should never, ever call it directly.  It is only
meant to be called from the vtkRenderWindow.  When you call it
directly as in your code example, it doesn't do what it is supposed to
do, so the time you are getting for it is invalid.  I won't explain
any further than that.

 David

On Tue, Aug 27, 2013 at 10:55 PM, M W <sonomw at yahoo.com> wrote:
> Hi all, I'm relatively new to VTK and am having some issues with
> performance.  I am trying to achieve interactive slicing of a roughly
> 200x200x200 vtkVolume using vtkImageReslice, displayed through a 640x480
> wxVTKRenderWindow in Python.  This is all working great, but it's slow,
> maybe 5 - 10 frames per second, making the application difficult to use.
> I'm running this on a Windows 7 / Intel Core i7 / nVidia Geforce GTX laptop.
>
> The main bottleneck is the call to the wxVTKRenderWindow Render function.
> Out of curiosity, I timed the speed of the Render function of the
> vtkRenderer directly, and this was nearly an order of magnitude faster.  Is
> this to be expected?  I figured the bulk of the work would be in the
> vtkRenderer.  I'm fairly new to all of this so I'm not quite clear on what
> work is performed by the renderer/rendercollection/renderwindow/interactor,
> but is there a way to get the vtkRenderWindow Render to better match the
> speed of the vtkRenderer Render?
>
> I get very smooth results rotating the entire volume within the
> wxVTKRenderWindow, so it seems somewhat unexpected that rendering a single
> slice is so much slower.
>
> My test case looks something like this:
>
> start_time = time.time()
> for i in range(100):
>      self.sliceRenderer.Render()
>      #self.sliceRenderWindow.Render()
> end_time = time.time()
> print 'Elapsed time = ', end_time - start_time
>
> Any ideas?  Thanks!
>
> --Matt



More information about the vtkusers mailing list