Natural neighbor interpolation in 3D

I have a set of sparse 3D points (gray values) in a stack and want to fill the empty space (0 value) in between with interpolated values. Does anyone knows a Plugin/macro that can do this?
The purpose is to generate a 3D background correction based on some supporting points.
I’ve searched for “natural neighbor interpolation”, “Sibson method” “3D interpolation”, but couldn’t find something useful. Maybe I look with the wrong terms. Does someone here has a hint or solution?

Hi @Jurgen_Gluch

This is relatively easy to do with imglib2 if I understand you correctly.
The short fiji (groovy) script linked below does the following, but with hard-coded points.

image

Does that help?
John

1 Like

Hi @bogovicj
thank you for the response. Your script works well, but this is the nearest and not the natural neighbor. The nearest neighbor creates a 3D Voronoi - which is nice but has abrupt change in value. The natural neighbor interpolation creates a smooth transition by adding new Voronoi prism at interpolated positions iteratively until the volume is filled. I had a look in the imglib2 JavaDoc, but unfortunately there is only the nearest neighbor variant implemented.

Something like you script can be achieved by run("3D Watershed Voronoi") from the 3D ImageJ Suite Plugin (however, this output has black line between the prism).

So, I am still looking for a solution.

Jürgen

My mistake, thanks for clarifying.

It will help to have a clear definition of natural neighbor interp.
Is wikipedia’s definition consistent with what you have in mind?

John

2 Likes

Ti my limited knowledge the only implementation available in Fiji is via the Mines library:

https://dhale.github.io/jtk/api/edu/mines/jtk/interp/SibsonInterpolator3.html

3 Likes

Thank you both. The wiki definition is correct and the hint to the Mines JTK is very useful. Unfortunately, I do all my stuff with macros and struggle to understand how the groovy script works. I could probably adapt the demo (Gridder3Demo.py) to my needs if I knew how to run it in ImageJ () with input from sampling coordinates, values, and output to an image stack.

What I did was to copy the edu-mines-jtk-1.1.0.jar to the plugins folder and run the demo under jython. The ImportError: No module named awt pops up, but awt is in the jar included. Same for sgl but not for the other classes. :sob: I should learn how to use those java stuff. Any idea where to start?

This is interesting, as a real use case, lets say I have a labelled/binary image and so if I can iterate over it I will create the valuePoints in N dimension and then this script give the Voronoi diagram?

I do not have much experience with groovy scripting and am busy doing something else at the moment but could I ask you to write this script for me please?

Hello Jurgen,

Yes if you want to go there you will probably have to do it in Java.
It can be a long road, do you need to take it?

According to the imglib2 examples, there’s also an InverseDistanceWeightingInterpolation implementation. Maybe it’s close enough to your goal ? (Inverse distance weighting - Wikipedia)

1 Like