Kent:<br><br>Sorry for the long overdue reply.  Yes there is a way to do this. <br><br>The method you're looking for is <br><br>  vtkContourWidget::Initialize( polydata_containing_contour_control_points, StartingWidgetState )
<br><br>What this does is to take a vtkPolyData (that contains 2 or more points and just one cell) and populate a contour from it. <br><br>StartingWidgetState as the documentation states can be vtkContourWidget::Define or vtkContourWidget::Manipulate. The former will let you go about adding new points. The latter puts it into manipulate state, (the same state you have on a vtkContourWidget, after you add the last point or close the loop).
<br><br>----------<br>Now for the caveat:<br><br>I had a similar situation a while ago where I needed to go from a binary representation to a parametric representation, for editing purposes. <br>If you run a vtkContourFilter and get a polydata out, you will have a polydata with several cells. You'll need to extract out each of those cells into seperate vtkPolydata. Take one of these cells. It will contain several points. If you initialize a contour widget from it, it will work, but it will have a few hundred control points and that doesn't look pretty. You can try it out :)
<br><br>What you need is a downsampler, that picks every nth point, or better still a smart one that picks the ones that lie on high curvature.<br>----------<br><br>I just added a test that demonstrates initializing a contour widget
from a user-supplied polydata. (a closed circle in this case). <br>
<br>Please let us know if you have issues.<br><br>--<br>Karthik Krishnan<br>R&D Engineer,<br>Kitware Inc.<br><br>
<br><div><span class="gmail_quote">On 1/9/08, <b class="gmail_sendername">kent williams</b> <<a href="mailto:nkwmailinglists@gmail.com">nkwmailinglists@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I posted this to VTKUsers and got no suggestions.  Anyone here want to comment?<br><br>I need to go from a binary image, representing a 3D mask, to a set of<br>outlines on each slice of the binary image.<br><br>It seems like something like this would work:
<br><br>Use vtkImageReslice to extract 2D slices from the 3D volume<br>For each slice, use vtkContourFilter to extract contours around areas<br>of set pixels.<br><br>Right now I have a tracer that uses one or more vtkContourWidgets to
<br>interactively generate a set of contours defining a mask.  I just<br>finished code that iterates through the contour set a slice at a time,<br>and generates a binary image volume where a non-zero pixel value is<br>inside the mask, and zero pixel value is outside the mask.  What I
<br>want to do is reverse this process -- given a binary image, generate<br>the countour set.<br><br>It looks like I should maybe use GenerateValues to generate contours,<br>but I don't understand the relationship between the output data of
<br>vtkContour filter and the data i would need to initialize a<br>vtkContourWidget.  The few examples extant don't make that clear to me<br>either.<br><br>Thanks!<br>_______________________________________________<br>
vtk-developers mailing list<br><a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a><br><a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br></blockquote>
</div>