.na
.nh
.TH tiltalign 1 4.6.34 IMOD
.SH NAME
tiltalign - Solve for alignment of tilted views using fiducials
.SH SYNOPSIS
tiltalign
.SH DESCRIPTION
This program will solve for the displacements, rotations, tilts, and
magnification differences relating a set of tilted views of an object. It
uses a set of fiducial points that have been identified in a series of
views. These input data are read from a model in which each fiducial point
is a separate contour.
.P
This program has several notable features:
.P
1) Any given fiducial point need not be present in every view. Thus, one
can track each fiducial point only through the set of views in which it can
be reliably identified, and one can even skip views in the middle of that
set.
.P
2) The program can solve for distortion (stretching) in the plane of the
section. It does so with two additional variables: "dmag", an increment to
the magnification along the X axis; and "skew", the difference in rotation
between the X and Y axis. If there is stretch in the plane of the
sections, then in general the aligned images will backproject correctly
only at one plane in Z. This solution thus includes a set of adjustment
factors that can be passed to the Tilt program to correct for this effect.
.P
3) It is possible to constrain several views to have the same unknown value
of rotation, tilt angle, magnification, compression, or distortion. This
can reduce the number of unknowns and can give more accurate overall
solutions.
.P
4) If the fiducial points are supposed to lie in one or two planes, then
after the minimization procedure is complete, the program can analyze the
solved point positions and determine the slope of this plane. It uses this
slope to estimate how to adjust tilt angles so as to make the planes be
horizontal in a reconstruction.
.P
5) The program can solve for a series of local alignments using subsets of
the fiducial points. This can be useful when aligning a large area which
does not behave uniformly during the tilt series. The local alignments can
then be used to obtain a single large reconstruction whose resolution is as
good as would be attained in a smaller volume.
.P
6) The program can use a robust fitting method to give different weights to
different modeled points based on their individual fitting errors. Points
with the most extreme errors are eliminated from the fit, and ones with high
but less extreme errors are down-weighted. This fitting provides a
substitute for fixing many modeled point positions based on their errors.
.SS Mapping of Variables
The constraining of different views to have related values of some
unknown variable is called "mapping"; it works differently for tilt than for
other variables. For variables other than tilt, if two or more views are
mapped to the same variable, then all of those views will have the same
value. For tilt angle, if two views are mapped to the same tilt variable,
then the DIFFERENCE between their tilt angles is constrained to be a
constant equal to the difference between their initial tilt angles. So, if
they have the same initial tilt angle, they will always have the same tilt;
and if their initial tilt angles differ by 10, their tilt angles will always
differ by 10.
.P
Mapping can be set up relatively easily with "automapping". When you
select automapping, the program will map views in a group of adjacent views
to the same variable, and it will determine a set of groups of a specified
size. You control the mapping by specifying the default size of the
groups. In addition, if some views need to be grouped differently, you can
specify one or more ranges of views to have different sized groups.
.P
With automapping, the program can also set up variables that change
linearly from one group to the next, rather than being constrained to the
same value for all views in a group. In other words, the values for all of
the views in a group will be a linear combination of the same two actual
variables (typically the first one in the group and the first one in the
next group). This feature usually gives a solution with less error. The
distinction between actual variables and combinations can be seen in the
"Variable mappings" table. Actual variables would appear as, e.g., "tilt
15" and "tilt 25", while combinations of the two appear as "t 15+ 20".
There are also linear combinations between a variable and a fixed value,
which appear in the table as "t 70+fix". Currently, the linear mapping is
available only with automapping, not with manually specified mappings.
.P
With automapping, the size of the groups will be adjusted dynamically for
two variables, tilt angle and x-axis stretch, so that groups become smaller
at higher tilt angles. This is done because it is easier to solve
accurately for tilt angle at higher tilt, and because the solution for
x-axis stretch tends to change rapidly at high tilts. The group size that
you specify for these variables will be the average size of the whole range
of tilts. If this dynamic automapping gives problems with tilt angle, use
mapping in blocks rather than linear mapping to have stricter control over
the mapping process. The dynamic automapping is used for both kinds of
mapping of x-axis stretch because the mapping in blocks is the preferred
method for grouping this variable. (Linear mapping does not always work
properly.)
.P
The size of groups when automapping will also be adjusted to provide more
grouping when some views have only one or two points. Specifically, views
with fewer than 3 points will not be counted toward the total number of
views to be included in a group. This feature is most important with the
local alignments described next, where there may be relatively few points in
a local area.
.SS Local Alignments
The program can embark on local alignments after obtaining the standard
global solution with all of the fiducials. The program divides the image
area, or the area occupied by fiducials, into a regular array of overlapping
subareas. Fiducials whose X and Y coordinates fall within a subarea are
included in the computations for that subarea. A subarea is expanded about
its center, if necessary, to include a certain minimum number of fiducials.
The program then seeks a solution for the subset of fiducials that is, for
all variables, "incremental" to the global solution; that is, it solves for
variables that are added to the parameters from the global solution. This
method allows a dramatic reduction in the number of variables to be solved
for, mostly because rotation and magnification can be mapped to a much
smaller number of variables than in the global solution. The usual need for
each view to have its own rotation and magnification variable is already
accommodated in the global solution.
.P
One option in the local alignment is whether to solve for the X-Y-Z
coordinates of the subset of fiducials, or to fix them at their values from
the global solution. Solving for the coordinates may give a more accurate
solution but it does require more fiducials to get a reliable result.
Fixing the coordinates reduces the number of variables to be solved for and
allows a reliable solution with only a relatively few fiducials; it also
avoids distortions in the resulting reconstruction that could be difficult
to account for when trying to combine reconstructions from tilts around two
axes.
.SS Robust Fitting
The goal in robust fitting is to reduce the effect of incorrectly placed
model points on the fitted solution by giving less weight to points which
appear to be outliers. Because it is not possible to be certain about which
points are indeed incorrect, each point is given a weight that depends on
how large its error is relative to that of other points. When the option to
use robust fitting is selected, the program first obtains a global alignment
solution, or one for a local area, which gives a residual error value for
each projection point. The residual values are analyzed to derive a weight
between 0 and 1 for each one, and the fitting routine is call again to
refine the solution with these weights. This solution provides new
residuals, and this process is repeated until the weights do not change
significantly or until the fitting routine only runs for one iteration
several times in a row. At the end, the program prints out the final F
value from the fit, which is the square root of the mean squared weighted
errors, and it also prints a weighted mean residual value immediately after
the ordinary mean. It also prints a line showing the number of weights that
were set to 0, less than 0.1, less than 0.2, and less than 0.5. The latter
number is usually about 5% of the total points. The numbers of
down-weighted points can be increased or decreased by entering the
KFactorScaling with a value less than or greater than 1, respectively.
.P
The weights are derived by the following method. The median residual is
first obtained for each view from the errors of the unweighted fit, and
these values are smoothed to obtain a curve for the dependence of median
residual on view number. The projection points are divided into groups of
about 100 by forming groups of adjacent views, and, for the global solution,
by sorting the points into concentric rings based on distance from the
center. These two measures are used to reduce the influence of systematic
variations in residual error with tilt angle and with distance from the
center on the detection of incorrectly positioned points. For a group of
points, each point's residual is divided by the smoothed median residual for
that point's views. The median of the values is found, as well as the
normalized median absolute deviation from the median (the MADN). For each
point with residual greater than the median, the value
x = (residual - median) / (K * MADN)
.br
is computed, where K is the K factor (4.685 by default), and the weight is
(1 - x**2)**2
.br
for x < 1, or 0 for x > 1.
.SS The Alignment Model
The program implements the following model for the imaging of the specimen
in each individual view:
.nf
1) The specimen itself changes by
a) an isotropic size change (magnification variable);
b) additional thinning in the Z dimension (compression variable); and
c) linear stretch along one axis in the specimen plane, implemented by
variables representing stretch along the X axis and skew between
the X and Y axes;
2) The specimen is tilted slightly around the X axis (X tilt variable)
3) The specimen is tilted around the X axis by the negative of the beam
tilt, if any (one variable for all views)
4) The specimen is tilted around the Y axis (tilt variable)
5) The specimen is tilted back around the X axis by the beam tilt, if any
6) The projected image rotates in the plane of the camera (rotation
variable)
7) The projected image may stretch along an axis midway between the
original X and Y axes (one variable for all views)
8) The image shifts on the camera
.fi
.P
Only a subset of this complete model can be solved for in any given case.
In particular, thinning cannot be solved for together with tilt angle and
stretch along the X axis; it is very difficult to solve for X axis tilt
together with rotation angle; and it is almost impossible to solve for beam
tilt together with rotation and skew.
.P
The complete model is summarized in:
.br
Mastronarde, D. N. 2008. Correction for non-perpendicularity of beam and
tilt axis in tomographic reconstructions with the IMOD package. J. Microsc.
230: 212-217.
.br
The version of the model prior to the addition of beam tilt is described in
more detail in:
.br
Mastronarde, D. N. 2007. Fiducial marker and hybrid alignment methods for
single- and double-axis tomography. In: Electron Tomography, Ed. J. Frank,
2nd edition, pp 163-185. Springer, New York.
.SH OPTIONS
Tiltalign uses the PIP package for input (see the manual page for pip(1))
and can still take sequential input interactively, to maintain compatibility
with old command files. The following options can be specified either as
command line arguments (with the -) or one per line in a command file or
parameter file (without the -). Options can be abbreviated to unique
letters; the currently valid abbreviations for short names are shown in
parentheses.
.P
In all entries of view numbers, the views are numbered from 1.
.P
INSERT OPTION TEXT HERE
.TP
.B -StandardInput
Read parameter entries from standard input.
.P
.SH SEQUENTIAL INPUTS
If there are no command-line arguments, Tiltalign takes sequential input
the old way, with the following entries:
.P
Parameters are entered in the following order. Lines starting with
IF are entered only for particular choices on the preceding line.
.P
Model file name
.P
Name of image file on which model was built, or a blank line
.P
IF a blank line was entered, next enter the image dimensions NX & NY,
the X and Y origin (default is 0,0), and the X and Y delta
values (default is 1,1).
.P
Either a filename with an extension containing "mod" to output a
3-D model of the fiducials based on their solved positions,
or a filename with extension containing "res" for a list of all
residuals, which can be converted to a model with Patch2imod,
or a filename with neither text in the extension to get both
outputs, one with extension .3dmod and one with extension .resid,
or a blank line for neither output
.P
Name of file to which to write (in ASCII text) the solved X-Y-Z
coordinates, or a blank line for no text output
.P
Name of file to which to write a list of the solved tilt angles,
or a blank line for no tilt angle output
.P
Name of output file for solutions and/or transformations
.P
-1 to put only the solved values of the parameters in the output file
or 1 to put only transformations for aligning the images
into the output file,
or 0 to put both in the file.
.P
0 to include all views that have points in the model file
or 1 to specify the starting, ending, and increment views to
include
or 2 to enter a list of the individual views to include
or 3 to enter a list of views to exclude
.P
IF 1 was selected, next enter the starting and ending view number
and the increment to use between those values
.P
OR IF 2 was selected, enter a list of views to be included. Ranges
may be entered; e.g. 0-3,6-8
.P
OR IF 3 was selected, enter a list of views to be excluded
.P
Initial angle of rotation in the plane of projection. This is the
rotation (CCW positive) from the Y-axis (the tilt axis after the
views are aligned) to the suspected tilt axis in the unaligned
views.
.P
0 to solve for all rotation angles (and thus to solve for tilt axis),
or the number of the view to fix at the initial rotation angle
(and thus fix the tilt axis at that angle for that view)
or -1 to solve for a single global rotation of the tilt axis
or -2 to fix all rotation angles at the initial angle
.P
Number of sets of views to treat separately from the main set of
views in any automapping of variables. Enter 0 if you will not
be using automapping or if all views can be treated together
when automapping. These sets would typically be lists of views
that were reshot so they will be referred to as reshoot sets.
.P
IF a number other than 0 was entered, next enter one line for each
separate set, giving a list of the views included in that set.
Ranges are allowed here.
.P
-1 to enter initial tilt angles individually, 1 to enter starting
and increment tilt angles, or 0 to read tilt angles from a file
.P
Either the individual tilt angles (ranges NOT allowed), the
starting and increment tilt angles, or the name of a file with
tilt angles, depending on whether you just entered -1, 1, or 0.
.P
Tilt angle offset, i.e. amount to ADD to all entered tilt angles
.P
0 to fix all tilt angles at their initial values
or 1 to solve for all tilt angles except for a specified view
or 2 to solve for all tilt angles except for the view at minimum
tilt
or 3 to solve for all tilt angles except for a specified view
and the view at minimum tilt
or 4 to specify some other combination of fixed, variable, and
mapped tilt angles
or 5 or 6 to automap groups of tilt angles; 5 for linearly
changing values or 6 for values all the same within a group
or 7 or 8 to automap and fix two tilt angles; 7 for linearly
changing values or 8 for values all the same within a group
.P
IF 1, 3, 7 or 8 was selected, next enter the number of the view
whose tilt angle will be fixed.
.P
IF 7 or 8 was selected, next enter the number of the second view
whose tilt angle will be fixed.
.P
IF 4 was selected, next enter a variable number for each view, or 0
to fix the view at its initial tilt. For convenience, these
variable numbers can be completely arbitrary; e.g. 0,1,1,1,2,2
and 0,9,9,9,5,5 both do the same thing: fix the tilt for view 1,
map the tilts for views 2, 3 and 4 to the first tilt variable,
and map the tilts for views 5 and 6 to the second tilt variable.
.P
IF 5 to 8 was selected, next enter the default number of views to
group together, and the number of ranges of views that should
have some grouping other than the default. If a negative number
of views is entered, then reshoot sets will NOT be segregated
from the rest of the views in this default mapping.
.P
IF you entered a non-zero number of ranges to be treated
separately, then for each such range, enter the starting and
ending view number and the number of views that should be
grouped in that range. If a negative number of views is
entered, then reshoot sets will NOT be segregated from the
rest of the views in this range.
.P
Number of "reference" view whose magnification will be fixed at 1.0.
Enter "/" to accept the default, which is the view at minimum
tilt.
.P
0 to fix all magnifications at 1.0,
or 1 to vary all magnifications independently,
or 2 to specify a mapping of magnification variables
or 3 or 4 for automapping of variables; 3 for linearly changing
values or 4 for values all the same within a group
.P
IF 2 was selected, enter a magnification variable number for each
view. As for tilts, these variable numbers can be completely
arbitrary. The reference view (typically the one at minimum
tilt angle) will be constrained to a mag of 1.0; to constrain
any other views to a mag of 1.0, simply map them to the same
variable number as for the reference view.
.P
IF 3 or 4 was selected, enter default group size, number of special
ranges, and group size for each such range just as for tilt
variable automapping.
.P
0 to omit section compression,
or the number of the view to fix at compression 1.0 (something
other than a view whose tilt angle is fixed at zero.)
.P
IF compression is being solved for, next enter 1 to have all
compressions be independent, or 2 to specify mappings of
compression variables, or 3 or 4 for automapping; 3 for linearly
changing values or 4 for values all the same within a group
.P
IF 2 was selected, enter a compression variable number for each
view. As for tilts, these variable numbers can be completely
arbitrary. The reference view will be constrained to a comp
of 1.0; to constrain any other views to a comp of 1.0, simply
map them to the same variable number as for the reference
view. A View with tilt fixed at zero will automatically have
its comp fixed at 1.0 UNLESS you map it to another view whose
tilt is not fixed at zero.
.P
IF 3 or 4 was selected, enter default group size, number of
special ranges, and group size for each such range just as
for tilt variable automapping.
.P
0 to omit section distortion, 1 to include distortion and use the
same set of mappings for X-axis stretch and skew variables, or
2 to specify separate mappings for these two variables.
.P
IF 1 or 2 was selected, answer the next two queries either once
(for distortion variables in general) or twice (first for the
X-axis stretch, then for the skew):
.P
1 for independent variables, 2 to specify a mapping, or 3 or 4
for automapping. For X-axis stretch, 3 will make values be
all the same within a group and 4 will make values change
linearly (not recommended). For skew, use 3 for linearly
changing values or 4 for values all the same within a group.
.P
IF 2 was selected, enter a variable number for each view. The
reference view for magnification will be constrained to
distortion values of 0; to constrain any other views to 0
distortion, map them to the same variable number as for the
reference view.
.P
IF 3 or 4 was selected, enter default group size, number of
special ranges, and group size for each such range just as
for tilt variable automapping.
.P
Criterion number of standard deviations above mean residual error
that should be reported. This can be based on either the overall
mean and S.d. of the residual errors, or on a mean and S.d.
computed from points in nearby views. Enter a positive value
for a report based on overall mean, or a negative value for a
report based on the mean residual in the same and nearby views.
.P
0 to omit analysis of surfaces,
or 1 or 2 to derive a tilt angle offset by assuming that
points lie on 1 or 2 surfaces.
.P
"Factor", and limit on number of cycles, for the variable metric
minimization (METRO). "Factor" determines how large a step METRO
tries to take. The default for "factor" is 0.25, which typically
works even for large data sets. The
default # of cycles is 1000. When METRO fails for various reasons,
the program will retry with several other, nearby values
of the factor.
.P
IF transformations are being computed, next enter two more lines:
.P
Amount to shift the tilt axis in Z, relative to the centroid in
Z of the fiducial points, or 1000 to shift the tilt axis to the
midpoint of the range of Z values
.P
Amount to shift the tilt axis in X away from the center of the
image
.P
0 to exit, or 1 to do a series of local alignments. If you enter 1
to do local alignments, a series of entries is required to
specify the special parameters for local alignment, then a
series of entries to specify the mapping of variables. Entries
continue with:
.P
Name of output file in which to place transformations for local
alignment.
.P
Number of local patches in X and in Y in which to obtain a solution
from the fiducials located in that patch. These patches will be
aranged so as to cover the whole image area.
.P
Either the minimum size of each patch in X and Y (enter values > 1)
or the minimum fractional overlap between patches (values < 1)
.P
Minimum total number of fiducials, and minimum number present on each
surface if two surfaces were assumed in the analysis of
surfaces. A patch will be expanded about its center until it
contains enough points to meet both of these criteria.
.P
0 to solve for the X-Y-Z coordinates of the fiducials independently
in each local area, or 1 to fix them at their values from the
global solution
.P
Three entries to control the output of results for each local
alignment: 1 to output the values of the parameters for each
view or 0 not to; 1 to output the X-Y-Z coordinates of fiducials
or 0 not to; 1 to output points with high residuals, or 0 not to
.P
Finally, there are a series of entries just as above, to control the
mapping of rotation, tilt, magnification and distortion variables:
.P
0 to fix all rotations, 1 to have them all be independent, 2 to
specify a mapping of rotation variables, 3 for automapping with
linearly changing values, or 4 for automapping in blocks of
values. After this, enter mapping information as appropriate.
.P
0-8 to specify treatment of tilt variables, as described above.
After this, enter mapping information for tilt variables as
appropriate.
.P
Number of "reference" view whose magnification will be fixed at 1.0.
Enter "/" to use the view at minimum tilt.
.P
0-3 to specify treatment of magnification variables, as described
above. Then enter mapping information as appropriate.
.P
0 to omit section distortion, 1 to include distortion and use the
same set of mappings for X-axis stretch and skew variables, or
2 to specify separate mappings for these two variables. After
this, enter specifications for treatment of each or both sets of
parameters, just as above.
.P
.P
Note: when compression is solved for, the program prints both the
absolute and the incremental compression for each view. When no
compression is solved for, the program prints instead two additional
columns: "deltilt" is the difference between the solved and original
tilt angles, and "mean resid" is the mean residual error for each
view.
.SH FILES
Files generated by Tiltalign for use by other programs have the following
formats:
.P
The file with alignment transforms (option OutputTransformFile) contains one
line per view, each with a linear transformation specified by six numbers:
A11 A12 A21 A22 DX DY
.br
where the coordinate (X, Y) is transformed to (X', Y') by:
X' = A11 * X + A12 * Y + DX
Y' = A21 * X + A22 * Y + DY
.P
The file with solved tilt angles (option OutputTiltFile) has the angle in
degrees for each view, one per line.
.P
The file with X-axis tilt angles (option OutputXAxisTiltFile) has the angle
in degrees for each view, one per line.
.P
The file with Z factors (option OutputZFactorFile) has two numbers on one
line for each view, the displacement in X and the displacement in Y per
pixels of deviation in Z from the midplane.
.P
The file with all residuals (option OutputResidualFile) starts with a line
with the number of residuals to follow, then has five values per line for
each residual:
X Y Z X_residual Y_residual
.br
It can be converted to a model by running Patch2imod(1) with no special
options.
.P
The file with solved X-Y-Z coordinates (option OutputFidXYZFile) has one
line per 3D point:
fiducial_# X Y Z object_# contour_#
.br
The first line has, after these values, the pixel size and the size of the
image file that the alignment was run with:
Pix: pixel_in_Angstroms Dim: X_size Y_Size
.P
The file of local alignments (option OutputLocalFile) has a header line
with:
#_X #_Y X_start Y_start dX dY if_Xtilts pixel_Angstroms if_Zfactors
.br
where #_X and #_Y are number of patches in X and Y, X/Y_start are the
centers of the first patches in X and Y, dX and Y are the spacing between
patches in X and Y, if_Xtilts is 1 if there are X-axis tilts,
pixel_Angstroms is the pixel size of the image file, and if_Zfactors is 1 if
there are Z factors.
.br
Following the header is a block of data for each local area, where areas
progress in X then in Y. The data are all expressed as increments to
the global alignment information. The elements in each block are:
Tilt angles, one per view, many per line
X-axis tilt angles if they are included, one per view, many per line
Z factors if they are included, a pair of X and Y factors for each
view, several pairs per line
Refinement transformations for each view in the same format as above,
one per line
.SH HISTORY
.nf
Written by David Mastronarde, March 1989, based on programs ALIGN and
ALIGNXYZ (Mike Lawrence, 1982) obtained from R.A. Crowther at the MRC
5/19/89 added model output, changed format of output table
6/21/89 added mean residual output to find_surfaces, changed to
get recommendation on maximum FIXED tilt angle
4/9/93 allow full mapping of compression variables
10/30/95 added distortion, automapping, point & angle output.
10/17/98 added linear combinations to automapping
2/12/98 added local alignments; changed find_surfaces to find and
recommend an X-axis tilt.
.fi
.SH BUGS
Email bug reports to mast@colorado.edu.