Markus,<br><br>I&#39;m not sure why you need to render everything first. It sounds like you are trying to accomplish a preprocessing step on the geometry that is view independent, that is, you want to know what parts of skin the needle shouldn&#39;t go through to avoid hitting organs. I could see the possibility of using graphics hardware to accelerate computation of the occluded skin from a point (say, the center of the tumor) by using a shadow mapping algorithm, but how to do this for the full tumor geometry is not immediately clear to me.<br>
<br>In any case, I don&#39;t know of anything in VTK can be used to solve your problem easily. I think you are going to have to use a computational geometry toolkit, but I&#39;ll defer to those with more computational geometry experience than me.<br>
<br>Good luck,<br>Cory<br><br><div class="gmail_quote">On Wed, Dec 3, 2008 at 8:37 AM, Engel Markus <span dir="ltr">&lt;<a href="mailto:m.engel@dkfz-heidelberg.de">m.engel@dkfz-heidelberg.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">









<div link="blue" vlink="purple" lang="DE">

<div>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Hi Cory,</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Thanks for the help!</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Sounds good, however there's a problem. &nbsp;As I will
have to check the occlusion from every border-voxel of the tumor, </span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">this is going to take ages because I'll have to render
everything first and then start the excessive ray-casting.</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">I had hoped that there is a way to get the renderer to tell me
whether he drew the triangle or not, respectively if he drew it completely.</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Greets Markus </span></p>

<p><span style="color: black;" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">

<p><b><span style="font-size: 10pt;" lang="EN-US">Von:</span></b><span style="font-size: 10pt;" lang="EN-US"> <a href="mailto:cquammen@gmail.com" target="_blank">cquammen@gmail.com</a>
[mailto:<a href="mailto:cquammen@gmail.com" target="_blank">cquammen@gmail.com</a>] <b>Im Auftrag von </b>Cory Quammen<br>
<b>Gesendet:</b> Dienstag, 2. Dezember </span><span style="font-size: 10pt;">2008 20:04<div><div></div><div class="Wj3C7c"><br>
<b>An:</b> Engel Markus<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Betreff:</b> Re: [vtkusers] Occlusion</div></div></span></p>

</div><div><div></div><div class="Wj3C7c">

<p>&nbsp;</p>

<p style="margin-bottom: 12pt;">Markus,<br>
<br>
It sounds like an application for a ray tracing program, but not one with a
standard camera model. Instead, you would cast rays from the tumor center out
into the organs and skin using some uniform sampling of the unit sphere. You
can mark the rays that intersect the organs and then check which of the skin
triangles intersect one or more &quot;organ&quot; rays.<br>
<br>
Alas, I don&#39;t know of any class in VTK that does this for you, but you should
be able to code something up manually quite easily. The vtkTriangle class has a
method IntersectWithLine() that should prove useful if you decide to iterate
over all triangles for all the rays you cast. For better performance, you could
use vtkCellLocator or vtkOBBTree. It also has an IntersectsWithLine() method
that gives you a list of triangles (vtkCells, really) that the line intersects.
You could have two vtkOBBTrees, one for the organs and one for the skin. If
IntersectsWithLine() called on the vtkOBBTree with the organ data returns a
non-empty list of triangles, then all the skin triangles the ray intersects are
occluded, and you can mark them as such.<br>
<br>
Good luck with your project,<br>
Cory</p>

<div>

<p>On Tue, Dec 2, 2008 at 12:02 PM, Engel Markus &lt;<a href="mailto:m.engel@dkfz-heidelberg.de" target="_blank">m.engel@dkfz-heidelberg.de</a>&gt;
wrote:</p>

<div>

<div>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Hi Cory!</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">I&#39;m sorry. I should
have described the goal in more detail. </span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">The program I&#39;m
writing is supposed to compute the optimal trajectory&nbsp; to insert a needle
to a &nbsp;tumor. This is going to be part of the planning for an operation
using percutaneous &nbsp;radiofrequency ablation.</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">When the needle has
hit the center of the tumor its tip is heated and thus burns the tumor.</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">The first step of
the program is to determine the so called 100%zones. Only in these zones I can
insert the needle safely, because otherwise I could hit a bone, vessel or
another organ.</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">That&#39;s why, as a
first step, I have to find all triangles of the skin that are totally visible,
respectively &nbsp;not occluded , when looking from the tumors &quot;point of
view&quot;.</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">After this step I&#39;d
like to have two &nbsp;lists of triangles. One containing all visible triangles
and the other containing all the occluded triangles.</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">I hope this helps
understanding my problem.</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Greets </span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Markus</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">&nbsp;</span></p>

