<div dir="ltr">Hi Summer,<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Cheers,</div><div> - David</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 16, 2017 at 7:23 AM, Summer Sun <span dir="ltr"><<a href="mailto:sunxiasx@foxmail.com" target="_blank">sunxiasx@foxmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a 2d vtkImageData with only two value, 0 and 255.<br>
<br>
I want to get a boundary of pixels valued 255.<br>
<br>
Currently I use vtkMarchingSquares to get the vtkPolyData but the order of<br>
points are wrong, therefore the result is shown below.<br>
<<a href="http://vtk.1045678.n5.nabble.com/file/n5742492/chaos.png" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/file/n5742492/chaos.png</a>><br>
<br>
How may I fix this ordering probem?<br>
Or is there any other way for me to get and draw the boundary on original<br>
image?<br></blockquote></div></div></div></div>