
July 31st, 2014, 12:56 PM
#1
How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many met
How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many methods to interpolate function R3>R1 (i mean 3D to 1D), but no possible way to accoplish my task. Except for Thin Plate Splines, they worked fine, but I want something new (if it is possible, Kriging).
"Vq = interp3(X,Y,Z,V,Xq,Yq,Zq) returns... X, Y, and Z contain the coordinates of the sample points. V contains the corresponding function values (SCALAR) at each sample point. Xq, Yq, and Zq contain the coordinates of the query points." This is just what I have mentioned at the beginning. interp3 operate with function (bijection, correspondence) from space with 3 coordinates (3D, triplet) to space with 1 coordinate (1D, scalar). I want to establish and operate with correspondence from 3D to 3D..
TPS solves such problems. http://www.mathworks.com/matlabcentr...rpingfunction
http://www.mathworks.com/matlabcentr...platesplines
I used the first link. The interface is pretty straightforward. I marked: 1. points: old positions of control points; 2. ctrlpoints: new positions of control points; 3. object: source template.
But I want Kriging now.
Thank you very much.

August 1st, 2014, 09:24 AM
#2
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
you're looking for 3d splines ?
If yes, you'll need more info than that, you'll need an escape/normal vector on the point as well. ANd probbaly you'll want a 'force' value as well.
or do you just want a flat transition ?
or do you want a spline going from point a to b by passing through one or more control points ? (if yes, you may still want a normal/escape at a and b, and forve values at a, b and every intermediary).
Or are you looking for 'spline planes' (curved planes, the equivalent of a spline in 2d but with an extra D) ?
if so then TPS might be a fit, but remember those are only curved on 1 dimension.
if you want a curved surface 'all around' (radial spline) then that's something else entirely.

August 1st, 2014, 03:51 PM
#3
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
"you're looking for 3d splines ?"
Yes, please.

"if so then TPS might be a fit, but remember those are only curved on 1 dimension."
I understand your precaution, but no (thin plate splines (TPS) are an interpolation and smoothing technique, the generalisation of splines so that they may be used with two or more dimensions)... There are two links in the first post  I just give corresponding points (they have very different position) and get result.

Please note that corresponding points might be not PRECISELY fit one to another (even with different scales). There is some criterion function (I need any of it). For example, TPS fits a mapping function f(x) between corresponding pointsets \{y_i\} and \{x_i\} that minimises certain energy function:
http://en.wikipedia.org/wiki/Thin_plate_spline

August 1st, 2014, 06:01 PM
#4
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
ok, so I'm going to assume what you want is curved surfaces in general...
If yes, then you have
bezier surfaces
Bspline surfaces
nonuniform nonrational Bsplines
nonuniform rational Bsplines (NURBS)
TPS as you already mentioned
cubit hermite spline
this isn't easy stuff. Quite a bit of math involved, and you won't easily find 'plug in' code that will fit into your current 3D setup without some pushing and prodding. So you'll need to 'understand' how things work.
Best I can recommend is getting a decent book on graphics programming. A de facto standard in that field is
Computer Graphics Principles and Practice by Foley, Van Dam, Feiner and Hughes.
There's a free chapter available as PDF , unfortunatley not the one you want.
The 3rd edition has just very recently been released (24 years after the 2nd edition). It's pricey, but it's a "dense" book with a lot of the low level stuff you want to know when you're in this field.

August 1st, 2014, 06:05 PM
#5
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
alternatively, depending on needs, you might be able to pick up a 2nd edition "really cheap" as some stores will be dumping their 2nd edition copies.

August 1st, 2014, 09:59 PM
#6
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
“nonuniform nonrational Bsplines”
No information about it.
“nonuniform rational Bsplines (NURBS)”
It operates with (approximates) functions Rn>R1 (if there is a point at (x1k, x2k, …, xnk), then f(x1k, x2k, …, xnk)=1, otherwise f(x1k, x2k, …, xnk)=0).
“Bspline surfaces”
Partial case of NURBS.
“Bezier surfaces”
Partial case of NURBS.
“cubic hermite spline” (its generalization to three dimensions is called Tricubic interpolation)
Equivalent to Bezier surfaces.
“TPS as you already mentioned”
Great Rn>Rn extrapolation/approximation tool.
There are some smaller overlapping kinds of splines (TSpline etc.) with same problem.

