[vtkusers] How to extract vtkPolyData for each regions in vtkPolyDataConnectivyFilter?

David Doria daviddoria+vtk at gmail.com
Fri Apr 9 18:10:18 EDT 2010


2010/4/1 Andrej Gluhov <realandron at gmail.com>:
> I found several similar questions, but their problem to solve can not.
>
>             vtkDICOMImageReader DicomReader = new vtkDICOMImageReader();
>             DicomReader.SetFileName(m_strFilePath);
>             DicomReader.Update();
>
>             m_ContourFilter.SetInputConnection(DicomReader.GetOutputPort());
>             m_ContourFilter.SetValue(0, -250);
>             m_ContourFilter.Update();
>
>
> m_ConnectivityFilter.SetInputConnection(m_ContourFilter.GetOutputPort());
>             m_ConnectivityFilter.ScalarConnectivityOn();
>             m_ConnectivityFilter.SetExtractionModeToSpecifiedRegions();
>             m_ConnectivityFilter.Update();
>             int regions =
> m_ConnectivityFilter.GetNumberOfExtractedRegions();
>             for (int i = 0; i < regions; i++)
>             {
>                 m_ConnectivityFilter.AddSpecifiedRegion(i);
>                 m_ConnectivityFilter.Update();
>                 vtkPolyData PD = m_ConnectivityFilter.GetOutput();//here I
> was hoping to see vtkPolyData for I-st region, but returned vtkPolyData of
> m_contourfilter
>             }
>
> --
> С Уважением,
> Андрей.
> Best regards, Andrew

It should work as you expect - here is an examle:

http://www.vtk.org/Wiki/VTK/Examples/vtkPolyDataConnectivityFilter_SpecifiedRegion

Thanks,

David



More information about the vtkusers mailing list