# Is it possible to Mantain the Scalar Data After Decimation?

**URL:** <https://discourse.vtk.org/t/is-it-possible-to-mantain-the-scalar-data-after-decimation/13409>\
**Category:** Development\
**Created:** [February 28, 2024, 10:35pm UTC](https://discourse.vtk.org/t/is-it-possible-to-mantain-the-scalar-data-after-decimation/13409 "2024-02-28T22:35:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Scatena](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rafael_scatena/32/7820_2.png) [@Rafael\_Scatena](https://discourse.vtk.org/u/Rafael_Scatena)\
**Post date:** [February 28, 2024, 10:35pm UTC](https://discourse.vtk.org/t/is-it-possible-to-mantain-the-scalar-data-after-decimation/13409/1 "2024-02-28T22:35:32Z")

</div>

Hello,

After the decimation process are all the scalar information of cells and points lost?

Thank you,

````
```
vtkSmartPointer<vtkDecimatePro> decimator = vtkSmartPointer<vtkDecimatePro>::New();
decimator->SetInputData(inputPolyData);
decimator->SetFeatureAngle(featureAngle);
decimator->PreserveTopologyOn(); // Preserve topology, including scalars
decimator->Update();

vtkSmartPointer<vtkPolyData> decimated = vtkSmartPointer<vtkPolyData>::New();
decimated->ShallowCopy(decimator->GetOutput());

// Now, transfer the scalars from the original dataset to the decimated dataset
decimated->GetPointData()->AddArray(inputPolyData->GetPointData()->GetScalars());
decimated->GetCellData()->AddArray(inputPolyData->GetCellData()->GetScalars());
```

````