I had great use of article:
http://en.wikipedia.org/wiki/Multivariate_interpolation
However, no method for my needs. Namely:
“Nearestneighbor interpolation”
Another Rn>R1 extrapolation/approximation tool. No good extrapolation for my case.
“Triangulated irregular networkbased natural neighbor”
Another Rn>R1 extrapolation/approximation tool. No good extrapolation for my case.
“Triangulated irregular networkbased linear interpolation (a type of piecewise linear function)”
Another Rn>R1 extrapolation/approximation tool.
“Inverse distance weighting”
Another Rn>R1 extrapolation/approximation tool.
“Kriging”
Another Rn>R1 extrapolation/approximation tool.
“Radial basis function”
Another Rn>R1 extrapolation/approximation tool (by the way, mixing RBF and Kriging in the form of coordinates parametrization by distance between points done by me was unsuccessful).
“Thin plate spline”
Great Rn>Rn extrapolation/approximation tool.
“Polyharmonic spline (the thinplatespline is a special case of a polyharmonic spline)”
Too close to TPS.
“Leastsquares spline”
Another Rn>R1 extrapolation/approximation tool (called spap2 in Matlab).

It is rather simple Math, as for me. I need to solve my task…
Last edited by Kosarar; August 2nd, 2014 at 03:22 AM.

August 2nd, 2014, 04:51 AM
#7
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
Best I can recommend is getting a decent book on graphics programming. A de facto standard in that field is
Computer Graphics Principles and Practice by Foley, Van Dam, Feiner and Hughes.
There's a free chapter available as PDF , unfortunatley not the one you want.
The 3rd edition has just very recently been released (24 years after the 2nd edition). It's pricey, but it's a "dense" book with a lot of the low level stuff you want to know when you're in this field.
On Amazon http://www.amazon.co.uk/ComputerGra...s+and+practice
you can search inside the book to see pages related to the search.
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
C, C++ Compiler: Microsoft VS2015

August 2nd, 2014, 05:24 AM
#8
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
Well, that is really nice. But I still have some hope left that somebody knows the answer. It is not impossible that in the whole world only the respectful authors of that book know the truth. I do not need much  only small bit of, as I thought, almost very basic and trivial knowledge... Even now I still sometimes wonder why there is no 3D3D regression or interpolation embedded in Matlab.

August 2nd, 2014, 06:02 AM
#9
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
Originally Posted by Kosarar
Even now I still sometimes wonder why there is no 3D3D regression or interpolation embedded in Matlab.
are you sure ? I don't use matlab, but the google search "matlab gaussian regression" gives hundred thousands results, and in the first few pages there seems to be plenty of resources concerning your goal ... ( moreover, in that book ( that I love ... ah that amazing Vermeer CG painting on the cover ... ) I don't remember anything about regression, at least the (old) edition I read long ago ... ).

August 2nd, 2014, 03:48 PM
#10
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
Originally Posted by superbonzo
are you sure ? I don't use matlab, but the google search "matlab gaussian regression" gives hundred thousands results, and in the first few pages there seems to be plenty of resources concerning your goal ... ( moreover, in that book ( that I love ... ah that amazing Vermeer CG painting on the cover ... ) I don't remember anything about regression, at least the (old) edition I read long ago ... ).
I am pretty sure because I remember at least something about regression. But I would be very happy to be wrong in this case. I looked at the contents of Computer Graphics Principles and Practice by Foley, Van Dam, Feiner and Hughes and found nothing. Anybody, tell me about embedded/mathworks.com/other sources 3D3D function of interpolation, please...
Last edited by Kosarar; August 2nd, 2014 at 03:58 PM.

August 3rd, 2014, 02:58 AM
#11
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
Originally Posted by Kosarar
I am pretty sure because I remember at least something about regression.
I meant to say that I don't remember anything about regression in the aforementioned book, not by myself. Anyway, did you take a look at that google search ?
Originally Posted by Kosarar
Anybody, tell me about embedded/mathworks.com/other sources 3D3D function of interpolation, please...
now I'm confused, do you need interpolation or regression ?
in the latter case, there appear to be many matlab gaussian regression packages on the web, again just look at the google search I suggested. Do you have doubts about passing from a 3d>1d to 3d>3d problem ? if yes, it clearly depends on the nature of your data so only you can tell. For example, if the correlation between the outputs is expected to be negligible then it sufficies to treat the 3d>3d problem as three indipendent 3d>1d regression problems; otherwise, you'll need something more general than gaussian regression, which means you'll probably need to specify the prior and compute the posterior explicitly via bayesian analysis. Here is an example coming from the google search above, dubbed twin gaussian regression.

