Getting an interpolated image based on sparse pixel values

(Alireza ) #1

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

(Dženan Zukić) #2

I think BSplineScatteredDataPointSetToImageFilter does what you want.

(Matt McCormick) #3

Also ImageRandomNonRepeatkingIteratorWithIndex may be of interest.

(Alireza ) #4

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


(Bradley Lowekamp) #5

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.

(Alireza ) #6

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

(Bradley Lowekamp) #7

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.

(Alireza ) #8

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.

(Matt McCormick) #9

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

(Alireza ) #10

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


(Dženan Zukić) #11

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