Autocontouring Grid Squares Dialog
This dialog runs an autocontouring routine to make contours around grid squares at a particular threshold level. The contours are then sorted into groups by either their sizes or the mean intensity of the areas within them, and the groups are displayed in different colors on the image. Various criteria can be set for eliminating some of the contours, and groups of contours can also be toggled off. The contours that are still visible can be converted to Navigator polygons, with each group being a separate group of polygons.
A low-magnification map generally needs to be reduced in size for this operation, for two reasons: computational time is proportional to the number of image pixels (the square of the size) and will become prohibitive with large images; and, unreduced images can give more jagged contours. Computation time is reasonable with images in the range of 1500-2000 pixels, and grid square edges seem adequately defined when contouring is done in an image reduced so that the pixel size is ~2 microns. If you find that the contours do not follow the deatails of the square edges adequately, the remedy is to reduce less, to a bigger size and a smaller pixel size.
The program finds the threshold automatically by analyzing a histogram of image intensities, looking for two peaks representing the intensities of the grid bars and the unoccluded grid squares. A threshold is then set at a specified fraction of the way from the lower to the upper peak. This relative threshold generally needs to be higher than 0.5 to keep the contours inside the grid bars. The histogram analysis can fail, in which case the main recourse is to set an absolute intensity value as the threshold instead (although if the image is noisy even after reduction, it is possible that more reduction would make the analysis succeed).
Autocontouring uses IMOD model library routines that require byte input, so the reduced image is converted to bytes using the Black and White limits in the Image Display control panel.
Controls of Autocontouring
Reduce image to
Choose the first radio button to specify the reduction as a number of pixels (of linear size, not area; specifically, the geometric mean of the reduced image dimensions in X and Y). Shoose the second button to specify the pixel size in microns to which the image should be reduced.
Contour threshold
Choose Relative to set a relative threshold between the two peaks of the intensity distribution. Choose Absolute to set a specific intensity level for the threshold.
Range of sizes in microns
Enter the lower and upper limits for the square size, which will govern which contours are retained by the autocontouring operation. These linear sizes in microns are converted to pixels in the reduced image and squared to provide the limits on the number of pixels in a contoured area.
Make single contours by clicking in image
When this option is on and the dialog is open, you can add one polygon at a time by holding down the Ctrl and Shift keys and clicking inside of a grid square in an image with the middle mouse button. The autocontouring routine will extract and analyze a region ~10 times the maximum square size specified in the dialog, find the one contour that contains the clicked point, and make a polygon from it. All polygons added this way will be given a group ID specific to a given map. All of the parameters above this entry control the autocontouring, and none of the settings below it are relevant. No contour will be added if the point is already inside a relatively small polygon that is set either to be drawn or to be acquired.
Find contours only inside current polygon
Use this option to find contours within a restricted area defined by drawing a polygon. The option is enabled only when the current Navigator item is a polygon at least twice as large as the maximum square size specified in the dialog.
Autocontour Image
Press this button to run the autocontouring. It is multithreaded and can take several to many seconds, depending on the image size, number of contours, and how powerful the computer is. The processing can be stopped with the STOP button.
Clear Data
Press this button to remove all stored data about contours that were generated.
Controls for Working with the Contours
Split into groups
Select the number of groups to divide the contours into, and choose Size to have them order by size, or Mean value to have them ordered by mean intensity within the contour. The ordered contours will be divided into equally spaced, not equally sized, groups. Up to 8 groups can be selected. The colors used will be red, orange, yellow, green, dark blue, cyan, violet, and magenta. If you are displaying fewer than 8 groups and find the colors on the blue end easier to distinguish, you can use the Reverse Contour Colors menu entry to reverse the order of colors, starting from the magenta end.
Show groups
The checkboxes allow you to toggle the display of each group on or off and control which groups are converted to Navigator polygons.
Lower mean cutoff
Use this slider or the edit box to set a lower limit on the mean intensity within the grid squares to be displayed.
Upper mean cutoff
Use this slider or the edit box to set an upper limit on the mean intensity within the grid squares to be displayed.
Minimum size cutoff
Use this slider or the edit box to set a lower limit on the size of the grid squares to be displayed; the size here is just the square root of the area within the contour.
Irregularity cutoff
Use this slider to set an upper limit on a measure of how much the contour deviates from a square. The average angle of the lines between grid squares is determined, and each contour is compared with a square at that orientation and with the same area as a contour. The area within the contour but outside the square, plus the area within the square but outside the contour, is divided by the contour area. The measure thus ranges from 0 for a square to just under 1 for a long, thin contour.
SD cutoff
Use this slider to set an upper limit on the standard deviation of intensities within the grid squares. The SD is measured on the reduced image used for contouring, which is heavily smoothed by a Gaussian kernel filter with a sigma of 2.5 pixels. The SD should thus be dominated by the presence of larger structures within the grid squares, rather than by noise.
Edge distance cutoff
Use this slider or the edit box to set a lower limit on the distance of contours from the edge of the area where there are contours. Specifically, the value is the distance from the center of each contours to the convex boundary of the centers of all the contours; thus, the outermost contours are at a distance of 0.
Make Navigator Polygons
Press this button to convert the currently displayed contours to Navigator polygons. What you see is what you get. Only the groups whose checkbox is on will be converted, each group to a separate Navigator group. Only the contours not eliminated by the various cutoffs will be converted. The polygons will be given the same colors as the contours they came from, or they will all be green if you have turned off Keep Colors for Polygons in the Navigator - Montaging and Grids menu. After you convert a subset of contours, the remaining contours should still have the same group assignments. However, all contours will be reassigned if you change any of the selection criteria, so there may then be contours in the groups you just converted.
Note that if you are going to go on and acquire montages for many of these polygons and do not want to end up with one file per polygon, there is a mechanism available for consolidating the montages into a much smaller number of files. See New file at item and Properties of File To Open for details.
Undo
Use this button to revert the last conversion to polygons. This operation is available only if no additions or deletions from the Navigator table have been done, and new contours have not been made. Adding single polygons by clicking will disable the ability to undo a previous conversion. Each conversion is kept track of separately, so multiple conversions can be undone, in reverse order.