[vtkusers] vtkMarchingSquares outputs many 2-point lines

Jeremy Winston winston at cat.rpi.edu
Mon Sep 9 20:00:59 EDT 2002


VTK Congnoscenti,
     I am using vtkPolyDataWriter to output to a
file the results of vtkMarchingSquares on an image.
It works OK, but it seems that MarchingSquares 
generates a whole bunch of 2-point lines instead of
a single multi-point line for a given contour.  E.g.,

   # vtk DataFile Version 3.0
   vtk output
   ASCII
   DATASET POLYDATA
   POINTS 3 float
   ...
   LINES 2 6
   2 0 1 
   2 1 2 

instead of 

   # vtk DataFile Version 3.0
   vtk output
   ASCII
   DATASET POLYDATA
   POINTS 3 float
   ...
   LINES 1 4
   3 0 1 2

is there any way to get MarchingSquares to figure out
(via connectivity) that each of the 2-point lines is
part of a single multi-part line?  Or is there a filter
that will do this?

I can write my own code to do it, but I don't want to 
reinvent the wheel if I don't have to.

Thanks,
-Jeremy



More information about the vtkusers mailing list