$goto label ("label" can be any label you choose)
...
$label: (This must be on a line by itself)
You can run a command file with the "subm" alias, which is defined in the
IMOD startup files:
alias subm 'submbg \!* &'
(An equivalent function is provided for bash users.) Submbg is a shell script
that will run one or more command
files in sequence, creating a log file for each and reporting on their
success or failure. It uses the program Vmstocsh to
converts a command file to a script that can be run
by the C shell, csh.
With this alias, you can enter, e.g., "subm track", and a file named
track.com will be executed in the background, a log file will be created
called track.log, and the bell will ring when the command file is completed.
You can also enter "subm track." or "subm xcorr.com prenewst".
If you need to interrupt a command file after you have started it, bring
it to the foreground with "fg", then used CTRL-C to interrupt it. If there is
more than one process in the background, give the command "jobs" first to
determine which one is the process in question, then use, for example, "fg %2"
to bring job 2 to the foreground.
1.3. Entries to Programs
The programs that you will run have many parameters or options to control
their behavior. There are two basic ways to enter these options: as arguments
on the command line after the program name, and interactively in response to
queries from the program after it starts. The first way follows the
conventions that are common for Unix commands, the most typical form being
command [options] input_file output_file
The [ ] around "options" signifies that this is an optional entry; this is a
common convention when summarizing how to invoke a program. Optional
arguments are usually single letters or abbreviations starting with a dash
(-). Some options must be followed by another entry, which could be a
filename, a single number, or a list of numbers. Other options stand on their
own, without an additional entry. Command line entries are finicky in that
they require spaces separating all of the elements, including a space between
an option and its value, and no embedded spaces in the entries. For example:
newst -sec 0-7,13-21 -xf images.xg images.st images.ali
Here the -sec option is followed by a list of section numbers (with no
embedded spaces), the -xf option is followed by the name of file with
transformations in it, and the last two arguments are the names of the input
and output files.
A program that takes command line arguments will almost always print a summary of its usage when you type in the program name with no arguments.
Programs that take entries interactively print out a query for an entry, accept a line of input, then go on to the next entry. In the command files used to run the tomography software, the answer to each query will appear on a separate line after the line on which such a program is invoked. When you look at the log file produced by running a command file, you will see all of the queries but none of the entries, because the entries are not echoed into the log file.
It may help to be aware of the underlying structure of the programs in the IMOD package. They are written in three languages: C, Fortran, and shell script language. The C programs take command line arguments. Most of the shell scripts also take command line arguments, the main exceptions being Copytomocoms, Setupcombine, and Makejoincom, which take inputs interactively. The Fortran programs, which are the predominant programs used for tomography, take inputs interactively. Some of them also take input and output filenames on the command line, particularly ones which need no other entries (e.g., Header and Fftrans).
Fortran programs have several conventions for numeric input:
Filename or other text entries do not follow these conventions for numeric input, and cannot be followed by comments on the same line in the command file.
Some Fortran programs accept lists of numbers for specific entries. Lists are comma-separated ranges of numbers, such as 1,3,6-9,12-10, which would enter the numbers 1,3,6,7,8,9,12,11,10. Lists follow slightly different conventions:
Yes, this presents endless possibilities for confusion. To reduce the
confusion, I'll at least refer to them consistently as "section number", "Z
value", and "view number".
1.5. Backup Files
Nearly every program that you run will create a backup file if an output
file already exists, rather than simply deleting the old version of the output
file. The existing file is renamed by adding a "~" at the end. For example,
when you run track.com, an existing copy of track.log is renamed to
track.log~. When you run the "newst" command given above, an existing copy of
image.ali would be renamed to image.ali~. This can lead to some large
unneeded files if commands are run more than once. It is helpful to have an
alias for purging backup files in your .cshrc: alias purge '\rm *~'
With this alias, "purge" will delete all backup files without asking for
confirmation.
2. NOTES FOR NON-BOULDER USERS
2.1. Film versus CCD Images
Some of the programs make a distinction between images from film and ones
acquired on a CCD camera. This is based on an obsolete method of
digitizing from film, in which tilt images were already in good translational
and rotational alignment after being digitized. In general, if your images
are already in fairly good alignment, treat them as data from "film"; whereas
if they will need a prealignment step, treat them as data from "CCD".
2.2. Image Scaling and Contrast Polarity
Some of the programs and command files assume that the numbers in your
images are linearly related to the number of transmitted electrons caught
by the detector. This is the case if images are recorded directly by CCD
camera or if film is digitized in optical density units. The logarithm of
such values should then be proportional to projected mass density for imaging
dominated by amplitude (aperture) contrast. Because of this, the command file
to run the backprojection program, Tilt,
contains an entry to take the log
of the numbers after adding a base value (which might correspond to the
fog level of film). If your images are already mass-normalized, you should
remove the "LOG" entry in tilt.com; if your images are in arbitrarily scaled
units, you may need to remove that line or at least adjust the base value
that is added before taking the log.
If electron density appears as white in your images,
Beadtrack will
fail to track your fiducials properly with the default settings in track.com.
Simply change the entry on the line ending in "0 for dark beads" from 0 to 1
in track.com.
2.3. Image File Header
As of IMOD 2.6.19, the
programs described here will work when the header of the raw MRC stack
indicates a "Pixel spacing" other than 1.0 or "Origin" values other than 0.0.
Earlier versions required the
pixel spacing to be 1,1,1 and the
origin to be at 0,0,0.
Check the header with:
header filename
If you need to change the pixel spacing or origin to conform to the old
requirements, run:
alterheader filename
enter "fixpixel" to fix the pixel size at 1,1,1, enter "org" and 0,0,0 to fix
the origin, and enter "done" to rewrite the header and exit.
3. PREALIGNMENT AND OTHER INITIAL STEPS
3.1. Getting Command Files
There is a program to provide you with a complete set of command files
for your particular situation; just enter
copytomocoms
No command-line arguments are needed; the program will ask you a series of
questions about whether you have a tilt series about one axis or two, whether
the data are from CCD camera or film, etc. The program works best if your
data files are already present in the directory where you will be working.
Before you run Copytomocoms, you may need to decide how tilt angles will be entered to Beadtrack, Tiltalign, and Tiltxcorr. There are 3 ways to enter tilt angles: by giving a starting and increment angle, by entering the list of all tilt angles into each command file, or by placing the tilt angles in a separate file, one per line. Data acquired on the HVEM with SerialEM have tilt angles in the file header, which Copytomocoms will offer to extract into a separate file for you. Otherwise, if a tilt series does not deviate from regular increments, the first way is fine; otherwise you will have to decide between the other two ways. For extensive tilt series, it's easier to use a separate file; you can probably find a nearly correct file in $IMOD_DIR/com. A file with raw tilt values should be named "setname.rawtlt".
You will also need to make an entry for initial rotation angle. This is the angle from vertical to the tilt axis in the raw images (e.g., if the axis runs from top left to bottom right, the angle would be 45 degrees). If the tilt axis is already vertical, enter a 0. If the tilt axis is horizontal, enter 90 to have the aligned images be rotated clockwise from their current orientation, or -90 to have them rotated counterclockwise. This will determine the orientation of the resulting tomogram.
You will also need to enter information about the size of gold fiducials. You can enter the pixel size and size of gold particles in nanometers, or just the size of the particles in pixels.
For a single tilt series from film, you will get copies of 7 command files:
If you have montaged files, you will get a blend.com instead of newst.com. This runs Blendmont, as will the sample.com. If the overlap between pieces was not very accurate when you digitized, you can choose to get a preblend.com to make an initial correction of these misalignments.
For a tilt series from a CCD camera, you will get two or three more files:
Finally, if you have montaged with SerialEM, you will get preblend.com instead of prenewst.com and blend.com instead of newst.com.
If you have a two-axis tilt series, you will get one copy for each series, with names ...a.com and ...b.com. For convenience, most command files will be referred to below by a name without an "a" or "b" (e.g., track.com), but in practice you will always be running an "a" or "b" version when you have a dual tilt series.
The man pages for the programs run by these command files give full details on their operation and on the meaning of the entries to each. Consult them for any questions on the options available in these programs.
Copytomocoms fetches the command files from $IMOD_DIR/com. If
something goes wrong, you can copy files from there manually.
3.2. Using Temporary or Insecure Storage
It is possible to have your small working files automatically saved to
another directory every time that you run a command file. This will provide
backup protection if you build tomograms in a disk area that is not regularly
backed up. To use this feature, first be sure that the directory where you
will do your work and the directory where files should be saved both exist.
Run Copytomocoms from the directory where you will build the tomogram. When
it asks about a directory to save small files into for backup protection,
enter the path to that directory. If your raw stacks are not located in the
current directory, the program assumes that they are in the backup directory
instead, and creates links to them from the current directory. In this way,
you can work in this directory just as you would in the original directory,
without having to copy or move the raw stacks. However, you may choose to
copy the raw stacks to the working directory if this gives significantly
faster access.
After every command file is run, the script "savework" will be run
automatically, copying files over to the source directory. You can also run
"savework" yourself at any time (for example, after working on a fiducial
model for a while).
3.3. Preliminary Steps for Images from a CCD Camera
1) If necessary, convert files from Digital Micrograph to a single MRC stack with Dm2mrc.
2) If there are extreme low or high values in your data file which ruin the contrast when you read the images into 3dmod, you should wipe them out with Ccderaser, which is run by eraser.com. See the man page for Ccderaser for details on how to specify the pixels to erase in a model file, which should be named "setname.erase". If the image stack is your only copy of the data, you might want to have Ccderaser make a new output file, and examine that file before replacing the original stack with the erased file. To do so, add a filename for such an output file in eraser.com.
3) Get a prealignment using cross-correlations. There is one option to decide on in xcorr.com. If your images are noisy and the camera did not do a good gain-normalization, then cross-correlation may find a spurious peak near zero instead of the real alignment. If this happens with your data, change the entry on the line "to exclude central peak due to fixed pattern noise" to 1. However, select this option only if you must, because with this option, the program will give an incorrect alignment for pairs of images that are already within a few pixels of being perfectly aligned.
4) Check the alignment by running prenewst.com and looking at the prealigned stack (setname.preali), or by running Midas and quickly looking at each pair of images in turn.
5) If there are serious alignment errors, which show up as a sudden jump
in features positions when movieing through the prealigned stack, run
Midas with the command:
midas setname.st setname.prexf
Go to each section pair that is not well lined up and shift the current
section with the left mouse button to fix the alignment. You may need to fix
only one section pair to bring your whole stack into alignment.
6) After fixing bad transforms with Midas,
run prenewst.com.
3.4. Preliminary Steps with Montaged CCD Images
If you have montaged images, the last three steps are a little different.
First, the xcorr.com file makes a blended image of up to 1024 pixels in size
to find the initial alignment. This file is setname.bl. If you need to use
Midas,
run it on this file rather than on setname.st. Finally, you use
preblend.com instead of prenewst.com to get the prealigned stack.
With montaged images, you should always check xcorr.log to see how well Blendmont was able to shift pieces into proper registration. For each section in the file, you will see a line giving the "mean, max error before ... after ...". These errors are the amounts of image displacement that Blendmont thinks are present in the overlap zones between adjacent pieces of the montage. The error before shifting the pieces around will generally be large. The error after pieces have been shifted into optimal registration should be small, less than 0.5 pixels. If it is large, then Blendmont was probably not able to measure one or more image displacements accurately enough. If this happens, you can adjust the measured image displacements by hand with Midas. You should definitely do this for a section whose maximum error exceeds 1, and consider it for sections with maximum errors greater than 0.5.
To fix displacements in
Midas, enter:
midas -p setname.pl setname.st setname.ecd
Select the Interpolate toggle button to visualize sub-pixel shifts properly.
Enter the section number of a section with a large error in the Current
Section text box. The control panel has push-buttons for the four edges with
the worst errors; use these to select the edge with the worst error. Toggle
between the two pieces to visualize the registration in the overlap zone. If
it looks bad, shift the Current piece into alignment (the Apply Leave-out
Error button can be a useful shortcut if this is the only piece with an error
-- see the
Midas
man page for explanation.) If the overlap looks fine, simply
go on to another edge; you will probably find the error there. This
potentially confusing situation may be quite frequent, because whenever a bad
edge involves a corner piece of the montage, its error is spread equally
between the two edges of that piece. It will thus look like there are two
equally bad edges when only one is bad.
After you correct the displacement at an edge, the push-buttons will rearrange and show new maximum errors. Once the maximum error is down to 0.3, you can go on to another section. When you are done, save the edge correlation displacement file and exit. Your corrected displacements will automatically be used when Blendmont is run again. However, you should have Blendmont build new edge functions on its next run, because the edge functions depend partly on the displacements that you just modified. To do this, modify preblend.com by changing the 1 to a 0 on the line "0 build new/1 read old edge function files."
It is important to correct these displacements before building the prealigned stack and modeling fiducials on it. When displacements are changed, image positions in the blended image change as well. If you have already modeled fiducials before correcting displacements, you should check the positions of all model points on the sections that were fixed.
If you have a montage consisting of a single row or a single column, the
reported errors are all zero, even if there are incorrect displacements. If
you suspect that there is a problem with some overlaps (for example, at high
tilt in a horizontal montage), your only recourse is to examine each edge in
turn in
Midas.
4. TRACKING FIDUCIALS
4.1. Getting a Fiducial Model
The first step is to set up a seed model. Run
3dmod on the stack
and pick a view near zero tilt that has good images of the
beads. Put one point exactly in the center of each desired bead (zoom up to 3
or 4 to do this accurately). Each bead should be in a separate contour;
Beadtrack
will try to extend each contour through the tilt series. Beads too
close to the edges are not trackable by
Beadtrack but could be tracked by hand
if necessary. Try to have at least 8 beads well distributed over the area.
The more beads you have, the better the alignment will be, up to a point, but
the longer it will take to run. If the beads are all on one surface, there is
not much point in having more than 12 or so; if they are on both surfaces, 20
or more may be useful. (If you will be using local alignments, see the
recommendations in
Using Local Alignments.)
Save the model with the extension ".seed".
Beadtrack proceeds from one view to the next, tracking as many beads as possible on the new view. Once it has bead positions on enough views, it runs a simplified tilt alignment to get improved predictions of where beads should be and to reject erroneous positions. Thus, there are several entries to Beadtrack that are the same as ones needed for Tiltalign.
Most standard entries to Beadtrack should work well. The radius for determining the center of gravity of gold particles is set to the actual radius plus 1.5 pixels, based on the entries that you made to Copytomocoms. Make the following changes to track.com:
Run the command file, track.com.
You can examine the log file to see how well the
tilt alignment did, but the program will end with a summary of which beads
could not be tracked completely. To see this, use
tail -40 track.log
If several beads fail to track past a particular view, you might want to
add that view to the list of views to be skipped and rerun the tracking.
At this point, read the new model into 3dmod
and activate the Bead Fixer
plugin under the "Special" menu. This will allow you to jump from one gap in
the data to the next and fill in missing points if appropriate. It is
acceptable for some of the points to be missing on some of the views. If too
few of the points can be extended all the way to the first or last views, you
can add some fiducials that are present only in higher tilt views. Just be
sure to add them on a substantial number of views, not just on a few, so that
their 3-D positions can be solved for accurately. If you do need to add
several fiducials, you could put some "seeds" into your edited fiducial model
and allow Beadtrack to track those beads as far as possible.
4.2. Getting Fiducials for a Second Axis
If you are doing a double-tilt series, at least some (8-10) of the beads
that you track must be the same in the two series. The shell script
Transferfid will help ensure this
by making a seed model for the second axis based on the fiducial model
for the first axis. To use this tool, first make a seed model for the
first axis, then run tracka.com.
It is recommended that you also run aligna.com
at least once before running
Transferfid so that the program
can make the most reliable estimate of how the fiducials will
correspond between the two series. You can do this even before fixing
the first fiducial model. Next enter the command:
transferfid setname
and the program will search for the pair of views in the two series
that correspond the best, then transfer the fiducials from the first
series to make the seed model for the second series. At the end, the
program indicates how corresponding fiducials should be specified when
setting up to combine the tomograms; make a note of this output.
If Transferfid fails to work
on the first attempt, you may need to set the translational and
rotational alignment between the two series manually with
Midas. Do this with the command:
transferfid -m setname
If the operation still fails, you
can run 3dmod
on both stacks at once and add some initial points to the second seed
model in the same order that they occur in the first seed model. It
is helpful to open one of the images in the Slicer window and rotate
it by 90 degrees with the Z slider. You
only need to make the first 5 beads correspond, or however many are
needed to sample beads on both surfaces, if beads are on two surfaces.
After that, you can add the rest in any order.
If
you do this, then when you prepare to combine the two tomograms, you would
specify that only the first 5 beads correspond.
5. GETTING THE FINAL ALIGNMENT
The goal of the final alignment is to transform the images so that they
represent projections of a solid body tilted around the Y axis, as well as to
refine the projection angles. In order to transform the images, one needs to
determine the rotation, translation, and scaling (magnification) to be applied
to each image. It is also possible to solve for variables which will correct
for distortions of the specimen.
5.1. Running Tiltalign
Whether you have fiducials on one surface or two determines what
variables can be solved for. If there are beads on only one surface, you can
solve for either tilt angles or stretch in the X direction but not both. If
there are beads on both surfaces, you can solve both for tilt angles and for
distortion, or for tilt angles and compression, but not for all three kinds of
variables.
You should first run Tiltalign with all tilt angles variable and no distortion; this will reveal bad fiducials, check for switched views and reveal some sudden changes in alignment that may need to be taken into account when grouping views together. After fixing fiducials, include distortion and group the tilt angles as appropriate.
For your first run, modify the align.com file as follows:
Run align.com and examine the results in the log file. The program Alignlog can be used to extract particular sections of the lengthy log file. For example, to see the solved parameters for each view, you can enter "alignlog -s" for a single axis data set or "alignlog -s a" or "alignlog -s b" for a dual-axis set. You may want to look at some of the fiducials with the largest errors, particularly ones with errors greater than 2 pixels ("alignlog -r"). Adjust point positions in the model, if appropriate. The Bead Fixer plugin allows you to look easily at the points with the greatest error.
Every time you run Tiltalign, it will analyze the bead positions and recommend a change in tilt angles that would make the beads lie in a horizontal plane. This information is in a section starting with "SURFACE ANALYSIS" that you can extract with "alignlog -a". Make the recommended change at least after the first run of Tiltalign by taking the final value shown for "Total tilt angle change" and using it for the value of "amount to add to all angles" in align.com. It is not necessary to do this repeatedly because the final tilt angle change will be determined in a later processing step.
In the section of Tiltalign's
output where it reports parameters for each
view (use "alignlog -s" to see), the last column ("mean resid") shows the mean
error (residual) in pixels
for all
of the points on each particular view. This information will reveal whether
some views give a poorer fit than others.
5.2. Background on Grouping Variables and Solving for Distortion
Examine the tilt angles (with "alignlog -s"), looking for places where
they change by unusual amounts. The column labeled "deltilt" shows the
difference between the solved
tilt angle and the original, nominal tilt angle. This column should change
gradually (except at reshoots), varying from one view to the next by only
0.1 to 0.2
degrees. Low tilt angles cannot be solved for as accurately, so variability
might be somewhat greater there, but should not be much greater.
Before you get into trying to solve for distortion and grouping variables, you should be aware of several points. First, the grouping of variables can be done in two different ways. In one way, the particular parameter will change linearly from the first view in one group to the first view in the next group, and will appear to change smoothly over the whole tilt series. This is referred to as linear grouping or linear mapping. In the other way, all of the views that are grouped will have exactly the same value for the particular parameter (except tilt angle, where the grouped views will differ from each other by fixed amounts). This is referred to as mapping in blocks. For every variable except stretch along the X-axis, linear mapping is now the "default", selected by the option number that you will find in the command file, because it gives a slightly better fit to typical data. In each case, mapping in blocks can be selected by increasing the option number by one (typically, from 3 to 4).
The second point concerns the nature of the distortion solution, a strange beast. Even if the only thing happening to the section is a stretch along the X-axis, solving for distortion will successfully account for these changes, but the resulting solution will not numerically reproduce the amount of stretch. The problem is that there is an infinity of equivalent solutions, which all account for the distortion equally well, but differ in the geometry of the resulting reconstruction. This geometric difference is a "strain", a shifting in Z proportional to the X value of a column of pixels. Without additional information about the section, there is no way to recover its true structure, and the actual amount of stretching that occurred. The program needs to pick one solution out of the equivalent ones, and it does so by eliminating one variable; thus you will notice a variable listed as "dummy" in the Tiltalign log file. Typically, this arbitrarily selected solution will change the most at high tilt angles, sometimes dramatically so, even though the actual changes in the section happen at a nearly constant rate through the series.
The distortion solution will also account for thinning when tilt angle is allowed to vary as well. The equations governing this situation dictate that the X-axis stretch change rapidly at the highest tilts, even if thinning occurs at a regular rate through the series. Thus, regardless of whether there is section distortion or thinning, or both, it is almost inevitable that the X-axis stretch will change most rapidly at high tilt.
The third point to be aware of is that group sizes will vary with tilt angle when using linear mapping. Group size for tilt angle will be proportional to the cosine of the angle, and will be set so that the average size equals the value that you specify for grouping. Because of the peculiar behavior of the X-axis stretch, its group size will change even more with tilt angle.
Finally, be aware that including distortion can lead the program into
inappropriate solutions, in which the tilt angle and the X-axis stretch covary
excessively. This can occur when there are too few fiducials, too great an
imbalance between the number of fiducials on the two surfaces, substantial
random errors in the locations of the model points, or a ratio of measurements
to unknowns that is too low. The potential remedies are to increase group
sizes, switch from linear grouping to grouping in blocks, solve only for skew
angle, or give up on solving for distortion.
5.3. Solving for Distortion - Fiducials on Both Surfaces
If you have fiducials on both surfaces, make the following changes to
include distortion:
You would want to pick the low end of these ranges of group sizes if an alignment run reveals that one of the distortion variables changes especially quickly (but don't be fooled by big changes for reshoots). Conversely, if the ratio of measurements to unknowns is lower than 10-12, you would want to make the default group sizes large. Start with the values that come in the command file.
The stretch variable ("dmag") will typically range from 0.001 to 0.02 but can easily reach 0.05 at high tilts. If you get values larger than 0.05, or if you get changes in tilt angle ("deltilt") more than 2 degrees, you should increase the group size and see if the range of values decreases, particularly if you have only 3-5 fiducials on the surface with fewer fiducials. If the range decreases substantially, stick with the larger group size. You can also increase the grouping for skew and tilt angles to try to get a better-behaved solution. If a solution seems unreasonable, either abandon the attempt to solve for distortion, or solve for skew angle only, as described in a few paragraphs.
The skew is an angle in degrees and will typically range from 0 to 1 degrees. Values greater than about 0.2 degrees are worth correcting for, and a change of more than about 0.3 degrees from one group to the next would be a big change.
If you have discovered that there is some sudden change in alignment such that two views should not be grouped together, then you need to specify some "separate ranges" for each of these entries. Suppose there is a big change between views 20 and 21. Then, for automapping the tilt angles, you would use "10,1" to specify default grouping of 10 and 1 separate range, then you would add a line with "1,20,10", so that views from 1 to 20 would be grouped separately with a group size of 10. Make similar entries for the distortion variables.
A good alignment has a mean residual error of 0.25 to 0.5 pixels, or more
for larger gold particles.
5.4. Solving for Distortion - Fiducials on Only One Surface
If you have fiducials on only one surface, you can't properly solve for
both tilt angle and distortion. If the section has thinned but not distorted,
then allowing the tilt angles to vary will correct for the thinning. If the
section has distorted but not thinned, then solving for distortion with fixed
tilt angles is appropriate. In reality, both phenomena occur, and section sag
and goniometer error make the tilt angles inaccurate so that fixing them
completely is almost always problematic. In any event, you should first try
solving for distortion and grouping the tilt angles in large groups (20 to
30). Make the changes described above with grouping of tilt angle by 25,
stretch by 10 and skew by 15. Run the alignment. Be very careful before
accepting these results - it is possible for tilt angle and stretch to
compensate for each other and give an artifactual solution. This would show
up particularly on reshoots - if their tilt angles are far off from the value
expected from the adjacent views, don't trust the result. Instead, do one of
the following:
Run align.com and examine the results. You can assess the results easily
with:
grep Residual align.com
The typical result has been that a global mean residual of 0.75-1 is reduced
to about 0.5 in the local alignments.
5.6. Excluding Views
Sometimes there are images in the original data that do not align well or
that have poor image quality, and that you want to exclude
from the alignment and reconstruction. This can be done by inserting a list
(comma-separated ranges) of view numbers on the line "list of views to
exclude" in align.com. The alignment solution will then be based only on the
rest of the views. However, the excluded views will still be included in the
final aligned stack, so it is important to enter the same list of views to
exclude in tilt.com to have them excluded from the reconstruction, as described
in the next section.
5.7. Residual and 3D Model Outputs
Tiltalign produces
a model of the positions of the beads in 3D, in a file named setname.3dmod.
If you indicated that beads should be on two surfaces, the
points will be assigned to two different objects in this model.
You can look at this file
with 3dmodv to check how well the
program sorted the beads into the two surfaces and to look at the
overall distribution of points.
Tiltalign also produces a text file
with the residuals for each point, and Patch2imod converts this into
a model of the residual vectors in a file named setname.resmod. You
can load this model into 3dmod on top
of the images, in place of the fiducial model, to look for patterns in
the direction of the vectors. The vectors are exaggerated in length
by a factor of 10. The start and end of a vector is marked by a green
and a red cross, respectively.
6. POSITIONING AND GENERATING THE TOMOGRAM
6.1. Getting a Trial Aligned Stack and Tomogram
To obtain a sliver of an aligned stack, run newst.com for a non-montaged
set or blend.com for a montaged one. Edit these files (the size entry in a
newst.com file, or the min and max Y values in a blend.com file) if you want a
sliver bigger than 10 pixels. After the first time that you run blend.com,
you need to edit and change the entry for "build new edge function files" from
0 to 1, unless you have run a preblend.com. Set this entry to 1 for every run
thereafter.
After you obtain and examine an aligned stack, modify the tilt.com file as follows:
excludelist list_of_views
where list_of_views should be the same list of views excluded in
align.com (be sure not to have any spaces in the list).
Examine the tomogram piece in cross-section with
3dmod. You will see that
you need to shift the section up or down. If you can't see both surfaces of
the section, either rerun Tilt
with a bigger thickness, or make a large entry
to "move the tilt axis in Z" in the align.com file (positive moves the section
up in the tomogram). Then rerun Tiltalign,
Newstack
or Blendmont,
and Tilt.
Once you can see both surfaces of the section, estimate how much you would
have to move the section to center it in the image. Set or change the "amount
to move tilt axis in Z" in align.com. If the section looks appreciably
tilted, you should also estimate the rotation needed to make it flat. A
positive slope means that all tilt angles should be changed by a positive
amount. Make this change in align.com and rerun this file.
6.2. Sampling 3 Areas of Tomogram and Positioning the Section Optimally
The goal of the next step is to shift and rotate your reconstruction so
that it is as flat as possible and will fit into the smallest volume. This is
done by sampling three regions of the tomogram, ones computed from near the
top, middle, and bottom of the tilt images. There are two rotations which can
be adjusted: the rotation about the tilt axis, to make the section level when
viewed in the X-Z plane; and a rotation about the X axis, to make the section
come out at the same Z height throughout the length of the tomogram. The
latter adjustment is optional since it involves more computation time and
requires more interpolations in the back-projection, which could conceivably
reduce resolution.
Check your tilt.com file before proceeding. Eliminate the "slice 1 5 1" statement if any. Make the thickness be about 40 pixels bigger than the estimated thickness of the section.
Now run the sample.com file. When it is finished, you will have 3 sample tomograms, bot.rec, mid.rec, and top.rec (or bota.rec, etc., for a dual-axis data set). You have two choices, automatically finding the section with Findsection, or modeling the edges of the section and computing angles with Tomopitch. Findsection is harder to use because it can give spurious results that need some judgement to filter out, so you may prefer to skip it completely and just use Tomopitch.
To use Tomopitch,
first load all 3 sample tomograms into 3dmod with a command such as:
3dmod top.rec mid.rec bot.rec tomopitch.mod
(use tomopitcha.mod and topa.rec, etc., for the first axis of a dual-axis
data set.)
Model each edge of the section by drawing a line along
the boundary in one of the slices for a tomogram sample.
Just use two points, one on the left and one on the right side
of the tomogram. Put the lines for the top and bottom edges in separate
contours. Use the "1" and "2" keys to switch between samples, and model
two contours in each sample in the same way. When you are done, the model
should have one object with six contours (two per sample), and two
points per contour. Save the model.
Next run tomopitch.com and examine the result. For each sample, there is an estimate of shift, rotation, and thickness, but your main interest is in the estimates based on all three samples. These appear at the end of the log file as four recommendations: the amount of tilt around the X axis, the amount to rotate the tilt angles, the amount to shift the tilt axis in Z, and the required thickness for the full tomogram. If the X-axis tilt is small (less than 0.4 degrees) and your tomogram is going to be small, don't bother with it, and use the recommendations before this tilt is taken into account. Otherwise, use the final recommendations. Note that there is one entry in tomopitch.com specifying the number of pixels to add to the tomogram beyond the surfaces defined by your lines. You may want to change this value in some special cases.
To use Findsection,
run findsec.com and examine the result. There should
be a thickness and location estimate for 5, 7 or 9 patches across each of the
three sample tomograms. If a few patches have widely divergent thickness
estimates, edit the findsec.com file to eliminate those patches from the final
calculations and rerun the program. (If there are more than a few such
patches, look at the 3 tomograms to see if there is some other problem.) The
end of the log file has the same four recommendations just described for
Tomopitch.
(Use the results from the "edge-thicknesses" unless you are
pressed for space or know better). If you have trouble with
Findsection, drop
back to using Tomopitch.
6.3. Doing Samples with X-axis Tilt or Local Alignments
It is possible to run samples of the tomogram with local alignments or
X-axis tilt taken into account. You might want do this for your initial
samples if your alignment solution indicates a large X-axis tilt, or you might
want to check the samples on a second round after correcting for X-axis tilt
as above or after introducing local alignments. In order for
Tilt to compute
such a portion of a tomogram correctly from a subset of an aligned stack, it
needs to know the starting coordinates of the subset. Tilt.com has a line
"subsetstart" to enter these coordinates, but you do not need to change this
line if you are running sample.com, because sample.com substitutes the correct
values. To get samples with these features, modify tilt.com by entering the
desired X-axis tilt, and/or adding a line with the name of your local
alignment file, i.e., add
localfile setnamelocal.xf
Run sample.com. If you do this on your initial run then make models and run
Tomopitch,
be sure to ADD the recommended X-axis tilt to the value already
applied in tilt.com.
With X-axis tilting, the first and last few slices in each sample may
have incomplete data. You may need to increase the number of slices
to get usable samples. To do so, edit sample.com and, for
non-montaged data, increase the "-size" argument for all three "newst"
commands. For montaged data, increase the "max Y coordinate" entered
into each of the three runs of
Blendmont.
6.4. The Final Runs
Based on these recommendations from
Findsection
or Tomopitch, modify align.com to
incorporate any additional rotation of tilt angles or shift of the tilt axis in
Z (positive recommendations are added to existing values). Rerun this command
file.
Modify your newst.com or blend.com to make a full-sized aligned stack by putting a ,, or the full image size for the "size" entry in newst.com or a / on the "Min and max X..." line in blend.com. Run this file to get the aligned stack. Check the aligned stack or a 100-pixel swatch of it.
Modify your tilt.com file to incorporate the recommended thickness, and
the X-axis tilt, if you opt to use that. If you did local alignments, also
add a line to the file with the name of your local alignment file, i.e., add
localfile setnamelocal.xf
Run tilt.com.
7. COMBINING TWO TOMOGRAMS
To combine two tomograms, you run combine.com, which is a master
command file to run
a series of other command files. All of these command files are
generated by running Setupcombine.
The main programs or shell scripts being run, and the essential
steps are:
If you have
a relatively thin sample, you should be aware that Setupcombine may
decide to compute only one layer of patches, in which case the second stage
of alignment will not stretch the data in the thickness dimension.
This is generally appropriate, but you may wish to change this
by editing patchcorr.com to specify two layers of
patches. Adjust the size of the patches in the thickness dimension
if necessary so that it
is at least 30%
smaller than the range allowed for the patches in that
dimension. This dimension is referred to as Y in patchcorr.com.
7.2. Using Temporary Storage for Combining
It is possible to use temporary disk space when combining two tomograms;
this is useful if you want to run the combine operation on a machine different
from the one where the two tomograms are located. Combining creates a large
number of temporary files, and considerable time can be saved by placing these
files on a local disk instead of writing and reading them across a network.
To use this feature, enter the name of a temporary directory (/tmp, /usr/tmp,
or other appropriate scratch directory) when Setupcombine asks if you want to
use one. Whatever directory you specify must exist already. Then select
either auto-cleanup or hand-cleanup. Auto-cleanup will build the final
sum.rec into the current directory and remove all temporary files at the end.
Hand-cleanup is provided if you want the fastest possible access to sum.rec or
if you want to examine the setname.mat file. With this option, sum.rec is
built in the temporary directory and a link is provided to it from the current
directory.
When Setupcombine exits, it indicates the name of the directory that it
will be using. You can look there to monitor the progress of the operation.
(That is where the setname.mat and sumxxx.rec files are built.) If the
combine operation crashes and has to be restarted, it will use the same
directory. However, if you have to rerun Setupcombine, the new combine.com
will create a new temporary directory.
7.3. Proceeding
Run Setupcombine. After this, there should be nothing to change
in any of the command files,
unless you have special needs based on prior experience.
Make sure that the "....tlt" and "...fid.xyz" files produced by Tiltalign are still present.
Check free disk space (df -k). Typically, you need 3 times as much free space as one tomogram occupies; Setupcombine provides a more accurate estimate. You may need to delete the aligned tilt series (and archive and delete raw tilt series) before proceeding.
Run combine.com. You can monitor the status of the combine operation
by checking the combine.log file, or the log files for the individual
steps.
Once it starts running
volcombine.com, you can check the progress easily by
entering
grep STATUS volcombine.log
When the combining is done (or sooner, if the tomogram is large),
check the matchorwarp.log file to see how good the registration between the two
volumes is. After Patchcrawl3d
runs, you
will see Refinematch's
report on the mean and maximum deviation at the various
locations after applying a single linear transformation. Then there will be
either a message that Matchvol
is being run, or a message that warping is
needed. In the latter case, Findwarp
may run several times; just above a
message that Warpvol
is being run next will be a report on the mean and
maximum of the mean residuals. If the mean is reasonable but the maximum is
quite high (1 or more),
you should look at the patch vector model (patch_vector.mod)
and consider whether to take any of the remedial
actions described below.
7.4. Initial Registration Problems in Combining
If combine.com fails right away, this is probably because of a bad
correspondence between fiducial points.
Solvematch can eliminate some bad
points, but if it fails to do this, and there is a maximum residual greater
than 10-20, you should change the entry to Solvematch for corresponding points
so that it specifies only a few points which you are sure correspond.
For a large
volume with serious distortion between the two tomograms, the residuals in the
fit can be high even if there is no error in correspondence; in this case, you
should just increase the "limiting value for maximum residual" entry to
Solvematch and proceed.
It is possible that Matchshifts
will fail to find the proper shift
between the two tomograms, if the displacement between them is particularly
large. To check for this possibility,
Matchshifts produces two small
volumes just adjacent to the ones it used to determine 3D
displacements, and uses cross-correlation to find the shift between
them. If this shift is too high, the combine processing stops. You
should then look at the two volumes with
3dmod -Y matchcheck.rec matchcheck.mat
to see whether the volumes differ in position by just a few pixels or
are very different. If the position is close, edit combine.com to
comment out the
two lines referring
to solvematchshift.com (the "echo" and "vmstocsh" lines) and rerun combine.com.
If the check volumes do not match up, then
Matchshifts failed, and you have to
make models of corresponding points by loading both tomograms into 3dmod with
-Y. Make two models, "setnamea.matmod" and "setnameb.matmod", containing 3-5
corresponding points, as described in the man page for
Solvematch. If you are
marking gold particles, put the model point on the section with the strongest
white side bands around the black bead. Edit combine.com to comment
out the two lines referring
to solvematchshift.com (the "echo" and "vmstocsh" lines),
and uncomment the two corresponding lines referring to solvematchmod.com.
Rerun combine.com.
7.5. Patch Correlation Problems in Combining
If combine.com exits because neither
Refinematch
nor Findwarp could find
a fit to the patch displacements with a sufficiently low mean residual, then
there are several possible reasons. The patches could be too
small, leading to widespread random errors. There could be local regions in
the volume where a relatively high proportion of patches have large errors, a
situation that the outlier elimination algorithm in
Findwarp cannot handle.
Finally, there could be inaccurate displacements only along one or more edges
of the volume. To assess this situation, the first step is to
examine the model of the patch displacements in patch_vector.mod.
This model shows each displacement as a line whose
length is 10
times the actual length of the displacement. To allow editing of this model,
display the model without images in the Zap window using
3dmod patch_vector.mod
then open the model view window with "v". Spin the model slowly and zoom as
needed to see the pattern of displacement vectors.
1) If there are many lines that do not fit the pattern of surrounding lines, scattered around the whole volume, then you should rerun Patchcrawl3d with larger patches. Modify the first three entries on the Patchcrawl3d command line in combine.com. A 25% increase in each dimension is recommended, as this will double the volume of the patches and substantially improve accuracy. Uncomment the "goto patchcorr" entry at the top of combine.com and rerun the command file.
2) If displacements generally look fairly regular but there are a large number of bad patches in well-defined regions, it may be easiest to make a model with contours enclosing the regions with good patches, or to modify such a model if you have already made one. To do this while looking at the patch vector model, you would have to load the tomogram being matched to into a separate 3dmod and make or edit the boundary contour model there, while trying to correlate positions between the tomogram and the patch vector model. If you do make a new model of boundary contours, add the entries "-modelfile" and the model filename right after the "matchorwarp" line in matchorwarp.com. With either a new or a modified model, uncomment and change the "goto" entry to be "goto matchorwarp" at the top of combine.com and rerun combine.com.
3) If bad patches are fairly scattered and not too numerous, it is most
appropriate to edit them out. To do this, position the mouse on an aberrant
vector in the model
view window and press the third mouse button to select
this contour in the Zap window. If you have any doubt about which contour you
selected, use the [ and ] hotkeys in the Zap window to examine the
starting and ending points of the contour. The starting point will be at a
regular position in the array, while the ending point should be
displaced by an unusual amount.
Delete the contour with the "D" hotkey in the Zap window;
it will disappear from the model view
window also. When finished, save the model and exit. Then run
Imod2patch:
imod2patch patch_vector.mod patch.out
You may want to rename the existing patch.out before doing this. Uncomment
and change the "goto" entry to be "goto matchorwarp" at the top of
combine.com and rerun combine.com.
4) If the patch vector model indicates that bad patches are numerous near
edges of the volume, next explore whether omitting
a whole column or row of patches will give an acceptable fit to
the remaining patches. To do this, run
Matchorwarp
in trial mode by editing matchorwarp.com and inserting the argument
"-trial" on the "matchorwarp" command line. Also insert one or more
arguments such as
"-xlower 1," or "-zupper 2" to exclude one column of patches on the
left or two rows of patches on the top. Be sure to place any added
arguments before the continuation mark, "\". Run this command file with
subm matchorwarp
and examine results in matchorwarp.log.
Do this repeatedly to assess different row or column exclusions.
If you find an exclusion that gives a good fit, and the excluded area is not
a critical area where you would expect a better fit, then proceed with this
exclusion. Remove the "-trial" argument from matchorwarp.com, uncomment
and change the "goto" entry to be "goto matchorwarp" at the top of
combine.com and rerun combine.com.
5) Sometimes the lowest mean residual that Findwarp is able to achieve (the last message in matchorwarp.log saying "Findward failed to find a warping with a mean residual below") is actually an acceptable value, just a bit higher than the highest acceptable mean residual specified in matchorwarp.com. If this is the case, just change the highest value in the "-warplimit" argument in matchorwarp.com to be higher than the value shown in this message. Uncomment and change the "goto" entry to be "goto matchorwarp" at the top of combine.com and rerun combine.com.
6) If all else fails, it may help to run
Findwarp
interactively. This will allow you to explore omitting
columns or rows of patches as well as select the number of patches that will
be used in each local fit.
See the man page for
Findwarp.
When running the program, examine results with
transformations based on various subsets of patches, but no fewer than 3 by 3
by 2 or 4 by 2 by 2. Try to retain all of the rows and columns if possible.
Use the largest subset of patches that will give a mean residual error under
about 0.2 pixels. Save the transformations in a file named warp.xf.
Uncomment and change the "goto" entry to "goto warpvol" at the top of
combine.com, uncomment the "vmstocsh" line that runs warpvol.com, and rerun
combine.com.
8. POST-PROCESSING
8.1. Scaling and Trimming a Tomogram
Trimvol is a single tool for
trimming a volume and converting it to
bytes. It can run Findcontrast
to find optimal contrast settings for
converting it to bytes, and runs Newstack to make the final byte file. If you
simply convert a tomogram to bytes without a contrast setting, then the
contrast range for features of interest can be quite compressed and it can be
difficult to adjust contrast for viewing in 3dmod. You can avoid this problem
by saturating the intensities of gold particles (and other irrelevant features
like stain precipitate) when converting to bytes. These instructions assume
that your final tomogram is from a dual-axis series and is named "sum.rec".
First, load sum.rec into 3dmod with -Y and determine the starting and
ending slices of a range that excludes features whose intensity can be
saturated. Findcontrast will ignore areas within 10% of the edges of these
slices. If you want to trim the volume, note the first and last section that
you want to keep, as well as limiting coordinates near the left, right,
bottom, and top edges if you want to trim the lateral size of the volume. All
of these number can be 3dmod coordinates, numbered from 1. For no trimming,
just enter
trimvol -s start,end sum.rec setname.rec
where start and end are the starting and ending slices for finding contrast.
In the most general case, enter
trimvol -s start,end -x left,rt -y first,last -z bot,top sum.rec setname.rec
where first and last are the first and last sections, while left, rt, bot,
and top are the limiting coordinates on the left, right, bottom, and top of a
section in the flipped tomogram.
If the automatic contrast limits are unsatisfactory, you can determine
contrast settings in 3dmod by moving both contrast (Black and White) sliders to
the same position. While movieing through the data, adjust the positions of
both sliders together until only the gold beads (and other irrelevant
features) show up as black pixels; this slider value is the lower contrast
limit. Then adjust both sliders so that only the overshoots around the beads
show up as white pixels; this slider value is the upper contrast limit. Enter
trimvol -c black,white sum.rec setname.rec
Finally, you can also use the "-yz" flag to Trimvol to flip the tomogram, so that you no longer have to load it into 3dmod with -Y.
If your images were acquired on a CCD camera with limited spatial
resolution, you may be able to reduce the size of the final volume
considerably with no perceptible loss of image detail. The shell script
Squeezevol
provides an easy interface for scaling a volume down by
interpolation using
Matchvol. Since resolution is worse in the direction
perpendicular to the plane of the section (the Y direction in an unflipped
tomogram), it could be appropriate to squeeze the volume more in that
dimension. For example, if the CCD camera provides no useful information
above 0.8 of Nyquist, an overall reduction by 1.25 would be appropriate,
and a reduction 1.3 times higher in the Y dimension would also be appropriate
given the extra point-spread in that dimension in a tomographic
reconstruction. The size of the volume can be reduced by a factor of 2.5
with:
squeezevol -f 1.25 -y 1.62 setname.rec setname.sqz
Note that if you have already flipped the volume, you would use "-z"
instead of "-y". If you choose anistropic squeezing, you need to
increase the Z-scale that you use for viewing models built on that
volume
by the amount of extra squeezing in that dimension. For example, if
you usually have a Z-scale of 1.6, you would need a Z-scale of 2.07
after the squeezing operation shown above.
8.2. Cleaning Up
Cleaning up your files is very important! If you do want a copy of one
of the tilt series, reduce it to bytes and float the intensities with:
newst -mo 0 -fl 2 setname.ali name_of_tilt_series_file
after this, you can remove *.ali files.
Once you are satisfied that your final tomogram is truly final, you can remove the following big files:
sum*.rec setnamea.rec setnameb.rec setname*.matIf you ever have to rebuild the tomogram, it is helpful to keep all of the files except .log files. For future reference, you may want to keep the align.log files, possibly the findsec.log files, and combine.log. All of these files can be put on tape or CD with the raw image stacks, or on an optical disk.
Finally, archive and delete the raw image stacks. The shell script Splitmrc can be used to divide a very large MRC file into pieces that will fit on multiple CDs; Recombine can be used later to put the pieces back together.