Discussion:
[vtkusers] vtkQuadricDecimation does not propagate Pedigree IDs to output
Mikhail SAZONOV
2018-11-20 09:52:20 UTC
Permalink
Hello,

I am wondering if there is possibility to propagate Pedigree IDs of cells from input of vtkQuadricDecimation to its output. I was tried many ways, with and without pipelines. Every time the array of pedigree ids is a null pointer.

<pre>
vtkSmartPointer<vtkPolyData> aPolyData = vtkSmartPointer<vtkPolyData>::New ();
vtkSmartPointer<vtkPoints> aVertData = vtkSmartPointer<vtkPoints>::New ();
aPolyData->SetPoints (aVertData);
...
vtkSmartPointer<vtkIdFilter> aIdFilter = vtkIdFilter::New ();
aIdFilter->SetInputData (aPolyData);
aIdFilter->SetFieldData (1);
aIdFilter->SetPointIds (0);
aIdFilter->SetCellIds (1);
aIdFilter->SetIdsArrayName ("id");

vtkSmartPointer<vtkQuadricDecimation> anAlgo = vtkSmartPointer<vtkQuadricDecimation>::New();
anAlgo->SetInputConnection (aIdFilter->GetOutputPort ());
anAlgo->SetTargetReduction (theTargetRatio);
anAlgo->Update ();

auto* aNewPolyData = anAlgo->GetOutput();
vtkIntArray* aNewPedIds = static_cast<vtkIntArray*>(aNewPolyData->GetCellData()->GetPedigreeIds());
</pre>

aNewPedIds is null.

Thanks in advance.
Best regards,
Mikhail
Mikhail SAZONOV
2018-11-20 10:02:01 UTC
Permalink
Hello,

I am wondering if there is possibility to propagate Pedigree IDs of cells from input of vtkQuadricDecimation to its output. I was tried many ways, with and without pipelines. Every time the array of pedigree ids is a null pointer.

<pre>
vtkSmartPointer<vtkPolyData> aPolyData = vtkSmartPointer<vtkPolyData>::New ();
vtkSmartPointer<vtkPoints> aVertData = vtkSmartPointer<vtkPoints>::New ();
aPolyData->SetPoints (aVertData);
...
vtkSmartPointer<vtkIdFilter> aIdFilter = vtkIdFilter::New ();
aIdFilter->SetInputData (aPolyData);
aIdFilter->SetFieldData (1);
aIdFilter->SetPointIds (0);
aIdFilter->SetCellIds (1);
aIdFilter->SetIdsArrayName ("id");

vtkSmartPointer<vtkQuadricDecimation> anAlgo = vtkSmartPointer<vtkQuadricDecimation>::New();
anAlgo->SetInputConnection (aIdFilter->GetOutputPort ());
anAlgo->SetTargetReduction (theTargetRatio);
anAlgo->Update ();

auto* aNewPolyData = anAlgo->GetOutput();
vtkIntArray* aNewPedIds = static_cast<vtkIntArray*>(aNewPolyData->GetCellData()->GetPedigreeIds());
</pre>

aNewPedIds is null.

Thanks in advance.
Best regards,
Mikhail

Loading...