Skip to content

GPU-accelerated 2D spline interpolation, à la interp2(..., "spline"), in MATLAB.

License

Notifications You must be signed in to change notification settings

sebftw/interp2gpu

Repository files navigation

Fast 2D Spline Interpolation

interp2gpu is a drop-in replacement to interp2 to perform fast spline interpolation on the GPU in MATLAB.

How to use

Call it as Vq = interp2gpu(V, Xq, Yq, "spline").
For an explanation of inputs, see https://mathworks.com/help/matlab/ref/interp2.html from Mathworks.
An example of using interp2gpu is given in example.m.

Installation

You can download the code with this link.
Then run addpath(CODEPATH), where CODEPATH is the path of the directory where interp2gpu is located.
You can now use interp2gpu!

Features

✔️ Multiple images can be processed with one call to interp2gpu.
✔️ The method "spline_approx" performs fast approximated spline interpolation.
❌ Does not currently support double-precision inputs.
❌ Does not currently support arbitrary input pixel grids.

You can add support for double-precision inputs and non-uniform pixel grids relatively easily - feel free to contribute.

How to Cite

If you are using this software in your research, please cite our paper: S. K. Præsius and J. A. Jensen, “Fast Spline Interpolation using GPU Acceleration,” in Proc. IEEE Ultrason. Symp., pp. 1–5, 2024, doi: 10.1109/UFFC-JS60046.2024.10793976.

Files

  • example.m is an example that shows how to use interp2gpu.
  • interp2gpu.m is the main function.
  • gpuThomas2D.m is used to compute the image derivatives required to evaluate the spline.
  • get_kernel.m is used to cache CUDA kernels, so they do not have to be loaded every time.
  • Spline_paper.pdf is a paper containing the theory of the method and its application in ultrasound imaging.
  • kernels/getInterpolation2D.cu contains the CUDA C++ source code used to evaluate the spline.
  • kernels/compile_kernels.m is used to compile the CUDA code.
  • kernels/getInterpolation2D.ptx is the compiled CUDA kernel.

About

GPU-accelerated 2D spline interpolation, à la interp2(..., "spline"), in MATLAB.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published