Navigator Align Setup Dialog

This dialog allows parameters to be set for the Align to Template task, which can be run either from a script command or from the Navigator during the Acquire at Items procedure.  A subset of these parameters govern whether image shift is reset after an alignment and are also used for the Realign to Item operation when it is run from Acquire at Items.  Another section of the dialog has parameters applied when using Realign to Item with a third round of alignment to a scaled-up area of the map used on the first round.  The top section has an option for disabling the automatic trimming of dark borders in these tasks, which is useful with gold foil grids.

A template is an image of some generic feature, like a hole in the carbon film, to which other images can be aligned.  Aligning to a template requires specifying two things: where the image is, and how to acquire an image for aligning to it.  Both pieces of information are provided by specifying a Navigator map image to use as the template.  Typically a template will be a small image, and the image to be aligned would be much larger.  To allow for this, a template map can be created with a special feature: the Navigator values for the map size indicate the size of the image to acquire rather than the size of the image itself.  This is possible within SerialEM by cropping the template from a larger image.  The program keeps track of the original size of the image, or montage piece, from which an image is cropped, and assigns this to the map size values when the image is made into a map.  This original, uncropped size is also stored in an '.mdoc' metadata file along with the other information about the acquisition conditions, so it is possible to reopen a file (even one from another session), reread the image, and make it a template map.

If you want to align to the template with images smaller than the typical full-field ones, you can acquire an image of whatever size you prefer and crop the template from that.  However, this should not be necessary if you specify an appropriate maximum distance for the alignment shift.  You can also use an uncropped image taken with a camera subarea, but this will constrain the size of the image taken for realigning to be the same size as the template, which may not work well if the image is not big enough to contain the entire feature of interest when it is displaced by the maximum allowed distance.

Disabling Trimming of Dark Borders in Alignments

The option in this section governs whether dark borders are automatically trimmed in two situations: the initial rounds of Realign to Item, including the possible realignment after resetting of image shift; and the realignment after resetting of image shift in Align to Template.  Trimming is never used in the first step of Align to Template, the actual alignment to the template image.  Trimming can give bad results with gold foil grids.  The option set here is the same as what is set in the third entry box of the Disable Dark Trim in Align menu item.

Parameters for Aligning to a Template

Label of Navigator map with template

The map to use is found by its label.  Enter either the label of an existing map, or the label you want to assign if you are going to make a map from a cropped image in buffer A.  The label should be unique.  The line below will indicate whether the item does not yet exist, whether an item withat label is not a map, or whether it is a montage map, which is not allowed.  The tests for whether the label exists are case-insensitive.

Make Map from Image in A

This button is enabled if there is an image in buffer A that has not been made a map yet (has no map ID value).  Press this button to make it a map.  If it is not saved to file yet and it is either a cropped image or cannot be saved to the current file, the browser for specifying a file name will open.  If the image can be saved to the current file, then you can choose whether to do so or to save it to a separate single-image file; in the latter case, the browser then opens.  The program will make a map and close the file if it opened one.  Then a dialog will open with a text box for setting the label of the map.  If you already had an entry in the Label text box above and there was not already an item with that label, it will offer that label.  Otherwise it will offer the automatically assigned label, which you are free to change, as long as what you enter is not the label of an existing item.

Maximum alignment shift

Enter the maximum shift in microns that will be allowed in the alignment to the template.  This should be less than half the center-to-center distance between adjacent features, to prevent the program from aligning on a feature farther from center than the likely target.

Parameters for Handling Image Shift after Alignment

Both Align to Template and Realign to Item have the ability to finish by resetting image shift if it is above a threshold, moving the stage to compensate, and restoring the alignment with a new image.  As the verbose lines in this section of the dialog indicate, the settings specified here are applied for both procedures: when running Align to Template from Acquire at Points, as defaults when running the AlignToTemplate script command, and when running Realign to Item from Acquire at points.

