Getting an interpolated image based on sparse pixel values

Lets assume that we have a 3D image of size 100x100x100, and we only want to set pixel values for 1000 locations in this 3D image. Is it possible to get the interpolated image based on these sparse pixel values? which filter should I use?

Thanks in advance for you help

1 Like

I think BSplineScatteredDataPointSetToImageFilter does what you want.

2 Likes

Also ImageRandomNonRepeatkingIteratorWithIndex may be of interest.

1 Like

I’m coding in Python. None of the above filters are implemented in ITK or SITK. Any alternatives for Python?

Thanks

From what I gather you are trying to define a continuous domain from 1000 sparse, randomly sampled points. This reminds me of radial basis based interpolation, but there could be many ways to “define” valid interpolation. To me it does not sound like you have an image just you need to convert a sparse point set to an image.

Unfortunately, I don’t have any specific suggestions for this operation ( if this is the operation you are trying to do). I think Dzenan’s might do what you need.

You assumption is correct.
So basically after my Bspline image registration method with 10x10x10 control points (the code is not based on ITK Registration), I end up with uncertainty scores for each of these control points. Next, I want to interpolate the Image space based on these 1000 locations and generate an Uncertainty map for my image registration algorithm

So you 10^3 points are not random, the are in a grid pattern which nicely fits into an Image in the “fixed domain” space. If you want to have the “uncertainty map” in the “moving image domain” you would simply need to apply the b-spline transform. This can be done with the resample image filter and you can specify the output image size and an interpolator as well.

They are not in a grid pattern since they are moved from their initial positions to achieve the best similarity based on bspline deformation, but that’s true that they are not random. Here is a slice of overlaid points on a public brain image.

For a specific operation like this, it can be helpful to create your own classes and wrap them in Python.

1 Like

Thank you, it’s not specific actually. Scipy has interpolation functions. I was just wondering if ITK provides it or not.

Best
Alireza

What you should definitely try is adding Python wrapping for BSplineScatteredDataPointSetToImageFilter, because that filter seems to be doing exactly what you want.

2 Likes