# [vtkusers] vtkGridTransform: How to compute the inverse ?

David Gobbi dgobbi at imaging.robarts.ca
Mon Sep 16 10:41:18 EDT 2002

```Hi Jan,

If you just want to get the inverse grid transform, then use

transform = vtkGridTransform::New();
< build the transform >
inverseTransform = transform->GetInverse();

The use of Newton's method to invert a system of equations is
described in Numerical Recipes and similar texts.  The method
is roughly as follows:

1) make a guess of (x0,y0,z0) i.e. the inverse point
2) pass through transform T to get (x0',y0',z0') i.e. transform of guess
3) find displacements (dx',dy',dz') to the actual point (x',y',z')
4) divide the displacements by the Jacobian matrix calculated at
(x0,y0,z0) to get a first-order approximation of the displacements
(dx,dy,dz) in the inverse coordinate system
5) multiply the displacement (dx,dy,dz) by a factor 'f' where f<1 to
improve stability (see the code & numerical recipes to see how an
optimal f is chosen at each iteration)
6) add (dx,dy,dz) to the initial guess to get the next guess: (x1,y1,z1),
then repeat from step 2

The InverseTransformDerivative() method applies Newton's method as
described above, and returns the inverse point (x,y,z) as well as
the Jacobian matrix calculated at (x,y,z).

And I can't remember why I called the method 'InverseTransformDerivative()'
instead of something more obvious like 'GetInversePointAndJacobian()'.

- David

--
David Gobbi, MSc                dgobbi at imaging.robarts.ca
Robarts Research Institute, University of Western Ontario

On Mon, 16 Sep 2002, Jan Ehrhardt wrote:

> Hi to all,
>
> but this message is mainly to D. Gobbi.
>
> Can you explain me the method
> vtkGridTransform::InverseTransformDerivative() ?
> I see, you use some kind of newton-method but what criteria does you
> minimizing.
> Can you shortly explain the main steps of the algorithm ?
> Please, have pity with the stupid one ;-)
>
> Regards,
> 	Jan
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>