Interpolate ITK image data at missing / masked pixels (CUDA / C++)

Hi everyone,

I would like to know if there are any algorithms in ITK which would allow me to interpolate linearily missing pixels of a 2D image data (preferably with a CUDA implementation)?

To detail a little more my question, I have an image which looks something like the following :

0     0     0     0     0 
0     ma    0     ma    0
0     ma    ma    0     0
0     0     0     0     0 

I want to linearly interpolate the pixel values at the masked coordinates using the surrounding unmasked pixels.

In python, using SciPy, the equivalent code would be something like this :

slice_2d[masked_pos] = griddata(unmasked_pos, slice_2d[unmasked_pos], masked_pos, method="linear")

Thanks in advance,
Thibault

Hello @Thibault_Pelletier,

As far as I’m aware, this functionality isn’t available in ITK. What you are describing is a very basic form of inpainting.

An ITK based implementation is described in this kitware blog entry. Given the age, 9+ years, not sure if the code still works (the GitHub repository is still there).

2 Likes

Hi @zivy,

Thank you for your input.
I will take a look at the repository and the blog entry and have a go at it!

Thanks!