<div dir="ltr">Hi Dan,<div>Thanks a ton for the example. The example used 4 different viewports. However, for my application, I need to set all renderers under the same viewport. The problem is that if I add a second renderer into the render window and using the default viewport, it will cover the first renderer and nothing on the first renderer will show up. I am wondering if I did the whole thing wrong.</div><div><br></div><div>My purpose is to display some DICOM images, some texts, and scales on the same screen. Also, I would like to make the scales zoom with the DICOM images but the texts stay put. Most importantly, I would like to get the world coordinates on the DICOM image when users click on the screen, so I can mark the click properly.</div><div><br></div><div>What should be done in order to get this working?</div><div><br></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 Wed, May 24, 2017 at 12:02 AM, 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">Not sure what is going on. Do the objects you are rendering have the same world coordinates? Are both renderers added to the rendering window?<div>Here is an example with multiple renderer (they are over different viewports but they could have the same viewport as well)</div><div><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/MultipleViewports" target="_blank">http://www.vtk.org/Wiki/VTK/<wbr>Examples/Cxx/Visualization/<wbr>MultipleViewports</a><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 23, 2017 at 11:39 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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I just gave it a try. But when I added another renderer into the window that I used for text actors, it overlaps and covered the first renderer. So the first renderer won't show up. Is there a solution?</div><div class="gmail_extra"><br clear="all"><div><div class="m_4753725604926504473m_9207793549081152964gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Many thanks.<span class="m_4753725604926504473HOEnZb"><font color="#888888"><br><br><br></font></span></div><span class="m_4753725604926504473HOEnZb"><font color="#888888">Bill<br></font></span></div></div></div><div><div class="m_4753725604926504473h5">
<br><div class="gmail_quote">On Tue, May 23, 2017 at 10:16 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">I think moving those text actors on a different renderer will solve your problem.<span class="m_4753725604926504473m_9207793549081152964HOEnZb"><font color="#888888"><div><br></div><div>Dan</div><div><br></div></font></span></div><div class="m_4753725604926504473m_9207793549081152964HOEnZb"><div class="m_4753725604926504473m_9207793549081152964h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 23, 2017 at 9:40 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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Many thanks.<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173HOEnZb"><font color="#888888"><br><br><br></font></span></div><span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173HOEnZb"><font color="#888888">Bill<br></font></span></div></div></div><div><div class="m_4753725604926504473m_9207793549081152964m_1863566633137369173h5">
<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="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058h5">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="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058h5"><div dir="ltr">Can anybody help? Many thanks.</div><div class="gmail_extra"><br clear="all"><div><div class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Many thanks.<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841HOEnZb"><font color="#888888"><br><br><br></font></span></div><span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-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_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-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_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>self.world_picker = vtk.vtkWorldPointPicker()<br></b></span></p><p class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>def </b></span>display_to_world(<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>, pt):<br>
    <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.world_picker.Pick(pt[<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], pt[<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1</span>], <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>, <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren)<br>
    picker_pt = <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.world_picker.GetPickPosit<wbr>ion()<br>
    picker_pt = (picker_pt[<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], picker_pt[<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1</span>], <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>)<br>
    <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>return </b></span>picker_pt</p><p class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1">







</p><p class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>def </b></span>world_to_display(<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>, pt):<br>
    <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>if </b>len</span>(pt) == <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">3</span>:<br>
        pt = pt + (<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1.0</span>,)<br>
    <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>elif </b>len</span>(pt) == <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">2</span>:<br>
        pt = pt + (<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0.0</span>, <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1.0</span>)<br>
    <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.SetWorldPoint(pt)<br>
    <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.WorldToDisplay()<br>
    pt = <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.GetDisplayPoint()<br>
    <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s4">pt </span>= (pt[<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], pt[<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s3">1</span>])<br>
    <span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-s1"><b>return </b></span>pt</p><p class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1">pt = [5, 5]</p><p class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail-p1">world_pt = self. world_to_display(pt)</p><p class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-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_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159m_8102450165141326187gmail_signature"><div dir="ltr"><div>Many thanks.<span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-6957818546935361841m_1248160547709933159HOEnZb"><font color="#888888"><br><br><br></font></span></div><span class="m_4753725604926504473m_9207793549081152964m_1863566633137369173m_1361774753359976058m_-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></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>