DataSet Resampling Filters

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.

11 Responses to DataSet Resampling Filters

  1. Tristan Coulange says:

    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

    • Sujin Philip says:

      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

      • Tristan Coulange says:

        Sujin,

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

        Thanks,

        Tristan

  2. Anubhav says:

    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.

    • Sujin Philip says:

      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

  3. Lars Bilke says:

    How to resample a Point Source to Image? I just asked this on StackOverflow as well: http://stackoverflow.com/q/39587607/80480

    • Sujin Philip says:

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

  4. Dennis Conklin says:

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

    • Nicola Paola says:

      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…

  5. Alejandro says:

    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

    • Sujin Philip says:

      Hi Alejandro,

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

      Thanks
      Sujin

Questions or comments are always welcome!