# Resampling using cell data?

**URL:** <https://discourse.paraview.org/t/resampling-using-cell-data/7238>\
**Category:** ParaView Support\
**Tags:** vtk\
**Created:** [May 16, 2021, 3:45pm UTC](https://discourse.paraview.org/t/resampling-using-cell-data/7238 "2021-05-16T15:45:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)\
**Post date:** [May 17, 2021, 9:24pm UTC](https://discourse.paraview.org/t/resampling-using-cell-data/7238/2 "2021-05-17T21:24:14Z")

</div>

To be clear, what you mean is that when you run `Resample To Image`, the cell data does get resampled, but it gets resampled to points in the resulting grid that get inappropriately interpolated, right? If so, this is an issue that has [recently come up in another question](https://discourse.paraview.org/t/difference-of-or-selection-on-mostly-identical-grids/7062/4?). There is a trick you can do with a sequence of filters to sample on points at the center of the target cells, convert that to cell data, and copy back to your sample grid.

1. Do the `Resample To Image` as you are.
2. Use the `Cell Centers` filter on the output to `Resample To Image`. Make sure to turn on the `Vertex Cells` property of the filter. This will create a bunch of point cells located at the center of each of the cells in your input data.
3. Use the `Resample With Dataset` filter to get the cell data from the _original unstructured mesh_. This filter has 2 inputs. Set the `Source Data Arrays` input to your original unstructured mesh. Set the `Destination Mesh` to the `Cell Centers` filter.
4. Use the `Point Data to Cell Data` filter on the output of `Resample with Dataset`. Normally, this does an averaging of point data to the cell data, but because the data only has one point per cell, it will just do a simple copy.
5. Select both the `Resample To Image` and `Point Data to CellData` filter in the pipeline browser and then add the `Append Attributes` filter. This will copy the cell data you generated on those points at the cell centers back to the data structure where you really want it.

Note that the output will now have duplicated all your fields on both points and cells. You can use the `Pass Arrays` filter to select which ones you actually want to keep.

---

_[View the full topic](https://discourse.paraview.org/t/resampling-using-cell-data/7238)._
