[vtkusers] Extracting cells from vtkImageData

majinsaha saiya-jin at yandex.ru
Thu Mar 30 17:38:55 EDT 2017


Thanks.
The following seems to be producing no errors:


                vtkSmartPointer<vtkImageDataGeometryFilter>
imageDataGeometryFilter =
                        vtkSmartPointer<vtkImageDataGeometryFilter>::New();
                imageDataGeometryFilter->SetInputData(myImageData);
                imageDataGeometryFilter->Update();

                vtkSmartPointer<vtkExtractSelectedPolyDataIds>
extractSelection =   vtkSmartPointer<vtkExtractSelectedPolyDataIds>::New();

                extractSelection->SetInputData(0,
imageDataGeometryFilter->GetOutput());
                extractSelection->SetInputData(1, selection);

                extractSelection->Update();


However, this only gives what I want if my vtkImageData is plane, i.e. has
no third dimension. For a general 3D vtkImageData, the result of the
geometry filter is just a bunch of vertices. I checked that with 

                std::cout<<
extractSelection->GetOutput()->GetNumberOfVerts()<<std::endl;
                std::cout<<
extractSelection->GetOutput()->GetNumberOfLines()<<std::endl;
                std::cout<<
extractSelection->GetOutput()->GetNumberOfPolys()<<std::endl;
                std::cout<<
extractSelection->GetOutput()->GetNumberOfStrips()<<std::endl;
</h3>
and the output was that only the first out of four was non-zero. It just
ignores everything except vertices while doing the conversion in 3D.
Is there currently a working strategy in VTK to convert 3D vtkImageData to
vtkPolyData by keeping track of quad cells, for example?



--
View this message in context: http://vtk.1045678.n5.nabble.com/Extracting-cells-from-vtkImageData-tp5742666p5742683.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list