<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt">Hi David,<br><br>Thanks for all the info! I've reimplemented our system using vtkImageResliceMapper, but unfortunately the performance seems about the same. Here's a (really) stripped-down version of what my test case looks like now:<br><br>mapper = vtk.vtkImageResliceMapper()<br>mapper.SetInput(input)<br>mapper.SetSlicePlane(plane)<br>actor.SetMapper(mapper)<br>renderer.AddActor(actor)<br><br>start_time = time.time()<br>for i in range(100)<br> mapper.SetSlicePlane(new plane)<br> renderWindow.Render()<br>end_time = time.time()<br>print 'Elapsed time = ', end_time - start_time<div><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>Currently
I'm getting about 15 fps, which is better, but would be great to get above 30. An interesting thing I noticed is that even if I comment out the AddActor line, the for loop still takes about 1.6 seconds to run. With zero actors to render (I verify this before the loop by calling VisibleActorCount) I would expect the loop to complete nearly instantaneously. Any additional thoughts? Thanks again.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>--Matt</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style:
normal;"><span><br></span></div><div><br></div> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> David Gobbi <david.gobbi@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> M W <sonomw@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> "vtkusers@vtk.org" <vtkusers@vtk.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, August 27, 2013 10:32 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [vtkusers] vtkRenderer vs vtkRenderWindow performance<br> </font> </div> <div class="y_msg_container"><br>Hi Matt,<br><br>Are you reslicing the whole volume on each render? For it to be going<br>that slow, the vtkImageReslice class must be producing
200 output<br>slices for each render, which doesn't make sense because the renderer<br>is (I'm guessing) only displaying one slice at a time. In other<br>words, I think that if you reworked your pipeline you would probably<br>see things speed up by a factor of about 200.<br><br>I recommend that you use vtkImageResliceMapper instead of<br>vtkImageReslice. See this wiki page for details:<br><a href="http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes" target="_blank">http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes</a><br><br>About the timings, please note that vtkRenderer::Render() is not a<br>user method and you should never, ever call it directly. It is only<br>meant to be called from the vtkRenderWindow. When you call it<br>directly as in your code example, it doesn't do what it is supposed to<br>do, so the time you are getting for it is invalid. I won't explain<br>any further than that.<br><br> David<br><br>On Tue,
Aug 27, 2013 at 10:55 PM, M W <<a ymailto="mailto:sonomw@yahoo.com" href="mailto:sonomw@yahoo.com">sonomw@yahoo.com</a>> wrote:<br>> Hi all, I'm relatively new to VTK and am having some issues with<br>> performance. I am trying to achieve interactive slicing of a roughly<br>> 200x200x200 vtkVolume using vtkImageReslice, displayed through a 640x480<br>> wxVTKRenderWindow in Python. This is all working great, but it's slow,<br>> maybe 5 - 10 frames per second, making the application difficult to use.<br>> I'm running this on a Windows 7 / Intel Core i7 / nVidia Geforce GTX laptop.<br>><br>> The main bottleneck is the call to the wxVTKRenderWindow Render function.<br>> Out of curiosity, I timed the speed of the Render function of the<br>> vtkRenderer directly, and this was nearly an order of magnitude faster. Is<br>> this to be expected? I figured the bulk of the work would be in the<br>>
vtkRenderer. I'm fairly new to all of this so I'm not quite clear on what<br>> work is performed by the renderer/rendercollection/renderwindow/interactor,<br>> but is there a way to get the vtkRenderWindow Render to better match the<br>> speed of the vtkRenderer Render?<br>><br>> I get very smooth results rotating the entire volume within the<br>> wxVTKRenderWindow, so it seems somewhat unexpected that rendering a single<br>> slice is so much slower.<br>><br>> My test case looks something like this:<br>><br>> start_time = time.time()<br>> for i in range(100):<br>> self.sliceRenderer.Render()<br>> #self.sliceRenderWindow.Render()<br>> end_time = time.time()<br>> print 'Elapsed time = ', end_time - start_time<br>><br>> Any ideas? Thanks!<br>><br>> --Matt<br><br><br></div> </div> </div> </div></body></html>