-
Notifications
You must be signed in to change notification settings - Fork 3
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.
- Affine transforms
- Diffeomorphic (ANTs-style) transforms
- Thin-plate spline transform
- General deformation field 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
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 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 ).
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 ).
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.
- 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]
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
.
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 off
- where
-
- if
s
does not satisfy the above, sets = beta * s
and check again.