[vtkusers] Delete object from vtkPolyDataConnectivityFilter(C++)

kenichiro yoshimi rccm.kyoshimi at gmail.com
Mon Jul 16 05:18:00 EDT 2018


Hi Hao,

I am sorry that I don't quite understand what you are trying to do. If
you want to get the original CellID from
vtkPolyDataConnectivityFilter, I think you first need to make a map
that stores combinations {original id:current id}:
-----
  std::map<vtkIdType, vtkIdType> idMap;
  vtkIdTypeArray *cellIdArray = vtkIdTypeArray::SafeDownCast(
    connectivityFilter->GetOutput()->GetCellData()->GetArray("ids"));
  for (vtkIdType i = 0; i < cellIdArray->GetNumberOfTuples(); ++i)
  {
    vtkIdType orgId = cellIdArray->GetTuple1(i);
    idMap[orgId] = i;
  }
-----
After that  you can also get a cell according to the original Id:
  vtkCell *cell = connectivityFilter->GetOutput()->GetCell(idMap[1000]);

Thanks
2018年7月16日(月) 15:49 hao chen <harry1994128 at gmail.com>:
>
> Hi, kenichiro yoshimi
>
> Thank you for your reply.
> But I don't know the specific method.
>
> Do you mean like this:
>
> vtkSmartPointer<vtkDICOMImageReader> DicomImageReader =
> vtkSmartPointer<vtkDICOMImageReader>::New();
> DicomImageReader->SetDirectoryName("E:\\offline_3Ddata\\2017042402");
> DicomImageReader->Update();
>
> vtkSmartPointer<vtkContourFilter> filter =
> vtkSmartPointer<vtkContourFilter>::New();
> filter->SetInputConnection(DicomImageReader->GetOutputPort());
> filter->SetValue(0, 9000);
> filter->Update();
>
> vtkSmartPointer<vtkTriangleFilter> triangleFilter =
> vtkSmartPointer<vtkTriangleFilter>::New();
> triangleFilter->SetInputConnection(filter->GetOutputPort());
> triangleFilter->Update();
>
> *  vtkSmartPointer<vtkIdFilter> idFilter =
> vtkSmartPointer<vtkIdFilter>::New();
>   idFilter->SetInputConnection(sphereSource->GetOutputPort());
>   idFilter->SetIdsArrayName("ids");
>   idFilter->Update();*
>
> vtkSmartPointer<vtkPolyDataConnectivityFilter> connectivityFilter =
> vtkSmartPointer<vtkPolyDataConnectivityFilter>::New();
> connectivityFilter->SetInput(*idFilter*->GetOutput());
> connectivityFilter->SetExtractionModeToCellSeededRegions();
> connectivityFilter->AddSeed(1000);
> connectivityFilter->Update();
>
> ----------------------------------------------------------------------------------------------------------------------
> By the way, I didn't realize that I don't know how to get the CellID from
> vtkPolyDataConnectivityFilter.
> I use 'GetCellNeighbors' to get CellId, but if I use in circled object(too
> large), it will work very slowly.
> So I found vtkPolyDataConnectivityFilter method, want to find out the CellId
> directly.
> Can you show me the specific method?
>
> Sorry my poor english.
> Thank you~
>
> Hao
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> 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:
> https://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list