<div dir="ltr">Hi Dan,<div>Thanks a lot for the reply. Yes, that's exactly the case. If I remove the text actors, the world picker would return the correct coordinates. So, what method should I use in order to get the correct coordinates no matter how many actors I put in with the dicom image reader actor?</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Many thanks.<br><br><br></div>Bill<br></div></div></div>
<br><div class="gmail_quote">On Mon, May 22, 2017 at 10:04 PM, Dan Lipsa <span dir="ltr"><<a href="mailto:dan.lipsa@kitware.com" target="_blank">dan.lipsa@kitware.com</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">Bill,<div>For display_to_world, the picker picks up only what is visible (closes to the camera). You might have several objects (several values in world coordinates) that end up over the same display coordinate. This might explain why adding those text actors changes what you pick.</div><div><br></div><div>Dan</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sun, May 21, 2017 at 5:25 AM, Bill Q <span dir="ltr"><<a href="mailto:bill.q.hdp@gmail.com" target="_blank">bill.q.hdp@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Can anybody help? Many thanks.</div><div class="gmail_extra"><br clear="all"><div><div class="m_-6957818546935361841m_1248160547709933159gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Many thanks.<span class="m_-6957818546935361841HOEnZb"><font color="#888888"><br><br><br></font></span></div><span class="m_-6957818546935361841HOEnZb"><font color="#888888">Bill<br></font></span></div></div></div>
<br><div class="gmail_quote"><span>On Fri, May 19, 2017 at 11:20 PM, Bill Q <span dir="ltr"><<a href="mailto:bill.q.hdp@gmail.com" target="_blank">bill.q.hdp@gmail.com</a>></span> wrote:<br></span><div><div class="m_-6957818546935361841h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello Everyone,</div><div>I encountered a weird problem in coordinate conversion.</div><div><br></div><div>In order to check the accuracy, I converted from display to world, and from world back to display. Using the following ways:</div><div>
<p class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>self.world_picker = vtk.vtkWorldPointPicker()<br></b></span></p><p class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>def </b></span>display_to_world(<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>, pt):<br>
<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.world_picker.Pick(pt[<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], pt[<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1</span>], <span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>, <span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren)<br>
picker_pt = <span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.world_picker.GetPickPosit<wbr>ion()<br>
picker_pt = (picker_pt[<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], picker_pt[<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1</span>], <span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>)<br>
<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>return </b></span>picker_pt</p><p class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1">
</p><p class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>def </b></span>world_to_display(<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>, pt):<br>
<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>if </b>len</span>(pt) == <span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">3</span>:<br>
pt = pt + (<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1.0</span>,)<br>
<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>elif </b>len</span>(pt) == <span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">2</span>:<br>
pt = pt + (<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0.0</span>, <span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1.0</span>)<br>
<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.SetWorldPoint(pt)<br>
<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.WorldToDisplay()<br>
pt = <span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.GetDisplayPoint()<br>
<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s4">pt </span>= (pt[<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], pt[<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1</span>])<br>
<span class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>return </b></span>pt</p><p class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1">pt = [5, 5]</p><p class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1">world_pt = self. world_to_display(pt)</p><p class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1">display_pt = self. world_to_display(world_pt)</p></div><div>In some cases, it's quite accurate, which means pt equals display_pt. But, in some cases, the result is simply wrong. For example, for (5, 5), after conversions back to display, the coordinate becomes (20.89, 20.89).</div><div><br></div><div>Any ideas?</div><div><br></div><div><br></div><div><div class="m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail_signature"><div dir="ltr"><div>Many thanks.<span class="m_-6957818546935361841m_1248160547709933159HOEnZb"><font color="#888888"><br><br><br></font></span></div><span class="m_-6957818546935361841m_1248160547709933159HOEnZb"><font color="#888888">Bill<br></font></span></div></div></div>
</div>
</blockquote></div></div></div><br></div>
<br></div></div>______________________________<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/opensou<wbr>rce/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_FA<wbr>Q</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/mail<wbr>man/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>