<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">In general, vtkCutter returns a random (unordered, non-continuous) list of line segments.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Can vtkContourTriangulator deal with that (merge points and order line segments to form closed contours)?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Usually we apply vtkStripper with a very large MaximumLength on vtkCutter output to create polygons that can be triangulated and rendered. This works well almost every time, but in some cases (cutting very complex geometries with hundreds
 of thousand of points) stripping does not find closed polygons. It would be nice to have a somewhat simpler and more robust solution.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Andras<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> vtkusers <vtkusers-bounces@vtk.org> <b>On Behalf Of
</b>David Gobbi<br>
<b>Sent:</b> Friday, January 11, 2019 11:38 AM<br>
<b>To:</b> The Merper <msmerps@gmail.com>; VTK Users <vtkusers@vtk.org><br>
<b>Subject:</b> Re: [vtkusers] filling in a sphere's intersection with a plane<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">If you already have the spheres as polydata, and if they are already in your volume coord system, then the simplest approach is probably to use these two filters:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- vtkCutter, to cut the sphere (this generates a polyline contour of the intersection)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- vtkContourTriangulator to fill the polyline contour with triangles<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">When rendering the result on the image, the polydata and your image slice will be coincident in the z-buffer.  It might be possible to fix this by calling SetResolveCoincidentTopologyToPolygonOffset() on the polydata mapper.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Rendering the filled spheres with voxels would be more complicated.  The vtkPolyDataToImageStencil class works volumetrically, i.e. it would be used to fill the entire sphere and produce a binary volume.  Then the desired slice of that
 volume would be rendered as an overlay.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">   David<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Fri, Jan 11, 2019 at 8:02 AM The Merper <<a href="mailto:msmerps@gmail.com">msmerps@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Thanks for the speedy reply, David.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The application is a GUI that allows users to mark points in a 3D MRI volume. The user browses the volume and marks the points in 2D slices of the volume, which are rendered via a vtkImageViewer2. Once a point is marked, I represent the
 location with a sphere. I use vtkSphereSource via vtkPolyDataMapper to render the spheres.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I'd be happy using polygons or voxels.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">   thanks again,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">      -Merps<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Thu, Jan 10, 2019 at 5:08 PM David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">On Thu, Jan 10, 2019 at 12:13 PM The Merper <<a href="mailto:msmerps@gmail.com" target="_blank">msmerps@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">  I have a set of spheres in a volume that I visualize in 2D slices. When the plane of a 2D slice intersects a sphere, I want the interior of the sphere to be filled.<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">How are the spheres defined?  Do you already have them as vtkPolyData objects, or do you just have a list of "center and radius" values to describe the spheres?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">When you say "visualize in 2D slices" do you mean that you are already visualizing slices of something (e.g. of an image) and you want to display the sphere cuts as an overlay on the image?  For your application, does it matter whether
 the sphere cuts are displayed as voxels (i.e. a vtkImageData) vs polygons?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Also, for context, what is the general purpose of your application?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  David<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>