August 3rd, 2014, 06:23 AM
#12
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
Originally Posted by superbonzo
I meant to say that I don't remember anything about regression in the aforementioned book, not by myself. Anyway, did you take a look at that google search ?
Yes, a lot. Nothing found.
Originally Posted by superbonzo
now I'm confused, do you need interpolation or regression ?
Regression analysis is widely used for prediction and forecasting, where its use has substantial overlap with the field of machine learning, as splines do and as interpolation stands for.
Usually it is Rn>R1 (if there is Rn>Rn, I would gladly use it). Regression models predict a value of the Y variable given known values of the X variables. Prediction within the range of values in the dataset used for modelfitting is known informally as interpolation. Prediction outside this range of the data is known as extrapolation. Performing extrapolation relies strongly on the regression assumptions. The further the extrapolation goes outside the data, the more room there is for the model to fail due to differences between the assumptions and the sample data or the true values.
I need anything that solves my task. I have 3D vertebrae model (6 points) and I need to pull the current CT scan (2080 points) on it. The coupling dependencies between old positions of control points (first 6 points of the previous sentence) and new positions of control points (some 6 points of the last 2080 points of the previous sentence) are marked manually. I used TPS. http://www.mathworks.com/matlabcentr...rpingfunction http://www.mathworks.com/matlabcentr...platesplines The first link is simpler. The interface is pretty straightforward. I marked: 1. points: old positions of control points; 2. ctrlpoints: new positions of control points; 3. object: source template. I got nice results. But maybe some other such functions exist?..
Originally Posted by superbonzo
in the latter case, there appear to be many matlab gaussian regression packages on the web, again just look at the google search I suggested. Do you have doubts about passing from a 3d>1d to 3d>3d problem ?
Yes, we can say so.
Originally Posted by superbonzo
if yes, it clearly depends on the nature of your data so only you can tell. For example, if the correlation between the outputs is expected to be negligible then it sufficies to treat the 3d>3d problem as three indipendent 3d>1d regression problems;
It does not work. Different parameterizations (mostly I played with Kriging and RBF) do not work also.
Originally Posted by superbonzo
otherwise, you'll need something more general than gaussian regression, which means you'll probably need to specify the prior and compute the posterior explicitly via bayesian analysis. Here is an example coming from the google search above, dubbed twin gaussian regression.
Very promising article. Thank you very much. I am still digging through it. But maybe you have the practical Matlab realization of ANY Rn>Rn interpolation method (because I am not sure that the task described in your article will correlate with mine)?
Last edited by Kosarar; August 3rd, 2014 at 08:18 AM.

August 3rd, 2014, 08:47 AM
#13
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
so, if I understood you correctly, you want to map the remaining 20806 points to the the 6points model space, don't you ?
this looks like a good candidate for gaussianlike regression, given the possibly complex anatomical variability of the model vs the real scan. In this case, you'll need some data set to train the system in order to get sensible results ( I remember I read about a paper trying to map brain cortical foldings to a model to ease functional imaging, so I'm sure there exists something similar for spinal imaging as well ... ).
if you lack training data then splinelike interpolation could work but I'm sceptic about achieving anatomically accurate results in this case.
Originally Posted by Kosarar
I got nice results
so, why do you need a better solution ? what's the problem ?

August 3rd, 2014, 06:38 PM
#14
Re: How to interpolate R3>R3 (i mean 3D to 3D) function in Matlab? I have found many
Originally Posted by superbonzo
so, if I understood you correctly, you want to map the remaining 20806 points to the the 6points model space, don't you ?
No (interpolation of permutation function in R3 space...). I need to move, rotate, deformate (for instance, with the smallest energy of deformation, as in TPS) my 2080points shape to match it to my 6points shape (skeleton). After that I will assemble the whole spine with those vertebrae, but this is easy. For example (consider 2D): (0,0)>(0,0), (0,1)>(1,0), how to show that (1,1)>(1,1) (in both cases we have equal triangles)?
Originally Posted by superbonzo
so, why do you need a better solution ? what's the problem ?
I need some other methods to compare and analyze those methods practically. My teacher told me to find them. Is it possible that only 1 (ONE) method for that exists now?
Last edited by Kosarar; August 3rd, 2014 at 09:22 PM.
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
This a Codeguru.com survey!
