DataSet Resampling Filters

August 18, 2016

Recently, we added two new filters to the Visualization Toolkit (VTK) and ParaView. These filters can sample the point and cell data of one dataset on to the points of another dataset. Under VTK, these filters are implemented in vtkResampleWithDataSet and vtkResampleToImage. There are also parallel, distributed versions of these filters called vtkPResampleWithDataSet and vtkPResampleToImage. In ParaView, these filters are called “Resample With Dataset” and “Resample To Image.”

ResampleScreenShot1

The new filters are implemented using Diy2, a block-parallel library. Diy2 provides an abstraction over Message Passing Interface (MPI). It has built-in facilities for complex communication patterns like neighbor exchange and swap-reduce, and commonly used algorithms such as domain decomposition. Diy2 greatly simplifies the process of implementing parallel programs such as dataset resampling filters.

Following is a brief description of the two filters and their usage in ParaView:

Resample With Dataset

This filter takes two inputs: Input and Source, which can be any DataSet or Composite DataSet type. The filter samples the point and cell data of Input on the points of Source. The output DataSet has the same structure as Source, and its point data contains the resampled values from Input.

Resample With Dataset also works in parallel with distributed datasets. The output dataset will have the same distribution as Source.

ResampleWithDataset-small
ParaView displays an example of Resample With Dataset. The left-hand side contains a multiblock tetrahedra mesh (Input). The middle portion of the image shows a multiblock unstructured grid (Source). The outline of Input is also shown in this view. The right-hand side displays the result of applying the filter.

Resample To Image

This filter is a specialization of Resample With Dataset. The filter takes one input and samples its point and cell data onto a uniform grid of points. It is possible to specify the bounds and extents of the uniform grid using the properties panel. By default, the bounds are set to the bounds of the input dataset. The output of the filter is an Image-Data.

ResampleToImageProperties
In the properties panel for Resample To Image, unchecking “Use Input Bounds” allows the output bounds to be set manually.

Some operations can be performed more efficiently on uniform grid datasets. The Resample to Image filter can be used to convert any dataset to Image-Data before performing such operations. For example, Resample To Image can resample an unstructured grid dataset to an Image-Data to efficiently volume-render the data.

ResampleToImageExample-small
The top-left portion shows Input (unstructured grid), and the bottom-left area displays the output Image-Data. The colors represent the distribution of the data among the nodes. The right-hand side illustrates a volume rendering of the resampled data.

Like Resample With Dataset, Resample To Image can accept any type of DataSet or Composite DataSet as input and can work in parallel distributed environments. The output of Resample To Image is distributed evenly among the processes.

Resample With Dataset and Resample To Image replace or supercede existing filters (“Resample With Dataset and “Image Resampling) that had inefficient implementations. Resample To Image is already available in VTK 7.0 and ParaView 5.1. We expect to release Resample With Dataset with VTK 7.1 and ParaView 5.2.

Tags:

12 comments to DataSet Resampling Filters

  1. Sujin,

    There is a confusion about Input and Source, I think this sentence is false: “The output DataSet has the same structure as Source, and its point data contains the resampled values from Input.”

    But this is a nice blog 🙂

    Tristan

    1. Tristan,

      The nomenclature is different in VTK and ParaView. In VTK, Input provides the geometry and Source provides the data to resample, but it is the opposite in ParaView. The above description is correct for ParaView. My initial implementation of the ParaView filter used the VTK names but the older filter used the style described here. So I changed it to avoid any confusion for ParaView users.

      Hope that makes sense.

      Thanks
      Sujin

      1. Sujin,

        Yes this makes sense, thank you for the explanation. I was not aware of this inversion between VTK and ParaView.

        Thanks,

        Tristan

  2. Hi,
    I am learning paraview and come across Resample with Datasets filter. I want to implement it but unable find a step by step way that I can implement it with can.ex2 & disk_out_ref.ex2 datasets.
    Can you help me to understand it better.
    I am new to 3D visualization of scientific data.

    1. Hi Anubhav,

      Following are the steps to resample data from disk_out_ref.ex2 on to can.ex2:

      1) File > Open > can.ex2
      2) Select all Variables in Properties tab
      3) Apply
      4) File > Open > disk_out_ref.ex2
      5) Select all Variables in Properties tab
      6) Apply
      7) Filters > Alphabetical > Resample With Dataset
      8) Click Input, select disk_out_ref.ex2; Click Source, select can.ex2
      9) Apply

      For more details about ParaView filters and pipelines you can refer to the ParaView users’ guide available here: http://www.paraview.org/paraview-guide/

      Hope this helps.

      Thanks
      Sujin

    1. A solution has been posted to the stack overflow question by Utkarsh. I will reproduce it here for easy reference:

      “To sample a point source to vtkImageData, use the Point Interpolation Filters instead. Point Volume Interpolator is what you want.”

  3. If you really didn’t want it to be confusing in Paraview, why not call it Input Data and Output Geometry?

    1. Really nice idea: the Resample with Dataset in Paraview filter always generate a lot of confusion when it deals with Input and Source. Maybe this hint could be posted in the uservoice site as a new feature request…

  4. Hi, I think that there is an error in the labels included in the image of the section “Resample with Dataset”. The figure represented on the middle portion of the image is the source, and the one on the left is the input. Epigraph is OK.

    Nice blog!

    Greetings from BA, Alejandro

    1. Hi Alejandro,

      The image was generated before I renamed the ports to be consistent with ParaView. The caption has the correct names.

      Thanks
      Sujin

  5. Hello, I am using “Resample With DataSet” filter in ParaView 4.4.0 to sample a 2D dataset from an unstructured mesh to a Cartesian grid. I would like to know the interpolation method that is used by the filter. Is it a bilinear interpolation for 2D datasets. Thanks!

Leave a Reply