<div dir="ltr">Thanks for your suggestions.<div style>I guess also calling &quot;repaint()&quot; instead of Render() on the vtkCanvas would be an option, as in this case Java will actually call paint() (which in turn calls Render() in vtkPanel&#39;s implementation) only if the component is visible and showing. What do you think?</div>
<div style><br></div><div style>In general, I understand that repaint() behaves differently from Render(), as multiple repaint() calls may be coalesced into a single paint() (hence, Render()) call. But this is not a problem for my present purposes.</div>
<div style><br></div><div style>Regards,</div><div style><br></div><div style>Marco</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 10, 2013 at 4:31 PM, TINGAUD Frederic <span dir="ltr">&lt;<a href="mailto:Frederic.TINGAUD@murex.com" target="_blank">Frederic.TINGAUD@murex.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="FR" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">As said by Sebastien, you can just add a test on isShowing() before calling Render() on your panel, to be sure the parent component is connected.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Fred<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">De :</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a> [mailto:<a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a>] <b>De la part de</b> Sebastien Jourdain<br>
<b>Envoyé :</b> vendredi 10 mai 2013 15:01<br><b>À :</b> Marco Sambin<br><b>Cc :</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br><b>Objet :</b> Re: [vtkusers] vtkCanvas and &quot;Visualization Toolkit&quot; window<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">That Render() call should not be made before the canvas is connected into a Swing parent component. That component can be non visible, but if it is just by itself, this is normal to see the behavior that you noticed.<u></u><u></u></p>
<div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Seb<u></u><u></u></p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div><p class="MsoNormal">On Fri, May 10, 2013 at 5:08 AM, Marco Sambin &lt;<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>&gt; wrote:<u></u><u></u></p>
<div><p class="MsoNormal">Hi Seb,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">thanks for your reply.<u></u><u></u></p></div><div><p class="MsoNormal">The short answer is: yes, I am building and adding my vtkCanvas to my application GUI in the EDT.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Let me explain a bit more how my application is working: this is a Swing-based Java application, managing medical images. When I press a button on the GUI of this application, the VTK-based reslicing feature (based on vtkImagePlaneWidget&#39;s functionality) is invoked.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">In particular, the three vtkImagePlaneWidgets are initialized, are connected with a Reader loading the volume (which was initialized in a separate thread), and they are placed in the vtkCanvas. This vtkCanvas is then added to a JPanel inside my application&#39;s GUI.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Debugging my application, I have noticed that the separate &quot;Visualization Toolkit&quot; window appears upon calling the Render() method on my vtkCanvas in a moment when the vtkCanvas hasn&#39;t been added to the parent JPanel yet.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Shall I absolutely avoid calling Render() on a vtkCanvas which is not visible yet?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p>
</div><div><p class="MsoNormal">Thanks and best regards,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Marco<u></u><u></u></p></div><div><div><div><p class="MsoNormal" style="margin-bottom:12.0pt">
<u></u> <u></u></p><div><p class="MsoNormal">On Thu, May 9, 2013 at 6:58 PM, Sebastien Jourdain &lt;<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>&gt; wrote:<u></u><u></u></p>
<div><p class="MsoNormal">How do you do the vtkCanvas binding within your frame ?<u></u><u></u></p><div><p class="MsoNormal">Does that piece of code get executed inside the EDT ?<u></u><u></u></p></div><div><p class="MsoNormal">
<u></u> <u></u></p></div><div><p class="MsoNormal">Since you are using vtk 6, you should probably use the new rendering class for Java which should give you more freedom. To learn more about them, you can look at our sample applications inside the Wrapping/Java directory within the source tree.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Seb<u></u><u></u></p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div><p class="MsoNormal">On Thu, May 9, 2013 at 12:44 PM, Marco Sambin &lt;<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>&gt; wrote:<u></u><u></u></p>
<div><p class="MsoNormal">Hi all.<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">In my Java application, I am using a vtkCanvas where three vtkImagePlaneWidgets are displayed, each one cutting a specific section of my volume (deriving from a medical data set).<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">At application startup, when the GUI of my Java application is built, I see for a few moments a pop-up window titled &quot;Visualization Toolkit&quot;, containing my three vtkImagePlaneWidgets. After a second or so,  this window disappears, and its content is then displayed inside my vtkCanvas, embedded in the GUI of my application, as expected.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Is the appearance of this window normal? Is there a way to prevent that separate &quot;Visualization Toolkit&quot; window from appearing, and have the content displayed directly inside my vtkCanvas?<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I am running VTK 6.0 (from GIT) and Java 7 64-bit on a Windows 7 64-bit PC.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p>
</div><div><p class="MsoNormal">Thanks in advance for all your comments.<u></u><u></u></p></div><div><p class="MsoNormal">Best regards,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">
Marco<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p>
</div></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p>
</div></div><p style="line-height:19px;margin:0px 0px 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;color:#2a2a2a">*******************************</p><p style="line-height:19px;margin:0px 0px 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;color:#2a2a2a">
<span lang="EN-GB" style="line-height:17px;font-size:10pt;color:black;font-family:Arial">This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. </span><span style="font-family:Arial" color="black" size="2"><span style="line-height:17px;font-size:10pt">Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.</span></span></p>
</div></blockquote></div><br></div>