[vtk-developers] QVTKRenderWindowInteractor bug in Mac OS

Andras Lasso lasso at queensu.ca
Wed Oct 31 21:17:15 EDT 2018


Initially, when 3D Slicer switched to VTK8/Qt5/OpenGL2 backend, image reslice speed was about 5-10x slower than using the old VTK7/Qt4/OpenGL backend.

We could achieve acceptable performance by:
1. Switching to TBB SMP backend in VTK. This primarily helped on Windows computers with i7 CPU and strong NVidia GPU (https://github.com/Slicer/Slicer/pull/930).
2. Tuning strategy how ScheduleRender() calls are converted to Render() calls. This helped in particular in getting consistent frame rates on MacOSX. (https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.h)

Still, image reslicing is about 10-20% slower with VTK8/Qt5/OpenGL2, especially on laptops and computers with combined integrated+discrete GPU. It seems most time is spent in the OpenGL driver, mainly due to calls made from vtkOpenGLTexture::Load (https://issues.slicer.org/view.php?id=4496).

Andras

-----Original Message-----
From: vtk-developers <vtk-developers-bounces at public.kitware.com> On Behalf Of take5v
Sent: Wednesday, October 31, 2018 6:58 PM
To: vtk-developers at vtk.org
Subject: Re: [vtk-developers] QVTKRenderWindowInteractor bug in Mac OS

Hi David!

Thank you for the detailed response. I've changed Render call with QVTKRenderWindowInteractor update method but I observed no performance change. But I got lucky twice when changing window/level was real-time without any lags. I have no idea how to reproduce this behavior again but I do confirm the same inconsistency in Slicer3D on Windows machine. I found changing window/level of 2d slices is slow but 3d volume rendering is fast.
There is a thread, apparently, with similar performance issue from Slicer3D:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdiscourse.slicer.org%2Ft%2F2d-views-in-slicer-extremely-slow-on-windows%2F782&data=02%7C01%7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=z%2F85pd7WeC8GI7%2FmnMlNsUcx3JRogc5sJfByit0kA0Q%3D&reserved=0.
I also tried vtkImageViewer2 without qt and got the same laggy behavior.

Nvidia driver: 411.31



David Gobbi wrote
> Hi Stas,
> 
> Here are a couple things to try to improve fps (no guarantees, though).
> 
> With QVTKRenderWindowInteractor, it is best to let Qt handle the 
> render calls, rather than calling Render() directly.  So try replacing 
> all of your calls to Render() with calls to self.update(), where 
> 'self' is the QVTKRenderWindowInteractor.  If you do not do this, then 
> it is possible that the Render() is hidden because it isn't associated 
> with a Qt paint operation. By calling update() on a Qt widget, you 
> ensure that Qt will call Render() synchronously with its paintEvent().
> 
> A second thing to try is to call Update() on your reader before using 
> its output.  Most readers will 'stream' which means that they only 
> read the slices that are requested by the VTK pipeline (possibly 
> causing the reader to re-execute on future pipeline requests), unless 
> you specifically call Update() which forces all the slices to be read 
> into memory at once.  Since your example only has one input slice, I 
> doubt that this is what is causing a slow-down for you, but it is 
> still a good habit when working with VTK readers.
> 
>   - David
> 
> 
> On Wed, Oct 31, 2018 at 10:57 AM take5v <

> stas.truhan@

> > wrote:
> 
>> Another issue but within the same context of mine toy example (script 
>> of which I posted above) is a slow fps during window/level change on 
>> Windows.
>> This process is slow and laggy even during rendering the super small 
>> image of vtk.png from VTKData.
>>
>> CPU: GeForce GTX 680
>> GPU: Intel i7-3770K
>>
>>
>>
>> -----
>> Best regards,
>> Stanislau Trukhan
>> --
>> Sent from: 
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1
>> 045678.n5.nabble.com%2FVTK-Dev-f1251487.html&data=02%7C01%7Classo
>> %40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582
>> c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=EOxcLPZE4jDzrxX
>> k0KOIf9RqXouukZgL7HC46iwz6NU%3D&reserved=0
>> _______________________________________________
>> Powered by 
>> https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&am
>> p;data=02%7C01%7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f84489
>> 1%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&amp
>> ;sdata=iZoyvIzvUo3wwXD0sMcGmJaw2kRTyRVktar3DnBYOFM%3D&reserved=0
>>
>> Visit other Kitware open-source projects at
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.k
>> itware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40
>> queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4e
>> fb2838b925c%7C1%7C0%7C636766234722688008&sdata=f%2BKMU0xm65TMwdPj
>> TMLZwBorIQ7cwgA8mjdrNIHYCQg%3D&reserved=0
>>
>> Search the list archives at: 
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkm
>> ail.org%2Fsearch%2F%3Fq%3Dvtk-developers&data=02%7C01%7Classo%40q
>> ueensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4ef
>> b2838b925c%7C1%7C0%7C636766234722688008&sdata=sHi5aRgy7vD%2BLy%2B
>> dcLgAfMntvGLyfl3ZhHdddq270ow%3D&reserved=0
>>
>> Follow this link to subscribe/unsubscribe:
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpubl
>> ic.kitware.com%2Fmailman%2Flistinfo%2Fvtk-developers&data=02%7C01
>> %7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38
>> b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=fQsqBZg
>> 8c8fc2sL4duw2325P8PnFuE75a%2BowRhAFWcQ%3D&reserved=0
>>
>>
> 
> _______________________________________________
> Powered by 
> https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&amp
> ;data=02%7C01%7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%
> 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sd
> ata=iZoyvIzvUo3wwXD0sMcGmJaw2kRTyRVktar3DnBYOFM%3D&reserved=0
> 
> Visit other Kitware open-source projects at
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ki
> tware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40qu
> eensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4efb2
> 838b925c%7C1%7C0%7C636766234722688008&sdata=f%2BKMU0xm65TMwdPjTMLZ
> wBorIQ7cwgA8mjdrNIHYCQg%3D&reserved=0
> 
> Search the list archives at: 
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkma
> il.org%2Fsearch%2F%3Fq%3Dvtk-developers&data=02%7C01%7Classo%40que
> ensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4efb28
> 38b925c%7C1%7C0%7C636766234722688008&sdata=sHi5aRgy7vD%2BLy%2BdcLg
> AfMntvGLyfl3ZhHdddq270ow%3D&reserved=0
> 
> Follow this link to subscribe/unsubscribe:
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpubli
> c.kitware.com%2Fmailman%2Flistinfo%2Fvtk-developers&data=02%7C01%7
> Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b14
> 2d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=fQsqBZg8c8f
> c2sL4duw2325P8PnFuE75a%2BowRhAFWcQ%3D&reserved=0





-----
Best regards,
Stanislau Trukhan
--
Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Dev-f1251487.html&data=02%7C01%7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=EOxcLPZE4jDzrxXk0KOIf9RqXouukZgL7HC46iwz6NU%3D&reserved=0
_______________________________________________
Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=iZoyvIzvUo3wwXD0sMcGmJaw2kRTyRVktar3DnBYOFM%3D&reserved=0

Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=f%2BKMU0xm65TMwdPjTMLZwBorIQ7cwgA8mjdrNIHYCQg%3D&reserved=0

Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=sHi5aRgy7vD%2BLy%2BdcLgAfMntvGLyfl3ZhHdddq270ow%3D&reserved=0

Follow this link to subscribe/unsubscribe:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C60be52993c6448c59bbb08d63f844891%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636766234722688008&sdata=fQsqBZg8c8fc2sL4duw2325P8PnFuE75a%2BowRhAFWcQ%3D&reserved=0



More information about the vtk-developers mailing list