[vtkusers] Re: converting output of vtkContourFilter from line segments to closed loop polyline

Goodwin Lawlor goodwin.lawlor at ucd.ie
Fri Jun 23 09:48:50 EDT 2006


Marc Cotran wrote:
> David C Thompson wrote:
>> On Thu, 2006-06-22 at 15:30 -0600, Richard Strelitz wrote:
>>  
>>> I want to use contours (and isosurfaces) as discrete objects.  For 
>>> example, while vtkContourFilter generates a multitude of 2-point line 
>>> segment cells, I want to string together those pieces belonging to 
>>> the same contour to be shown as an N-point polyline.  Absent special 
>>> cases (hitting the boundary, duplicate points, etc.) the problem is 
>>> straightforward.  ...
>>> Is there a method or class that I have overlooked?  Wouldn't this be 
>>> a nice thing to have?
>>> Suggestions, comments, hints and even flames, welcome.
>>>     
>>
>> Hint: VTK/Graphics/vtkStripper does what you want. Note that it won't
>> create polylines with more than 100,000 segments (by fiat).
>>
>>     David
> I tried this once using vtkStripper and found that it often gave 
> multiple strips for polylines that could be described as a single strip. 
> I also found that sometimes a strip went in one direction, while a 
> connecting strip went the other. I tried cleaning the points first, 
> which helped a little, but I ended up getting frustrated and giving up.
> 
> For my project, I was *not* starting with the output of a 
> vtkContourFilter, but rather the output of a vtkCutter (cutting through 
> a polydata mesh with an implicit plane). While I assume the results 
> would be the same, you may have more luck with vtkContourFilter. If not, 
> I fear you may have to implement the algo you proposed.
> 
> Marc

Hi,

There has been a patch to correct this problem with vtkStripper in the 
bug tracker for two years now ( 
http://public.kitware.com/Bug/bug.php?op=show&bugid=832 ). I've been 
using it with out a problem since then... Thanks to Carl Hetherington ( 
http://vtk.org/pipermail/vtkusers/2002-January/009372.html )

Basically, the patch provides a second pass over the polylines outputs 
created in the first stripping pass and connects them if possible. Maybe 
two vtkStripper objects in series would work too (never tried this).

I recently requested that this patch be applied to the vtk source and 
Mathieu bumped up the bug priority to "high"

You can vote to resolve the bug on the page above...

Goodwin




More information about the vtkusers mailing list