[vtkusers] Render images in threads other than main thread

Andras Lasso lasso at queensu.ca
Mon Apr 9 18:29:16 EDT 2018


You can perform all processing in worker threads in the background. Only rendering must happen in the main thread. Rendering of images is usually quite fast - well below 10ms on an average desktop computer, so it should not be the bottleneck.

Also note that for real-time 2D image processing pipelines, enabling multithreading may make update rate much slower, especially when it interferes with the graphics driver’s threaded optimization. Potential solutions: force single-threading by setting global maximum number of threads to 1, use TBB as SMP backend, or fix the recently found bug in multithreader (https://gitlab.kitware.com/vtk/vtk/issues/17279).

Andras

From: vtkusers <vtkusers-bounces at vtk.org> On Behalf Of lor fal
Sent: Monday, April 9, 2018 2:30 AM
To: Todd <nztoddler at yahoo.com>
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Render images in threads other than main thread

Hi Todd,
Thanks for your advice. The problem is that I want to render the image in real-time. The solution suggested in the link you posted is no other than a repeating timer. Is there some way in Vtk to control the update rate?


On Mon, Apr 2, 2018 at 6:31 PM, Todd <nztoddler at yahoo.com<mailto:nztoddler at yahoo.com>> wrote:
Hi Hugh

GUI elements are normally only updated on the main thread, so I suspect you need to synchronize your callback from the worker thread. I'm not familiar with Qt, but it seems to be documented.
http://www.informit.com/articles/article.aspx?p=1405551&seqNum=3<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.informit.com%2Farticles%2Farticle.aspx%3Fp%3D1405551%26seqNum%3D3&data=02%7C01%7Classo%40queensu.ca%7Cd22e67d6165d4f57babd08d59de34a1c%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636588521883890053&sdata=k3wdNrNILh1CdBsEC2dOsyoJwny8RzNIj7eMCSm78AM%3D&reserved=0>

Todd


On 2 Apr 2018 10:00 p.m., lor fal <lorfalwit at gmail.com<mailto:lorfalwit at gmail.com>> wrote:
Hi all:

I am using QVTKOpenGLWidget to bridge between Qt and Vtk. However, when I trying to call vtkRenderWindowInteractor::Render in worker thread, it always report error like "makeCurrent() error", which seems something wrong while changing OpenGL context. I have googled my questions and found some suggestions but none of them could work.

Does anybody know exactly how to render images in worker thread?

Thanks in advance.

--
Best regards,
Hugh Lo




--
Best regards,
Hugh Lo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180409/d9f2019b/attachment.html>


More information about the vtkusers mailing list