[vtkusers] Ordering wrong when convert vtkImageData to vtkPolyData

David Gobbi david.gobbi at gmail.com
Fri Mar 17 02:56:58 EDT 2017


Hi Summer,

For the contour widget, you will probably have to create a new vtkPoints
object where the points have the ordering specified by the the cell array
returned by stripper->GetLines().  The vtkStripper doesn't put the points
in order, it just provides a cell array that specifies how to put the
points in order.

 - David

On Fri, Mar 17, 2017 at 12:48 AM, Summer Sun <sunxiasx at foxmail.com> wrote:

> Thank you David,
> But I use code below, the render result still doesn't change.
>
> ...
> // 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();
>
> *// set points and lines according to stripper output*
> vtkSmartPointer<vtkPolyData> segPoly = vtkSmartPointer<vtkPolyData>::
> New();
> segPoly->SetPoints(segContour->GetOutput()->GetPoints());
> segPoly->SetLines(segPolyStripper->GetOutput()->GetLines());
>
> // draw the contour
> contourWidget->Initialize(segPoly);
> ...
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.
> com/Ordering-wrong-when-convert-vtkImageData-to-
> vtkPolyData-tp5742492p5742504.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170317/fce61b57/attachment.html>


More information about the vtkusers mailing list