<div dir="ltr">Have you tried adjusting the Tolerance on vtkPolyDataToImageStencil?<div>You can try setting it to a large value like 0.5, which gives half a pixel</div><div>in tolerance.  That should guarantee that the contour is fully inside of</div>

<div>the result.</div><div><br></div><div>  David<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 2, 2014 at 2:46 PM, Bryan Cool <span dir="ltr"><<a href="mailto:bryan@radialogica.com" target="_blank">bryan@radialogica.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks for the quick reply, David.  You’re right: I’m in need of inclusivity on both ends.  I’m voxelizing contours using vtkPolyDataToImageStencil and I want to ensure that the resulting stencil fully encapsulates the contours.  Are there any tricks to compensate that wouldn’t require me to modify my points directly?  I guess I could just dilate my result, but it would be nice to have it as tight around the contours as possible.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Bryan<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>

<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> David Gobbi [mailto:<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>] <br>

<b>Sent:</b> Wednesday, July 2, 2014 2:50 PM<br><b>To:</b> Bryan Cool<br><b>Cc:</b> VTK Users<br><b>Subject:</b> Re: [vtkusers] Inclusiveness of Rasterization<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal">

<u></u> <u></u></p><div><p class="MsoNormal">Hi Bryan,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Do you mean inclusive on both ends?  Exclusive on both ends would<u></u><u></u></p>

</div><div><p class="MsoNormal">just make it worse...<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">The behavior of the rasterization is 100% intentional.  In order for<u></u><u></u></p>

</div><div><p class="MsoNormal">rasterization to work when there are adjacent areas that are being<u></u><u></u></p></div><div><p class="MsoNormal">rasterized, it must be exclusive on one end and inclusive on the<u></u><u></u></p>

</div><div><p class="MsoNormal">other end.  Otherwise, adjacent areas could end up with either a<u></u><u></u></p></div><div><p class="MsoNormal">gap between them or with an overlap.<u></u><u></u></p></div><div><p class="MsoNormal">

<u></u> <u></u></p></div><div><p class="MsoNormal">The exclusitivity can be compensated for by subtracting a small<u></u><u></u></p></div><div><p class="MsoNormal">tolerance at the lower end or by using other tricks.<u></u><u></u></p>

</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">What is your use case?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">  - David<u></u><u></u></p>

</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Jul 2, 2014 at 1:18 PM, Bryan Cool <<a href="mailto:bryan@radialogica.com" target="_blank">bryan@radialogica.com</a>> wrote:<u></u><u></u></p>

<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><p class="MsoNormal">Hi everyone,<br><br>I noticed that vtkImageStencilRaster has code like the following in<br>

InsertLine and FillStencilData, for both the x and y directions:<br><br>if (x1 >= xmin)<br>     {<br>     r1 = vtkMath::Floor(x1) + 1;<br>     }<br>if (x2 < xmax)<br>     {<br>     r2 = vtkMath::Floor(x2);<br>     }<br>

<br>Correct me if I'm wrong, but it looks like the lower side is exclusive,<br>while the upper end is inclusive.  The upshot of this is that the only way<br>to stencil the first pixel is to have a line intersect the row on the<br>

negative side of the first pixel (in the extents).  On the other hand, to<br>stencil the last pixel a line only need intersect anywhere past the<br>second-to-last pixel (in the extents).<br><br>Assuming that's true, it seems a bit asymmetric.  Is there any way to have<br>

exclusive behavior on both ends?<br><br>Thanks,<br>Bryan<u></u><u></u></p></blockquote></div></div></div></div></div></div></div></blockquote></div><br></div></div></div>