On 3/27/08, <b class="gmail_sendername">kent williams</b> <<a href="mailto:nkwmailinglists@gmail.com">nkwmailinglists@gmail.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Here's what I want:<br> <br> Input: Image where pixel == 0 is outside mask pixel != 0 is inside mask<br> Output: Polygon/Polyline outline of all regions of nonzero pixels in image.<br> <br> Reason: My program uses vtkContourWidget to trace anatomical features.<br>
</blockquote><div><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I've written what I think should work, below, but it looks really,<br>
 really wrong when I load it -- it seems to be some woven agglomeration<br> of many too many conour outlines.</blockquote><div><br>I agree with Bill. I glanced at the code and I don't see a vtkStripper in there. You need something that will massage the output of vtkContourFilter or vtkMarchingSquares. The contour filters will generate a bunch of un-ordered line segments.<br>
<br>vtkStripper should do the job for you (ie. generate one or more polylines (with an ordered set of vertices)). You can then reduce the number of points in this output (using the curvature based polyline subsampling code that you seem to have below).<br>
<br>Your pipeline should look like<br> <br>  vtkMarchingSquares -> vtkStripper -> SubsamplePolyline -> vtkContourWidget.<br></div></div>