# [SciPy-user] Thin plates for a 3D deformation field

Matthieu Brucher matthieu.brucher@gmail....
Sun Oct 28 11:43:31 CDT 2007

```Hi,

I see that you compute directly the new image ;) For the tool we are
developping in my lab, we prefer to split everything (one function to
compute a deformation field and one function for applying the deformation
field), as some times we only want to work on the field, sometimes on the
image, ...

I didn't use the same approach than you, I tried to maximize the use of
Numpy too (so to compute the distances, I used Bill Baxter's function he
proposed some time ago, the computation of the sum in the smooth continuous
field is done by a matrix multiplication, ...), which means that my approach
may use more memory than yours.

I've only one thing that I have to modifiy, it is the computation of r²log
r² when r is too small, I saw that you took care of it.

For those who are interested in the future, they have now two solutions :
http://matt.eifelle.com/item/4

Matthieu

2007/10/28, Zachary Pincus <zpincus@stanford.edu>:
>
> Hi Matthieu,
>
> See attached my (GPL, but ask if you want in a different license)
> code for thin-plate image warping in 2D. It's straight out of
> Bookstein, but has some simple changes to make it tolerably fast in
> python/numpy.
>
> It still depends on ndimage for the image coordinate mapping (so that
> one can use the fancier interpolators available), but that's easy to
> remove. The basic code should work fine in 3D; I think only the
> interpolation of the coarse deformation grid to a finer grid (a hack
> anyway) is 2D specific.
>
> Anyhow, it should give you somewhere to start, and a hint at various
> caveats (like needing to set the log of very small values to zero to
> keep the thin plate function from exploding at times).
>
> Also, note that if you do choose to use the RBF module from scipy,
> you can just grab that file and put it into your code (modulo license
> restrictions) -- it doesn't depend on much else. Similarly, you could
> just grab Robert's delaunay scikit and incorporate that into your
> code so as not to have any dependencies.
>
> Zach

--
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071028/2ddec12a/attachment.html
```