edgemtf(1) edgemtf(1)NAMEedgemtf - Computes MTF curves from images of an edgeSYNOPSISedgemtf [options] image_file output_rootnameDESCRIPTIONEdgemtf analyzes an image of a vertically oriented edge and computes the modulation transfer function (MTF). The MTF is the Fourier trans- form of the derivative of the edge. The edge need not be perfectly vertical because the program will align the derivatives of individual lines across the edge. (In fact, the edge should not be perfectly ver- tical, in order to sample the full range of alignments between the edge and the pixels). Because derivatives could be noisy, the program usu- ally sums a few adjacent lines together before taking the derivative. The program proceeds as follows: 1) It sums the lines together as indicated by the -sum option. 2) It averages together the number of summed lines indicated by the -average option to form an initial reference. 3) It takes the derivative of each summed line and of the reference (the simple difference between successive values). 4) It aligns each derivative to that of the reference 5) It computes shifted lines and adds them together to make a second reference. 6) It repeats step 3, 4, and 5, ending up with a final sum of all aligned lines. 7) It takes the derivative of that final sum. 8) It takes the Fourier transform of that derivative and then takes the magnitudes of the Fourier components. 9) It averages successive sets of these magnitudes to obtain the MTF curve at the number of points indicated by the -points option. It averages the first few components and scales the curve so that the average of those components would be 1. This is not ideal. The program will put out a complete output file and an MTF file for each section suitable for use with Mtffilter. The complete file has three columns of data, where the first column is a type number. There are five kinds of output for each section: section_number frequency averaged MTF value 100+section_number frequency unaveraged scaled Fourier magnitudes 200+section_number X coordinate average of aligned lines 300+section_number X coordinate derivative from average of lines 400+section_number Y coord/sum alignment shift for each summed lineOPTIONSEdgemtf uses the PIP package for input exclusively (see the manual page for pip). The following options can be specified either as command line arguments (with the -) or one per line in a command file or param- eter file (without the -). Options can be abbreviated to unique let- ters; the currently valid abbreviations for short names are shown in parentheses.-input(-i)OR-InputFileFilenameInput file with images of edges. If this option is not entered, the first nonoption argument will be used for this entry.-rootname(-r)OR-RootNameOfOutputFilenameRoot of names for the output files. If this option is not entered, the second nonoption argument will be used for this entry. The complete output file will be named with this root plus ".out"; MTF files for individual images will be named with this root plus "-n.mtf", where n is the section number.-sections(-se)OR-SectionsStartAndEndTwointegersStarting and ending sections to analyze (numbered from 0). The default is to do all sections in the input file.-points(-po)OR-NumberOfPointsIntegerNumber of points to produce in the averaged MTF curve. If the curve appears irregular, reduce this value. The default is 20.-sum(-su)OR-SummingOfLinesIntegerNumber of lines to sum into each line for alignment and analy- sis. The default depends on the indicated binning: 3, 2, 1 and 1 for binnings 1, 2, 3, and 4. If data are particularly noisy, this number may need to be increased. However, if the angle of the edge is more than a few degrees, it may be necessary to reduce this number to 1 to avoid blurring the edge by summing without aligning lines.-average(-a)OR-AveragingForReferenceIntegerNumber of summed lines to average together to make the initial reference for aligning other summed lines. The default depends on the indicated binning: 2, 2, 2 and 1 for binnings 1, 2, 3, and 4.-components(-co)OR-NormalizationComponentsIntegerNumber of Fourier components near zero frequency to average together to normalize the curve to start at 1.0 for zero fre- quency. The default depends on the indicated binning: 4, 2, 2 and 1 for binnings 1, 2, 3, and 4. This number may need to be decreased if images are not very wide. If too many components are included, then the whole curve will be scaled too high, and the first averaged MTF value might even exceed 1.-binning(-b)OR-BinningOfImagesIntegerBinning of the images, used to select the defaults for summing and normalization, as described above for the -sum, -average, and -components options.-lines(-l)OR-LinesForReferenceMultipleintegersY coordinate of the middle line to use for making an initial reference. When the edge is very sharp, this entry allows you to specify a place where the edge falls most strongly between two pixels. The default is to take the middle coordinate in Y. If you use this option, you must enter a value for each section that is being analyzed.-cross(-cr)OR-CrossingValueFloatingpointThe program will report the frequency at which the MTF crosses below a particular value. This single number can be useful for comparing different curves that have similar shapes. The default is 0.5.-zero(-z)OR-ZeroDerivativeIntegerX coordinate beyond which to zero out the derivative. This option was apparently helpful for images that had a gradient on the right side.-param(-pa)OR-ParameterFileParameterfileRead parameter entries as keyword-value pairs from a parameter file.-help(-h)OR-usagePrint help output-StandardInputRead parameter entries from standard input.HOWTOGETACCDCAMERAMTFCURVETake an unbinned image of the beam stop in the microscope, gain normal- ized, with a high number of counts. You are only interested in the straight segment of the beam stop, so you can acquire a subarea that excludes unneeded areas. However, include at least as much white area above and below the beam stop as the width of this straight segment. Open the image in 3dmod and activate the Zap window rubberband. Draw the rubberband to encompass the good area of one edge of the beam stop in the straight region. Omit bumps if possible, but otherwise make the band as long as possible. Make it about 1 1/2 times as high as the width of the beam stop, and position it so that it is centered on the edge. Select File-Extract in the Info window to save this to a file (e.g., edge.1). Shift the rubberband with the second mouse button to center it on the other edge. Run File-Extract again to save to a second file (e.g., edge.2). Run header on each file to make sure they are the same size. header edge.1 header edge.2 If they are not the same size, put the smaller one first in the follow- ing newstack command, or specify a rotated output size with the -size option. Stack and rotate the two images: newstack -ro 90 edge.1 edge.2 edges.st Open the stack file in 3dmod and click on the middle of the edge. Open a graph window and zoom and/or stretch it until you can see the pixel steps easily (use the left and right arrows to step by pixels in X). Use up and down arrows to look at various points along the edge and see if it rasters between places where the edge falls sharply over one pixel, and places where it falls a lot over two pixels instead. A very sharp edge will show a variation like this, whereas unbinned images typically will not. If you see this kind of behavior, pick a Y value where the big falloff is over one pixel instead of two. You want a place where there is a step from one pixel at some distance below halfway up to the next pixel being the same distance above halfway up. You do not want a place where there is a pixel at a value halfway up. Watch where the red line cuts the curve as you go up and down in Y (shift with left and right arrows to keep the line near the center of the edge). Repeat this procedure to pick a Y value for the other sec- tion. If you don't see a variation in the falloff, just take the default of starting at the center in Y. If do see the variation but find all this too confusing, you can skip this step, since it makes very little dif- ference in the final curve even for a sharp edge. Run Edgemtf after picking an informative root name for the output (e.g. 200KV) edgemtf edges.st 200KV Examine the MTF curves to make sure they are sufficiently smooth and properly normalized, and to pick one side of the edge over the other. You could do this with any plotting program. To use Onegenplot enter onegenplot -ty 0,1 rootname.out The first curve will be graphed with circles, the second with crosses. If they are noisy you need to average more components (decrease the number of output points). To analyze at different binnings, just run, for example, newstack -bin 2 edges.st edgesbin2.st edgemtf -bin 2 edgesbin2.st 200KVbin2 The amount of summing and averaging is set based on the -bin entry, but if you had to change the defaults for the unbinned case, you will prob- ably have to do so for binned cases too.HISTORYWritten by David Mastronarde, late 1990's Added to IMOD, 6/3/11BUGSEmail bug reports to mast at colorado dot edu. IMOD 4.9.3 edgemtf(1)