midas(1) midas(1)
NAME
midas - manual image alignment for MRC files.
SYNOPSIS
midas [options] <image file> [transform file]
DESCRIPTION
midas allows one to assess and adjust the alignment between pairs of
images. It is typically used to align images from serial sections and
to correct errors in a pre-alignment of tilt series images by cross-
correlation. It can also be used to adjust the alignment between adja-
cent pieces in a montaged image. There are interactive controls for
adjusting translation, rotation, magnification (scale), and stretch
along an axis. Linear transformations are used to apply the transla-
tion, rotation or distortion. This means that the same amount of
translation, rotation or distortion happens everywhere in an image.
All transformation parameters can be adjusted by dragging a point on
the image with the mouse. The help menus describe the functions of
each mouse button, as well as the operation of the various controls and
hot keys.
Midas also allows one to adjust the brightness and contrast of each
image independently to ease comparisons. The program can produce a
copy of the image stack with these individual contrast changes applied
(but not with the transformations applied).
The input image files for midas must be MRC files. They can be byte,
integer, or real images, and can also be RGB images, which will be dis-
played in grayscale. The latter option can be used to align model con-
tours displayed on an image by snapshotting the Zap window in 3dmod
and creating a color MRC stack with tif2mrc.
Alignment modes
Midas maintains a list of transformations, one for each section in the
image file. At any given time, one section is the "current" section,
it is displayed with its transformation applied to it, and any adjust-
ments in alignment modify that transform. Another section is the "ref-
erence" section to which the current section is being aligned. Other
aspects of the way that transforms are treated depend on which mode
Midas is operating in: local, global, or reference.
In local alignment mode, each image section is usually aligned to the
previous section. The transformations in this mode are sometimes
referred to as "xf" transforms, which are suitable only for aligning
one image to another. The program xftoxg is used to convert xf
transforms into the "xg" transforms that are suitable for transforming
the whole image stack into alignment. In this mode, midas displays the
reference section without transforming it, and any changes in transfor-
mation are applied only to the transform of the current section.
In global alignment mode, each image section is effectively aligned to
the entire image stack. The transformations are of the global (xg)
type, ready to use to transform all of the images into alignment.
There are two differences in program operation that achieve this:
first, the reference section's transformation is applied whenever it is
displayed; second, when you modify the transform of the current sec-
tion, the transforms of all following sections are changed by the same
amount. Global alignment may be suitable for aligning small sets of
sections because of its simplicity. However, it is not recommended for
larger numbers of sections (more than 20-30). Local alignment followed
by the use of xftoxg is preferable because it will automatically
keep the aligned images from drifting out of the field of view. It
will also preserve trends in the data; for example, if you align using
features that gradually get smaller, global alignment may eliminate
this size change, while local alignment will preserve it, even if every
transform over the series includes a size change.
If you do want to use global alignment mode, you may want to start in
the middle of the image stack and work forward from there. Then, turn
off the "Keep Curr-Ref Diff" box, make the middle section be the refer-
ence again and make the previous section be the current section. Turn
the "Keep Curr-Ref Diff" box back on again and work backwards to the
beginning of the stack.
Reference alignment mode is used to align each image in a stack to a
single image that may be in another image file. The other image file
is specified with the -r option. In this mode, advancing or backing up
by a section changes only the current section; the reference section is
changed only by typing a new number into its text box. If your refer-
ence section happens to be in the same file as the images being aligned
to it, then you can either specify that file as both the reference and
the image file, or start midas in local alignment mode then turn off
the "Keep Curr-Ref Diff" box and set the reference and current sections
independently.
In global or reference alignment mode, a menu option can be used to
transform a model file using the transformations available for each
section, just as with imodtrans.
Storage of Transforms
The transformation for the current section is automatically stored on
the internal list of transforms when you change to a different section.
Before changing sections, you can restore the transform to the stored
value using an entry in the Edit menu. There are also menu entries to
reset to the unit transform (no translations, rotations, etc.) and to
store the current transform on the internal list. You can use the lat-
ter to save a transform that you like before trying to improve on it.
If the name of a file of transforms is entered after the image filename
when first starting midas, then midas will read transforms from this
file, and images will initially be displayed with these transforms.
This file then becomes the default file into which midas will save
transforms. Transforms can be saved into a different file with the
File menu entry "Save As". After doing so, that file becomes the
default file for successive save operations. In either case, the first
time that midas saves to a file, it will make a backup of an existing
file by that name by adding ~ at the end. If the name of a transform
file that does not yet exist is entered on the command line, midas will
create and save into that file.
Using Global Rotations
Midas can rotate all images by a common amount and allow you to adjust
transformations in the rotated images. This ability, invoked with the
-a option, can be used to make the tilt axis vertical when aligning a
tilt series. When the program is started in this mode, there is a con-
trol for adjusting the global rotation angle. There is also a check
box to constrain translations with the mouse to the X direction, which
is usually the only direction that needs fixing in a tilt series pre-
aligned by correlation. This rotation provides a convenient way to
look at tilted images but should not affect the alignment; the trans-
formations output by the program are independent of the global rotation
angle. However, the X and Y translations that are displayed and
adjusted in midas are relative to the rotated images and will change
with the angle. Global rotations can be used in local or global
alignment mode.
Aligning Chunks of Sections
Midas has another mode of operation that can be used to align tomograms
of serial sections. This is referred to as "chunk" alignment because
sections are considered in chunks, where a chunk corresponds to all of
the slices from one tomogram. In this mode, all of the sections in a
chunk are given the same transformation alignment, so there is only one
transformation per chunk. This mode is a variant of the local align-
ment mode, with the additional constraint that the alignment is always
between adjacent pairs of chunks. When adjusting the transformation
between a pair of chunks, you can view any pair of sections from the
two chunks, and you are also free to scroll through the slices in a
chunk to discern trends in position. Activate this mode by specifying
the number of sections in each chunk with the -c option. To get one
transformation per tomogram, do not divide the slices from the top and
bottom of tomogram into separate chunks.
Fixing Montage Overlaps
When the pieces of a montage need to be shifted into registration with
each other, blendmont uses the image displacements in the overlap
zones between adjacent pieces to determine how to shift the pieces.
Sometimes blendmont does not determine a displacement correctly, lead-
ing to erroneous registration of the pieces. To use midas to correct
the displacements, start midas with the -p option followed by the name
of the piece list file. After the montaged image file name, in place
of a transformation file, enter the name of the edge correlation dis-
placement (.ecd) file produced by blendmont. You can then display and
adjust the overlap between any pair of adjacent pieces on any section.
Overlap zones are referred to as edges and are of two types: X edges
between pieces in a horizontal row, and Y edges between pieces in a
column. X edges are numbered sequentially from left to right, first in
the bottom row, then in the next row, etc. Y edges are numbered from
bottom to top in columns, with the leftmost column being the first one.
The edge number controls, just below the section controls, allow one to
select any given edge, but it is more convenient to use the buttons
provided for selecting one of the four edges with the worst displace-
ment errors.
When two pieces are displayed, their X and Y translation values corre-
spond to the image displacement at that edge, originally measured by
blendmont and possibly adjusted within midas. The displacements for
all of the edges are used to determine the optimal shifts of the piece.
When these shifts are applied to the pieces, they produce displacements
at all of the edges, displacements that may or may not match the indi-
vidual displacements measured from the images there. A mismatch at an
edge is a displacement error, which has X and Y components. Large dis-
placement errors arise when the displacement measured at an edge does
not align the images there. Manually aligning images at an edge with a
large error will thus reduce the error there and also at other edges
involving the same pieces.
If there is only one edge with a mismeasured displacement, then solving
for the shifts using all of the other edges while leaving out the one
in question will often imply a perfectly good displacement at that
edge. The difference between this displacement and the measured one is
called the "leave-out error", and pushing the "Apply Leave-out Error"
button will adjust the edge to the displacement implied by all of the
other edges. If an edge shows a visible image mismatch that appears to
correspond to the leave-out error, then pushing this button is a useful
shortcut for aligning the images by hand.
One must be careful to examine both of the edges with the top two
errors when the erroneous edge involves a corner piece in the montage,
a not infrequent occurrence. In this case, the error will be equally
divided between the two edges of the corner piece, even though there is
an erroneous measurement at only one of them.
Finally, if the montage consists of only one row or one column, all
errors will be zero regardless of whether the displacements have been
measured correctly. Visual examination of the edges is the only way to
detect and correct errors in the measured displacements.
Options
midas accepts some Qt options (such as -style) and the following
options.
-g Start midas in global alignment mode. The default is local
alignment mode.
-r <filename>
Load a reference image from a file with the given filename.
This reference image can be used for aligning an image stack to
the single reference image.
-rz <section>
This option will select the section number to be used when load-
ing in a reference image with the -r option. The default value
is the first section which is numbered 0.
-c <list of sizes>
Determine alignment between chunks of sections. Enter a comma-
separated list of the number of sections in each chunk. The
list should add up to the total number of sections in the image
file.
-p <filename>
Load piece coordinates for a montaged image file from the given
filename and enter montage fixing mode. The final argument on
the command line must be the .ecd file produced by blendmont.
-C <size>
Set the cache size to the given number of sections. Sections
are read from the file as needed, intensity-scaled to be stored
as bytes, and kept in a cache. By default, the cache is limited
to about 128 megabytes. If your file has more than this number
of pixels, and you have more memory available, you can use this
option to provide enough cache for all sections. More impor-
tantly, if you have less than this amount of memory available
and your file has more pixels than there is memory, you should
enter an appropriate size to avoid disk swapping.
-s <min,max>
Scale the image intensities when reading from the file, so that
the range from min to max will be scaled to range from 0 to 255
when the section is stored in the program.
-b <size>
Set the initial size of the blocks for transforming the current
image. The larger the block size, the faster the display, but
quality will suffer, especially for images that are rotated sub-
stantially. A size of 0 will turn on image interpolation.
-a <angle>
Display all images with a global rotation specified by angle.
When the program is started with this option, the angle can be
adjusted if necessary with a spin box control.
-o <filename>
Save transforms to a file with the given filname instead of to
the file that transforms were read from.
-O <2 letters>
Specify the colors for the previous and current image in overlay
mode. The colors must be two of r g b c m y which stand for
red, green, blue, cyan (green + blue), magenta (red + blue), and
yellow (red + green). The two letters must specify different
channels; e.g., rc will work and rm will not. The default over-
lay colors are magenta and green (mg).
-D Run in debug mode, which means do not run the program in the
background.
-p Suppress reminder to rebuild edge functions when exiting after
fixing montage edges.
FILES
The transformation files that midas uses are in the following format.
The files are in ascii format with one line for each image in the image
stack. Each line contains 6 numerical parameters that are used to cal-
culate the linear transformation.
A11 A12 A21 A22 DX DY
Where for each pixel with the coordinates (X, Y) a new location (X',
Y') is given by the equations below.
X' = A11 * X + A12 * Y + DX
Y' = A21 * X + A22 * Y + DY
HISTORY
Midas (Manual Image Deformation and Alignment System) was first written
in Fortran for a MicroVax with Parallax graphics by David Mastronarde.
Jim Kremer then wrote a similar program in C for the SGI using first
IrisGL, then X-windows, then OpenGL and Motif. This was originally
named Midas, but was renamed to Manali after Mastronarde ported the
Midas program from the Vax to the SGI. For the next version of Midas,
Mastronarde modified Kremer's Manali to incorporate desirable features
of the old Midas (such as manipulation with the mouse), to implement
new features (such as caching, ability to zoom large images down, abil-
ity to read integer or real mode files, and treatment of a transform
file the way a model file is treated in 3dmod), and to provide com-
pletely new controls, menus, and help windows. In the latest version,
the graphical interface was rewritten in Qt.
SEE ALSO
xftoxg, imodtrans, newstack, blendmont, 3dmod,
tif2mrc
BUGS
Email bug reports to mast at colorado dot edu.
BL3DEMC 3.11.2 midas(1)