[vtkusers] Issue; Number of Regions are equal to the number of Polys
C P
cp.vtk.user at googlemail.com
Tue Mar 7 05:28:19 EST 2017
Dear vtk users,
I have a similar problem: how can I get *each* connected component as a
separate vtkPolyData object? Is there something like a GetRegion(k) method
that gives me the k-th connected component? There is only
AddSpecifiedRegion() but when I use it and then call GetOutput() the result
is always the same no matter what id I have passed to AddSpecifiedRegion().
All official kitware examples on the web are about the largest connected
component. But how to get all of them? I cannot believe that this is so
difficult to find out based on the documentation... After all, this is the
very basic functionality of this filter, isn't it?
Thank you.
On Tue, Jan 3, 2017 at 4:30 PM, David E DeMarle <dave.demarle at kitware.com>
wrote:
> Apply vtkCleanPolyData first. The triangles in that data have points that
> are coincindent, but none are actually shared across neighboring edges.
> Clean will merge the coicident points for you.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909 <(518)%20881-4909>
>
> On Tue, Jan 3, 2017 at 10:22 AM, Mohammadreza Babaee <
> mrezababaee at gmail.com> wrote:
>
>> Hi
>>
>>
>> I have a vtp file that contains a polydata. I want to extract its
>> connected component. However, when I use* vtkPolyDataConnectivityFilter**,
>> *and read the number of regions, it shows that the it is equal to the
>> number of polys. But when I visualize the file I see that there are
>> actually 4 regions.
>>
>> I use SetExtractionModeToAllRegions to read the number of regions.
>> I have attached the file. Can you please help me to understand what the
>> problem is
>>
>> So here is my code
>>
>> vtkSmartPointer<vtkPolyDataConnectivityFilter> connectivityFilter =
>> vtkSmartPointer<vtkPolyDataConnectivityFilter>::New();
>> connectivityFilter->SetInputData(poly_in);
>> connectivityFilter->ScalarConnectivityOn();
>>
>> connectivityFilter->SetExtractionModeToAllRegions();
>>
>> connectivityFilter->Update();
>> int nbregions = connectivityFilter->GetNumberOfExtractedRegions();
>>
>> cout << "Number of Extracted Regions are=" << nbregions << endl;
>>
>> Thanks
>>
>> _______________________________________________
>> 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
>>
>>
>
> _______________________________________________
> 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/20170307/1bd96dcf/attachment.html>
More information about the vtkusers
mailing list