I've never used <span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">vtkTransformPolyDataFilter, how would I use that filter in my situation?</span><br><br>
<div class="gmail_quote">On Thu, Feb 24, 2011 at 9:17 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Jonathan,<br>
<br>
I still recommend that you add a vtkTransformPolyDataFilter like in the<br>
ImageTracerWidget example. Right now your image slice is right on the<br>
top edge of the extruded contour, so the smallest amount of roundoff error<br>
might cause it to miss. By shifting the extruded contour up by half a voxel,<br>
you can preemptively guard against such errors.<br>
<font color="#888888"><br>
- David<br>
</font><div><div></div><div class="h5"><br>
<br>
On Thu, Feb 24, 2011 at 10:09 AM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>> wrote:<br>
> Actually, after setting the marching squares value to 0.5 and changing the<br>
> linear extrusion filter it's working now. Thanks!!!<br>
><br>
> On Thu, Feb 24, 2011 at 9:02 AM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Also, the stencil algorithm and marching squares use different<br>
>> criteria to determine whether a "pixel" is inside or outside.<br>
>><br>
>> For the stencil, the pixel is considered a point and checked within a<br>
>> tolerance for inside/outside. I'm guessing here).<br>
>> For marching squares, a "square" is composed of four pixels. If at<br>
>> least one of the four pixels is of the opposite state(inside/outside)<br>
>> then a contour will be generated.<br>
>><br>
>> On Thu, Feb 24, 2011 at 11:53 AM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
>> wrote:<br>
>> > Definitely set the isovalue to .5 if you have binary 0/1 images.<br>
>> ><br>
>> > On Wed, Feb 23, 2011 at 2:59 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
>> > wrote:<br>
>> >> I've never used marching squares, but I have a guess as<br>
>> >> to what the problem might be. If your binary image has<br>
>> >> values "0" and "1" then you should contour it at "0.5".<br>
>> >><br>
>> >> - David<br>
>> >><br>
>> >><br>
>> >> On Wed, Feb 23, 2011 at 12:27 PM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>><br>
>> >> wrote:<br>
>> >>> If that's the case, then maybe I could have issues on the other side<br>
>> >>> (converting binary images to contours, I do both). For this I'm using<br>
>> >>> vtkMarchingSquares followed by vtkStripper<br>
>> >>> int[] extent = binaryOrgan.GetExtent();<br>
>> >>> switch (orientation) {<br>
>> >>> case OrthoPanel.ORIENTATION_XY:<br>
>> >>> extent[4] = slice;<br>
>> >>> extent[5] = slice;<br>
>> >>> break;<br>
>> >>> case OrthoPanel.ORIENTATION_XZ:<br>
>> >>> extent[2] = slice;<br>
>> >>> extent[3] = slice;<br>
>> >>> break;<br>
>> >>> case OrthoPanel.ORIENTATION_YZ:<br>
>> >>> extent[0] = slice;<br>
>> >>> extent[1] = slice;<br>
>> >>> break;<br>
>> >>> }<br>
>> >>> vtkMarchingSquares marching = new vtkMarchingSquares();<br>
>> >>> marching.SetInput(binaryOrgan);<br>
>> >>> marching.SetImageRange(extent);<br>
>> >>> marching.SetValue(0, 1);<br>
>> >>> marching.Update();<br>
>> >>> vtkPolyData marchingOutput = marching.GetOutput();<br>
>> >>> vtkStripper stripper = new vtkStripper();<br>
>> >>> stripper.SetInput(marchingOutput);<br>
>> >>> stripper.Update();<br>
>> >>> Does anything look like it could be causing my issues there?<br>
>> >>> On Wed, Feb 23, 2011 at 11:18 AM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
>> >>> wrote:<br>
>> >>>><br>
>> >>>> The value "1e-6" is a common tolerance because it is larger than<br>
>> >>>> most roundoff errors that are likely to occur in the calculations,<br>
>> >>>> but still small enough that it won't appreciably increase size of the<br>
>> >>>> region.<br>
>> >>>><br>
>> >>>> Setting the tolerance to zero does exactly what you noted. If the<br>
>> >>>> pixel is exactly on the edge, then it is considered to be inside if<br>
>> >>>> the<br>
>> >>>> edge is a leading edge, or outside if the edge is a trailing edge.<br>
>> >>>> This is done so that if you have two contours which are adjacent<br>
>> >>>> (i.e. share an edge), the edge voxels will be considered to be in<br>
>> >>>> just one of the two contours instead of in both. If the tolerance is<br>
>> >>>> set larger than zero, then the edge pixels would always be considered<br>
>> >>>> to be in both contours.<br>
>> >>>><br>
>> >>>> If you are dealing with rectangular contours, then the contour<br>
>> >>>> lines should be made so that they lie halfway between pixels, instead<br>
>> >>>> of lying directly on top of the pixels. Then there is no uncertainty<br>
>> >>>> about whether a pixel lies inside or outside.<br>
>> >>>><br>
>> >>>> - David<br>
>> >>>><br>
>> >>>><br>
>> >>>> On Wed, Feb 23, 2011 at 11:58 AM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>><br>
>> >>>> wrote:<br>
>> >>>> > I had the tolerance set to 0, and setting it to 1e-6 didn't fix the<br>
>> >>>> > problem.<br>
>> >>>> > How did you come up with that number? What's wrong with setting<br>
>> >>>> > it to<br>
>> >>>> > 0?<br>
>> >>>> > In my case usually the left and top side of the vtkImageData is<br>
>> >>>> > being<br>
>> >>>> > eroded, such that if I call the filter many times, the vtkImageData<br>
>> >>>> > will<br>
>> >>>> > eventually be blank because it will all be eroded. However,<br>
>> >>>> > sometimes<br>
>> >>>> > the<br>
>> >>>> > bottom and right grow in size, I haven't figured out which<br>
>> >>>> > situations<br>
>> >>>> > cause<br>
>> >>>> > which.<br>
>> >>>> ><br>
>> >>>> > On Wed, Feb 23, 2011 at 10:54 AM, David Gobbi<br>
>> >>>> > <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
>> >>>> > wrote:<br>
>> >>>> >><br>
>> >>>> >> Hi Jonathan,<br>
>> >>>> >><br>
>> >>>> >> Whether a pixel is set depends on whether the center of the pixel<br>
>> >>>> >> is inside or outside the contour, irregardless of what proportion<br>
>> >>>> >> of<br>
>> >>>> >> the pixel's volume is inside or outside.<br>
>> >>>> >><br>
>> >>>> >> The only adjustment is the Tolerance, which should be set to<br>
>> >>>> >> around 1e-6 so that pixels right on the edge of the contour<br>
>> >>>> >> are considered to be inside. The tolerance cannot be negative.<br>
>> >>>> >><br>
>> >>>> >> - David<br>
>> >>>> >><br>
>> >>>> >><br>
>> >>>> >> On Wed, Feb 23, 2011 at 11:22 AM, Jonathan Morra<br>
>> >>>> >> <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>><br>
>> >>>> >> wrote:<br>
>> >>>> >> > I am currently using vtkPolyDataToImageStencil to successfully<br>
>> >>>> >> > convert<br>
>> >>>> >> > contours represented as vtkPolyData to binary vtkImageData's.<br>
>> >>>> >> > However,<br>
>> >>>> >> > I'm<br>
>> >>>> >> > noticing a problem with the output sometimes. Sometimes the<br>
>> >>>> >> > resulting<br>
>> >>>> >> > binary images are slightly smaller or slightly bigger than the<br>
>> >>>> >> > poly<br>
>> >>>> >> > data<br>
>> >>>> >> > they were made from. I assume this is the result of partial<br>
>> >>>> >> > volume<br>
>> >>>> >> > effects.<br>
>> >>>> >> > I would like to know 2 things<br>
>> >>>> >> > 1. How does vtkPolyDataToImageStencil handle partial volume.<br>
>> >>>> >> > 2. Is there a way to tune partial volume in<br>
>> >>>> >> > vtkPolyDataToImageStencil?<br>
>> >>>> >> > For<br>
>> >>>> >> > instance, a parameter which says if the contour includes less<br>
>> >>>> >> > than x<br>
>> >>>> >> > percentage of the pixel then that pixel is 0.<br>
>> >>>> >> > Thanks,<br>
>> >>>> >> > Jon<br>
>> >>>> >> > PS If my assumption about partial volume effects is wrong,<br>
>> >>>> >> > please let<br>
>> >>>> >> > me<br>
>> >>>> >> > know.<br>
>> >>>> >> > _______________________________________________<br>
>> >>>> >> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >>>> >> ><br>
>> >>>> >> > Visit other Kitware open-source projects at<br>
>> >>>> >> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >>>> >> ><br>
>> >>>> >> > Please keep messages on-topic and check the VTK FAQ at:<br>
>> >>>> >> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> >>>> >> ><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><br>
>> >>>> >> ><br>
>> >>>> >> ><br>
>> >>>> ><br>
>> >>>> ><br>
>> >>><br>
>> >>><br>
>> >> _______________________________________________<br>
>> >> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >><br>
>> >> Visit other Kitware open-source projects at<br>
>> >> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >><br>
>> >> Please keep messages on-topic and check the VTK FAQ at:<br>
>> >> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> >><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><br>
>> >><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>