<div style="border-style: solid none none; border-color: -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">

<p><b><span style="font-size: 10pt;">Von:</span></b><span style="font-size: 10pt;"> <a href="mailto:cquammen@gmail.com" target="_blank">cquammen@gmail.com</a>
[mailto:<a href="mailto:cquammen@gmail.com" target="_blank">cquammen@gmail.com</a>]
<b>Im Auftrag von </b>Cory Quammen<br>
<b>Gesendet:</b> Dienstag, 2. Dezember 2008 14:28<br>
<b>An:</b> Engel Markus<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Betreff:</b> Re: [vtkusers] Occlusion</span></p>

</div>

<div>

<div>

<p>&nbsp;</p>

<p style="margin-bottom: 12pt;">Hi Markus,<br>
<br>
I don&#39;t have a VTK-based solution for you based on your problem description,
but I am curious why you want to eliminate triangles of the vtkPolyData
representing the skin. What is the ultimate goal you are trying to accomplish?
Are you worried about performance? If so, you probably shouldn&#39;t. Modern GPUs
can render triangles very quickly, especially with features like early z
culling. Are you trying to eliminate them from the scene? If they are occluded
from your view point, you won&#39;t see them.<br>
<br>
Just curious,<br>
Cory</p>

<div>

<p>On Tue, Dec 2, 2008 at 7:37 AM, Engel Markus &lt;<a href="mailto:m.engel@dkfz-heidelberg.de" target="_blank">m.engel@dkfz-heidelberg.de</a>&gt;
wrote:</p>

<div>

<div>

<p><span lang="EN-US">Hi!</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p><span lang="EN-US">I&#39;m currently looking for a possibility to check whether a
certain triangle of my vtkPolyData is visible or occluded by another PolyData.</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p><span lang="EN-US">I&#39;m writing a program that eliminates triangles of the PolyData,
representing the patients skin, that are not visible from the barycenter of a
tumor, </span></p>

<p><span lang="EN-US">because they are occluded by other organs. All organs, the
tumor and the skin are vtkPolyDatas.</span></p>

<p><span lang="EN-US">So I basically need to check if there is an Object, in this
case a PolyData, between a point and a tringle.</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p><span lang="EN-US">As the program is going to be based on VTK, I&#39;m searching
for a native VTK solution. </span></p>

<p><span lang="EN-US">I already stumbled upon &nbsp;the OpenGL
&nbsp;occlusion_query, however I afraid it won&#39;t be easy to integrate this into
the existing rendering-pipeline. That&#39;s another reason for looking for some
VTK-stuff.</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p><span lang="EN-US">Thanks a lot!</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p><span lang="EN-US">Markus</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p><span style="color: black;" lang="EN-US">&nbsp;</span></p>

<p>&nbsp;</p>

</div>

</div>

<p style="margin-bottom: 12pt;"><br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><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></p>

</div>

<p><br>
<br clear="all">
<br>
-- <br>
Cory Quammen<br>
Center for Computer Integrated Systems for Microscopy and Manipulation (CISMM)<br>
Department of Computer Science<br>
University of North Carolina at Chapel Hill<br>
<a href="http://www.cs.unc.edu/%7Ecquammen" target="_blank">http://www.cs.unc.edu/~cquammen</a></p>

</div>

</div>

</div>

</div>

</div>

<p><br>
<br clear="all">
<br>
-- <br>
Cory Quammen<br>
Center for Computer Integrated Systems for Microscopy and Manipulation (CISMM)<br>
Department of Computer Science<br>
University of North Carolina at Chapel Hill<br>
<a href="http://www.cs.unc.edu/%7Ecquammen" target="_blank">http://www.cs.unc.edu/~cquammen</a></p>

</div></div></div>

</div>


</blockquote></div><br><br clear="all"><br>-- <br>Cory Quammen<br>Center for Computer Integrated Systems for Microscopy and Manipulation (CISMM)<br>Department of Computer Science<br>University of North Carolina at Chapel Hill<br>
<a href="http://www.cs.unc.edu/~cquammen">http://www.cs.unc.edu/~cquammen</a><br>