[vtkusers] Ordering wrong when convert vtkImageData to vtkPolyData
David Gobbi
david.gobbi at gmail.com
Thu Mar 16 09:32:10 EDT 2017
Hi Summer,
The output of vtkMarchingSquares is a set of line segments. If you call
GetLines() on the output, you get a vtkCellArray that contains the line
segments. However, the line segments are not in order.
To put the line segments in order, try using vtkStripper. The vtkStripper
takes line segments as input, and produces a polyline as output. So if you
call GetLines() on the output of vtkStripper, then the vtkCellArray should
index the points in the correct order.
Cheers,
- David
On Thu, Mar 16, 2017 at 7:23 AM, Summer Sun <sunxiasx at foxmail.com> wrote:
> I have a 2d vtkImageData with only two value, 0 and 255.
>
> I want to get a boundary of pixels valued 255.
>
> Currently I use vtkMarchingSquares to get the vtkPolyData but the order of
> points are wrong, therefore the result is shown below.
> <http://vtk.1045678.n5.nabble.com/file/n5742492/chaos.png>
>
> How may I fix this ordering probem?
> Or is there any other way for me to get and draw the boundary on original
> image?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170316/f6014926/attachment.html>
More information about the vtkusers
mailing list