Resampling using cell data?

Hello,

i have some data at an unstructured grid in 2D

.
I would like to resample that to a structure grid. This I have done when I have point data. In my case, displacement from FEM .

I have used linear interpolation, nearest neighbor interpolation and gaussian. The problem is, that when doing the interpolation or the resampling, POINT data is required. However, my cell data CAN’T be interpolated as you cant average crystal orientations like that.

My question is, can i interpolate using cell data (without going to point data, of course not even internally) or can i resample using cell data ?
My end goal would be to have a structure grid, and that each cell has the value of the nearest neigbor of the original unstructured cell data.

Many thanks,
Fran

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. 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.

4 Likes

Hello Kenneth,

Here I display the results, in case someone is interested. I use low resolution, so that the differences can be seen =).

Many thanks for this. I would suggest anyone who is using unstructured mesh and orientation, to apply this trick. For example, in case you want to do orientation analysis in another software (which will use regular grid).

I would have an extra question. I have read the documentation ( 5. Filtering Data — ParaView Documentation 5.8.1 documentation) but i can’t find what interpolation do you use in Resample to image/Resample With Dataset? You use nearest neighbor, right?
In that case, if I use Point Plane Interpolator (i have 2D case) with a Linear Kernel, Kernel_footptint= N Closest, Number of points = 1, i should obtain the same results as im also running ‘find first neighbor’ algorithm, right?

Thanks,
Francisco