<div dir="ltr">Hi<div><br>here's one way to do what you want:<br><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/PickingAPixel2">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/PickingAPixel2</a><br></div><div>You do not have to involve Qt events ... add a VTK callback that<br>listens to VTK events.<br></div><div><br></div><div>- Dean<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 7, 2016 at 8:55 AM, Abdelkhalek Bakkari <span dir="ltr"><<a href="mailto:bakkari.abdelkhalek@hotmail.fr" target="_blank">bakkari.abdelkhalek@hotmail.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_-8826215757706667522divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:'Times New Roman',Times,serif" dir="ltr">
<p><br>
</p>
<div style="color:rgb(0,0,0)">
<div>
<div id="m_-8826215757706667522divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:'Times New Roman',Times,serif">
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
<span style="font-family:"Times New Roman",Times,serif"></span></p>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
<span style="font-family:"Times New Roman",Times,serif">Dear VTK users</span><span style="font-family:"Times New Roman",Times,serif">,</span></p>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
<br>
<br>
<span style="font-family:"Times New Roman",Times,serif">I am using QT and VTK. I created a mouse release method to use it inside a QVTKWidget :</span></p>
<pre class="m_-8826215757706667522x_lang-cpp m_-8826215757706667522x_prettyprint m_-8826215757706667522x_prettyprinted" style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;background-color:rgb(239,240,241);color:rgb(57,51,24);word-wrap:normal"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;white-space:inherit"><span class="m_-8826215757706667522x_kwd" style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)">void</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> </span><span class="m_-8826215757706667522x_typ" style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">MyQVTKWidget</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">::</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">mouseReleaseEven<wbr>t</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span class="m_-8826215757706667522x_typ" style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">QMouseEvent</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">*</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> event</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">)</span></code></pre>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
{</p>
<pre class="m_-8826215757706667522x_lang-cpp m_-8826215757706667522x_prettyprint m_-8826215757706667522x_prettyprinted" style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;background-color:rgb(239,240,241);color:rgb(57,51,24);word-wrap:normal"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;white-space:inherit"><span class="m_-8826215757706667522x_kwd" style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)">if</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> </span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">pMainWindow</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">)</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">
</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">{</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">

    </span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">((</span><span class="m_-8826215757706667522x_typ" style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">MainWindow</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> </span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">*)</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">pMainWindow</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">)-></span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">myMouseRelease<wbr>Event</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">event</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">);</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">
</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">}</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">

    </span><span class="m_-8826215757706667522x_com" style="margin:0px;padding:0px;border:0px;color:rgb(133,140,147)">// call the super class to avoid troubles</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">

    </span><span class="m_-8826215757706667522x_typ" style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">QVTKWidget</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">::</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">mouseReleaseEvent</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span class="m_-8826215757706667522x_pln" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"><wbr>event</span><span class="m_-8826215757706667522x_pun" style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">);</span></code></pre>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
}</p>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
<span style="font-family:"Times New Roman",Times,serif">Now, I would like to map (x,y) to slice (i,j). Generally, mouse position should be mapped into ( i, j) of current slice. I</span><span style="font-family:"Times New Roman",Times,serif">t depends
 on the zoom factor, </span><span style="font-family:"Times New Roman",Times,serif">aspect ratio of the slice </span><span style="font-family:"Times New Roman",Times,serif">and the window size.</span><span style="font-family:"Times New Roman",Times,serif"><br>
</span><span style="font-family:"Times New Roman",Times,serif"> </span></p>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
<span style="font-family:"Times New Roman",Times,serif">But, I am wondering about how can I solve this issue.  </span></p>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
<span style="color:rgb(33,33,33);font-family:"Times New Roman",Times,serif"><br>
</span></p>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
<span style="color:rgb(33,33,33);font-family:"Times New Roman",Times,serif"><br>
</span></p>
<p style="margin-right:0px;margin-bottom:1em;margin-left:0px;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">
<span style="font-family:"Times New Roman",Times,serif"></span><span style="color:rgb(33,33,33);font-family:"Times New Roman",Times,serif">Thanks in advance!</span></p>
<span style="font-family:"Times New Roman",Times,serif;font-size:16px">Best regards,</span><span style="font-family:"Times New Roman",Times,serif;font-size:16px"></span>
<p style="font-family:"Times New Roman",Times,serif;font-size:16px"></p>
<p style="font-family:"Times New Roman",Times,serif;font-size:16px"><br>
</p>
<div id="m_-8826215757706667522x_Signature" style="font-family:"Times New Roman",Times,serif;font-size:16px">
<font face="Garamond" size="3">Abdelkhalek Bakkari</font>
<div><span style="line-height:14px"><font face="Garamond" size="3">Ph.D candidate in Computer Science</font></span></div>
<div><span style="line-height:20.8267px"><font face="Garamond" size="3">Institute of Applied Computer Science</font></span></div>
<div><span style="line-height:18.4px"><font face="Garamond" size="3">Lodz University of Technology, Poland</font></span></div>
</div>

<p></p>
<div id="m_-8826215757706667522Signature">
<div><span style="line-height:18.399999618530273px"><font face="Garamond" size="3"></font></span></div>
<div><span style="line-height:18.399999618530273px"><font face="Garamond" size="3"><br>
</font></span></div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>