0
$\begingroup$

Consider a sphere sitting on an $xy$-plane, and take 2D slices parallel to the $xy$-plane at various heights of z. Suppose we take 10 slices, evenly spaced along the $z$-axis, and now have 10 images of circles each with a corresponding $z$.

My goal would be a function that could learn from these 10 slices, such that if I were to input a new value of z, it would draw a circle (that is ideally close to the correct circle at that height).

Would there be a way to train something like a neural network to take the height z as the input, and output circles corresponding to the slice of a sphere at a particular height?

Such a method should scale to multiple dimensions. For example, if I had some multidimensional object I wished to reconstruct using slices of that object. Note that the parameter corresponding to slices may now be a vector.

EDIT: The goal is to interpolate between 2D shapes that do not have simple analytic solutions. For example, one image is a circle and another is a rectangle.

The problems I am facing are where there are no simple analytic solutions for new shapes as a function of z. Imagine that there exists a very rugged non-linear 3D object (like the cross section of a person) - but we can only determine a few slices of this object as it is computationally expensive for some reason. We wish to interpolate between these few slices and generate a 3D object. Such a solution should also work for strange multidimensional shapes beyond 3D.

$\endgroup$
1
$\begingroup$

A neural network is not a good choice for this. For this task, you can get a much better solution by analytically solving for the unknown radius of the sphere. In particular, if the radius of the sphere is $s$, then a slice at height $z$ will have radius $r$, where these three variables satisfy the equation

$$(s-z)^2 + r^2 = s^2.$$

Re-arranging, we find

$$s = {z^2 + r^2 \over 2z}.$$

So, you can solve immediately for the radius of the sphere. Once you know the radius of the sphere, you can predict the radius of other slices at any height of your choice, using the above equations a second time.


You could certainly train a neural network to interpolate, given enough training data. For instance, the input to the neural network might be 6 images: the three slices "above" z, and the three "below", and the output is a bunch of slices interpolated between the one above z and the one below; where each image is a picture of the slice. However I'm not sure how well this will work, and it will likely require a lot of training data to have any chance whatsoever of being useful, so you might do better to look for some other solution.

$\endgroup$
  • $\begingroup$ I realise my question may have been misleading. The problem concerns 2D slices that do not have simple analytic solutions. The sphere example was to help with visualizing - I realise there is an analytical solution to this as you have carefully pointed out. I have edited my question. The ultimate goal is a multidimensional interpolation beyond 3D $\endgroup$ – colmor Dec 16 '19 at 16:52
  • $\begingroup$ @colmor, OK, I edited my answer. $\endgroup$ – D.W. Dec 16 '19 at 18:39
0
$\begingroup$

Let's consider the simplest case: There are only two slices and these are closed figures. (More slices would potentially just be an iterative application of the following.) Consider the larger slice. For simplicity divide the perimeter of this slice into 4 line segments with 4 points dividing them. For each of these 4 points find the nearest point in the perimeter of the smaller slice. With these you have a kind of boxy interpolation (bordered by 4 new trapezoids) of the volume of the interpolated shape between the two slices. It's pretty rough though. Well, now divide the line segments in two, and now you have a finer approximation. For the interpolated volume, you can look at the relative error between two successive approximations. When the error gets smaller than some threshold you choose, you can perhaps say that the interpolated volume is good enough. This is a numerical approach, and a rough one at that (being strictly linear), but it gives you an idea. You could use fancier line fittings if you use multiple consecutive slices and fit a polynomial curve line between the corresponding points.

$\endgroup$
  • $\begingroup$ This sounds like a very promising kind of direction, but I'm not sure it'll totally work. If the smaller shape has a deep dent, then it might be that nothing on the larger slice gets mapped onto dent. In other words, if you trace a continuous path on the perimeter of the larger slice, then map that, you might get a discontinuous path on the smaller slice that makes "jumps". This might cause some anomalies in the interpolation. But it sounds like a good first start! Perhaps those could be smoothed out somehow? $\endgroup$ – D.W. Dec 17 '19 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.