[vtkusers] Ordering wrong when convert vtkImageData to vtkPolyData

David Gobbi david.gobbi at gmail.com
Fri Mar 17 02:25:11 EDT 2017


Hi Summer,

You need to call GetLines() on the output of the vtkStripper, because that
will return the vtkCellArray that gives the correct ordering of the
points.  The vtkCellArray will provide the point Ids in the correct order.

 - David


On Thu, Mar 16, 2017 at 11:13 PM, Summer Sun <sunxiasx at foxmail.com> wrote:

> Thank you so much David,
>
> I have tried your method but the result I use vtkStripper is exactly the
> *same*...
> I saw the vtk documents below that might be help but I don't quite get it:
> ---
> *Warning*
> If triangle strips or poly-lines exist in the input data they *will be
> passed through to the output data*. This filter will only construct
> triangle
> strips if triangle polygons are available; and will only construct
> poly-lines if lines are available.
> ---
>
> *Here's my related code:*
> ...
> /// get marching squares of image data/
> vtkSmartPointer<vtkMarchingSquares> segContour =
> vtkSmartPointer<vtkMarchingSquares>::New();
> segContour->SetInputData(segmentation); /// segmentation is my image data/
> segContour->SetValue(0, 255);
> segContour->Update();
>
> /// use vtkStripper to process marching squares data/
> vtkSmartPointer<vtkStripper> segPolyStripper =
> vtkSmartPointer<vtkStripper>::New();
> segPolyStripper->SetInputData(segContour->GetOutput());
> segPolyStripper->Update();
>
> /// draw the contour/
> contourWidget->Initialize(segPolyStripper->GetOutput());
> ...
>
> Thanks for your help
> Summer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170317/6f4d5247/attachment.html>


More information about the vtkusers mailing list