<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Andras<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> vtkusers <vtkusers-bounces@vtk.org> <b>On Behalf Of
</b>lor fal<br>
<b>Sent:</b> Monday, April 9, 2018 2:30 AM<br>
<b>To:</b> Todd <nztoddler@yahoo.com><br>
<b>Cc:</b> vtkusers@vtk.org<br>
<b>Subject:</b> Re: [vtkusers] Render images in threads other than main thread<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#222222;background:white">Hi Todd,</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:#222222">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?<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Mon, Apr 2, 2018 at 6:31 PM, Todd <<a href="mailto:nztoddler@yahoo.com" target="_blank">nztoddler@yahoo.com</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">Hi Hugh<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><a href="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" target="_blank">http://www.informit.com/articles/article.aspx?p=1405551&seqNum=3</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span class="hoenzb"><span style="color:#888888">Todd</span></span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 2 Apr 2018 10:00 p.m., lor fal <<a href="mailto:lorfalwit@gmail.com" target="_blank">lorfalwit@gmail.com</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal">Hi all:<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Does anybody know exactly how to render images in worker thread?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks in advance.<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">Best regards,<br>
Hugh Lo<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">Best regards,<br>
Hugh Lo<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>