Reset image shift and realign if > D microns

Check the option to enable restting of image shift, and fill in the text box with a threshold in microns above which it will be reset after aligning to the template.  The realignment is done by aligning a new image to the previously acquired image, not to the template.

Reset IS up to N times

Set the spinner to the maximum number of image shift resets to do.  If image shift is still above the threshold after one reset shift and realign, the program will do another iteration, up to this limit.

Leave IS at 0 (skip last realign)

Select this option to leave image shift at zero and thus leave a little misalignment in the image.  This is accomplished by doing a final image shift reset when the image shift is below threshold (which might occur right after alignment to the template), and not realigning with another image.  This final reset counts towards the maximum.  If the maximum is 1, it will simply reset the image shift after aligning to the template, and not acquire another image.

Parameters for Realign to Item Aligning to Scaled Map

When aligning to a point marked on a map at a magnification lower than that to be used for acquisition, Realign to Item can do a third round of alignment at that higher magnification, taking an image there and correlating it with a scaled-up extract from the map.  The extract is rotated and scaled according to the pixel size and rotation angles provided by the various calibrations.  Since this transformation may not be optimal, the program can then search for a rotation and scaling that gives a better correlation, which will presumably result in a more accurate alignment shift.  If the calibration is sufficiently off, the search may be essential for the routine to work.  If you need a scaling or rotation range much bigger than the default, searches have a risk of failing, and it is advisable to improve the calibrations  After the procedure finishes, the actual higher-magnification image is in A, and the scaled-up, rotated extract is in B.  If there is much additional rotation or scaling as a result of the search, they will not line up since that additionally transformed image is not displayed, but it should be possible to see that the center is aligned.

Extra area for scaled reference

The scaled extract of the map will be the size of the image in A plus tan amount added to each side that is the fraction entered here times the field of view (FOV) of A, which is computed as the geometric mean of the sizes in X and Y.  The fraction also corresponds to the fraction of the FOV that the image in A can be shifted and still be fully overlapping with the reference.  Full overlap is good for maintaining correlation strength.  The shift will also be limited to this amount if it is 0.5 or higher.  Below 0.5, a shift of 0.5 times the FOV will still be allowed.  A larger value would be appropriate if the image has a good chance of needing a shift that large, but large shifts can be problematic if there are repeating structures that might be aligned to instead.  The initial default of 0.5 is a good starting point.

Maximum added size change to test

This entry sets the limits of the initial scanning step of the scaling search in percent; e.g., with 4%, the program tries scalings from 0.96 to 1.04.  It is best for this to be at least 1% more than the expected maximum percent change in size, because the refinement step of the search happens only if the best correlation is not found at the end of the initial range.  It should be a multiple of 2%, the current search step.  It is acceptable to enter 0, for no scaling search.  If you never change this value, it has a default value controlled by the property 'ScaledAliDfltPctChg', which itself defaults to 4%.  Once you change it, it becomes your setting and that property has no effect.

Maximum added rotation to test

TThis entry sets the limits of the initial scanning step of the rotation search in degrees.  It is best for this to be at least 0.8 degree more than the expected maximum rotation, because a more accurate interpolated rotation angle can be obtained only if the best correlation is not found at the end of the initial range.  It should be a multiple of 1.5%, the current search step.  It is acceptable to enter 0, for no rotation search.  If you never change this value, it has a default value controlled by the property 'ScaledAliDfltMaxRot', which itself defaults to 3 degrees.  Once you change it, it becomes your setting and that property has no effect.

Buffer to load and keep whole map in

The program needs to have the whole reference image loaded, and if it is a montage, it needs to be loaded unbinned.  For efficiency with repeated use, this image should be kept in a buffer not subject to being overwritten, i.e., not a rolling or other dedicated buffer.  If the program does not find the map in a suitable buffer, it will load or copy it to the buffer selected here.  The default is the highest buffer available.