Skip to content

Inverse transforms

John Bogovic edited this page Mar 15, 2019 · 8 revisions

Inverse transforms

This page documents transformations whose inverses can be used in either transforming images or transforming neuronal skeletons.

We recommend avoiding the use of iterative inverses when possible, since these are expensive to compute.

Fast (closed form or specified)

  1. Affine transforms
  2. Diffeomorphic (ANTs-style) transforms

Slow (Iterative)

  1. Thin-plate spline transform
  2. General deformation field transforms

Affine transforms

Affine transformations are closed-form invertible, and so are fast to invert.

Examples:

  • Cmtk-style affine: cmtk_affine.xform?i
  • Ants-style affine: ants_affine.mat?i
  • Imglib2-style affine: imglib2_affine.txt?i

Diffeomorphic (ANTs-style) transforms

ANTs-style transformations specify both the forward and inverse transformation as deformation fields and so are fast to invert, because the inverse is explicitly specified.

ANTs diffeomorphic methods (SyN, BSplineSyN) generate forward and inverse deformation fields. These can be "inverted" by supplying the file containing the inverse deformation, but not using a ?i suffix.

When using an h5 transform file that stores both the forward and inverse fields, the ?i suffix can be used to invert

Thin plate spline transforms

Thin plate spline transforms are specified by text (.csv) files written by BigWarp, and can be inverted using the ?i suffix. In this case, an iterative method using gradient descent ( see details below ).

Deformation field transform

General deformation fields can be inverted using the ?i suffix. These are specified using 3D volumetric file formats (.nii, .nrrd). In this case, an iterative method using gradient descent ( see details below ).

Iterative inverse details

We use a gradient descent method to find the inverse of a transformation, with a step size determined by a backtracking line search. The implementation can be found here.

Parameters

  • tolerance - the tolerable error (iteration stops once error falls below tolerance) [double].
  • maxIters - the maximum number of search iterations [integer]
  • c - Line search parameter determining adequate error decrease (see below). Must be in (0,1) [double]
  • beta - Line search parameter changing step size (see below). Must be in (0,1) [double]

Specifying parameters on the command line

The the inverse of your transform will be transformed iteratively, you can specify the above parameters for the iterative inverse computation on the command line as illustrated in this example:

  • -t a_deformation_field.nrrd?invopts;tolerance=0.01;maxIters=200;c=0.01;beta=0.5?i

Splitting this up into pieces, the form of the string should be:

  • <the file>?<the inverse parameters>?i

where the inverse parameters must start with the string invopts; and is followed by strings of the form <option>=<value>;. Note the equal signs and separating semicolons. Not all parameters are required. For example:

  • -t a_deformation_field.nrrd?invopts;tolerance=0.01;maxIters=200?i

assigns the tolerance and maxIters parameters, using default values for c and beta.

Line search parameters

Given a direction p

  • A step size s is used if it satisfies the Armijo–Goldstein condition:
    • f( x + sp ) < f(x) - c * s * dot( p, grad(f))
      • where dot( p, grad(f)) is the inner product of the direction (vector) p with the gradient of f
  • if s does not satisfy the above, set s = beta * s and check again.