<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 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@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;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:新宋体;
panose-1:2 1 6 9 3 1 1 1 1 1;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"\@新宋体";
panose-1:2 1 6 9 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","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.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
p.yiv723237296msonormal, li.yiv723237296msonormal, div.yiv723237296msonormal
{mso-style-name:yiv723237296msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.yiv723237296msochpdefault, li.yiv723237296msochpdefault, div.yiv723237296msochpdefault
{mso-style-name:yiv723237296msochpdefault;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.yiv723237296msohyperlink
{mso-style-name:yiv723237296msohyperlink;}
span.yiv723237296msohyperlinkfollowed
{mso-style-name:yiv723237296msohyperlinkfollowed;}
span.yiv723237296emailstyle17
{mso-style-name:yiv723237296emailstyle17;}
p.yiv723237296msonormal1, li.yiv723237296msonormal1, div.yiv723237296msonormal1
{mso-style-name:yiv723237296msonormal1;
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.yiv723237296msohyperlink1
{mso-style-name:yiv723237296msohyperlink1;
color:blue;
text-decoration:underline;}
span.yiv723237296msohyperlinkfollowed1
{mso-style-name:yiv723237296msohyperlinkfollowed1;
color:purple;
text-decoration:underline;}
span.yiv723237296emailstyle171
{mso-style-name:yiv723237296emailstyle171;
font-family:"Arial","sans-serif";
color:#1F497D;}
p.yiv723237296msochpdefault1, li.yiv723237296msochpdefault1, div.yiv723237296msochpdefault1
{mso-style-name:yiv723237296msochpdefault1;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:10.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle27
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
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><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Alo,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>This VTK mailing list thread might help:<o:p></o:p></span></p><p class=MsoNormal><a href="http://vtk.1045678.n5.nabble.com/rendering-into-a-render-window-from-multiple-threads-td2902372.html">http://vtk.1045678.n5.nabble.com/rendering-into-a-render-window-from-multiple-threads-td2902372.html</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Patrick<span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> igstk-users-bounces@public.kitware.com [mailto:igstk-users-bounces@public.kitware.com] <b>On Behalf Of </b>Alo Mihkelson<br><b>Sent:</b> Tuesday, January 17, 2012 6:04 AM<br><b>To:</b> igstk-users<br><b>Subject:</b> Re: [IGSTK-Users] Threaded IGSTK views with Qt<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal style='background:white'><span style='color:black'>Thanks for the reply,<br><br>On our initial attempts using QThread (Qt's threading system) we ran into problems with the OpenGL context switching between threads <br>(wglMakeCurrent errors).<br><br>And based on some quick research, the underlying VTK library is not thread-safe so it seems like there would be some additional complexity involved from dealing with locking/mutexes when accessing the renderer from multiple threads.<br><br>I'm wondering if I'm on the right path here and if anyone has run into similar problems related to rendering and even general GUI responsiveness and how you've solved them in your IGS applications.<br><br>Cheers, Alo<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><div><div><div class=MsoNormal align=center style='text-align:center;background:white'><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><hr size=1 width="100%" align=center></span></div><p class=MsoNormal style='background:white'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>From:</span></b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> "Cheng, Patrick" <PCheng@childrensnational.org><br><b>To:</b> Alo Mihkelson <alo_m1@yahoo.com>; igstk-users@public.kitware.com <br><b>Sent:</b> Thursday, January 12, 2012 6:58 PM<br><b>Subject:</b> RE: [IGSTK-Users] Threaded IGSTK views with Qt</span><span style='color:black'><o:p></o:p></span></p></div><p class=MsoNormal style='background:white'><span style='color:black'><br><br><o:p></o:p></span></p><div id=yiv723237296><div><div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Hi Alo,</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>You could consider doing it the other way around: spin off your resource intensive computation into a separate thread.</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Take a look at igstkTracker class where we use ITK thread to create a separate thread to interact with the physical tracker.</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt;font-family:新宋体;color:black'>itk::MultiThreader::Pointer m_Threader;</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt;font-family:新宋体;color:black'>m_Threader = itk::MultiThreader::New();</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt;font-family:新宋体;color:black'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt;font-family:新宋体;color:black'>m_ThreadID = m_Threader->SpawnThread( TrackingThreadFunction, </span><span style='font-size:9.5pt;font-family:新宋体;color:blue'>this</span><span style='font-size:9.5pt;font-family:新宋体;color:black'> );</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt;font-family:新宋体;color:black'>ITK_THREAD_RETURN_TYPE Tracker::TrackingThreadFunction(</span><span style='font-size:9.5pt;font-family:新宋体;color:blue'>void</span><span style='font-size:9.5pt;font-family:新宋体;color:black'>* pInfoStruct)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> { </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> ….</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> }</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt;font-family:新宋体;color:black'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Hope this helps,</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Patrick</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><span style='color:black'><o:p></o:p></span></p></div><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><div><p class=MsoNormal style='background:white'><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>From:</span></b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> igstk-users-bounces@public.kitware.com [mailto:igstk-users-bounces@public.kitware.com] <b>On Behalf Of </b>Alo Mihkelson<br><b>Sent:</b> Thursday, January 12, 2012 5:28 AM<br><b>To:</b> igstk-users@public.kitware.com<br><b>Subject:</b> [IGSTK-Users] Threaded IGSTK views with Qt</span><span style='color:black'><o:p></o:p></span></p></div></div></div><div><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></span></p></div><div><div><div><p class=MsoNormal style='background:white'><span style='color:black'>We're using IGSTK with Qt and would like to move the view rendering to a separate thread to avoid GUI slowdowns while rendering resource intensive (low-FPS) scenes. Is there a way to move the views/rendering out of the main Qt thread?<o:p></o:p></span></p></div></div></div></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='color:black'><o:p> </o:p></span></p></div></div></div></div></body></html>