swim — Fourier-based image aligner
swim aligns a subsection of the image file source with a subsection of the image file target using the SWiFT-IR algorithm described in Wetzel et al. (2016).
size specifies the size of the subsection to use and may be specified as a single number or in the form WxH.
In general, we need to have a point ptgt = (xtgt, ytgt) and a corresponding point psrc = (xsrc, ysrc). These can be explicitly given, or psrc can be inferred from an affine transformation psrc = M ptgt + b.
In form (1), ptgt and psrc are the center of the respective images.
In form (2), xsrc is implicitly the same is xtgt and ysrc the same as ytgt. The transformation matrix M = [1 0; 0 1] with zero translation.
In form (3), the transformation matrix M = [1 0; 0 1], and the translation b is taken from ptgt and psrc.
In form (4), the transformation matrix M is set to [cos(φ) sin(φ); -sin(φ) cos(φ)], where φ is the angle specified (in degrees).
In form (5), the transformation matrix is specified explicitly.
In forms (6) and (7), an affine transformation matrix A is specified. There must a final argument after the number. If that argument starts with a hyphen, psrc = A-1 ptgt and the transformation matrix M is likewise taken from A-1. Otherwise, psrc = A ptgt.
(Note that A p := M p + b if A = [ M00 M01 b0; M10 M11 b1].)
In form (8), commands are read from stdin. Lines starting with hash (“#”) are ignored.
-w expr: Specify whitening exponent. If set to zero, whitening is disabled.
-x expr: Specify additional shift for x-coordinate of center of patch
-y expr: Specifiy additional shift for y-coordinate of center of path
-$ n: Specify debug level
Expressions may contain addition, subtraction, multiplication, division, and exponentiation. Parentheses are supported. Variables are not supported. Note that unlike for mir, there must be a space between the option name and the option value.
The translation specified by the -x and -y command line options are applied directly to ptgt. Transformed by M they are applied to psrc. The multiplier specified by -m is applied to all coordinates.
swim outputs a line of the form
SNR: target xtgt ytgt source xsrc ysrc φsrc (Δx Δy m0 flags)
Here:
Information in parentheses is somewhat redundant. Δx and Δy are the pixel shifts applied to psrc andm0 := √(Δx2 + Δy2). The flags can indicate bad matches in x (“dx”), in y (“dy”), in both (“dxy”) if any shift is greater than a quarter of the window size. It can also indicate that a threshold has been exceeded (“dreset”)
Note that mir uses output and input coordinates to place a source image in a target space and returns a “forward” transform that maps source to target as well as an “inverse” transform that maps target back to source. It is this inverse transform that can be fed to swim as the M transformation matrix on a refinement pass.
Wetzel AW, Bakal J, Dittrich M, Hildebrand DGC, Morgan JL, Lichtman JW, 2016. Registering large volume serial-section electron microscopy image sets for neural circuit reconstruction using FFT signal whitening. arXiv:1612.04787. https://arxiv.org/abs/1612.04787.