Vous êtes sur la page 1sur 25

PIC Instruction Manual Appendix - Examples

Examples The following examples illustrate the use of PIC and its relation to specialized hardware. Many of the commands require the interactive specification of further parameters; the dialogue requesting such parameters (not shown here for examples 1-3) is designed to be self-explanatory. Brief Example Index Topic Description: Autocorrelation function (ACF) Averaging of images Background extension Center determination by regression Center translation Cross-correlation Difference Images Diffraction pattern Extraction of subarea Fourier calculations Fourier filtration General interpolation (bilinear) Inverting an image Linear superposition (Markham) One-dimensional plots Patching together two Rotational Power Spectrum Translational alignment Example number (not page number) 10 3,13 17 7,12 7,13 3 10,13 1,9,11 1,3,4,10 4,13,15 5,6,7,8 1,2,9,16 11 7,8 2 11 14 3,13

Example-1

PIC Instruction Manual Appendix - Examples

Example 1 Problem: Display a micrograph of an area containing several elongated particles and extract the area surrounding one such particle into a rotated coordinate system. The Fourier transform of this image is then computed, then reduced to its diffraction pattern for display on the video monitor. The contrast of the diffraction pattern is optimized. Finally, the displayed image is labeled with text.
RD MM RA BX GI MZ PA FF MD MM RA MA LA TR read max/min raster box interpolate mean zero pad fast Fourier modulus max/min raster manipulate label terminate read the .BP byte image file from disk determine highest and lowest pixel values display image on video display specify rectangular area surrounding particle of interest using the mouse extract particle image by interpolation giving desired orientation and scaling determine the image's mean and subtract it pad the array with zero's to make square calculate digital Fourier transform reduce transform to (half-plane) diffraction pattern determine maximum and minimum values display image on video display Note: if the other half-plane diffraction is desired, use IV 1, IV 2, then another RA to post at the appropriate location on the video monitor modify image look-up-tables to show the desired contrast label pattern with specified text PIC program

Example-2

PIC Instruction Manual Appendix - Examples

Example 2 Problem: We wish to extract a line across an interesting feature of a micrograph and display a plot of the density values along this line.
RD MM RA TB GI PL TR read max/min raster tablet interpolate plot terminate read the .BP byte image file determine maximum and minimum values display image on video display use mouse to locate designated points extract chosen line of points display plot of values on video monitor PIC

Example-3

PIC Instruction Manual Appendix - Examples

Example 3 Problem: Extract two particles from a large area; calculate and save their Fourier transforms, align the particles by maximizing their cross-correlation, then display the averaged particle structure after eliminating high-frequency noise.
RD TB WS TM FF WR RD FF XC FR MM RR TC 1 SU RF 5 FR MM RA read tablet write section trim fast Fourier write real read fast Fourier cross-correlate Fourier reverse max/min read real translate center sum radial filter Fourier reverse max/min raster Read the .BP byte image file Use the mouse to select parameters for subareas surrounding each particle (Alternatively, BX could be used to perform this function) writes a file for first particle leaving the "internal" PIC file intact trim the image (to generate the second particle); You could have used another WS followed by a RD calculate the fast Fourier transform (FFT) write the FFT on disk as FF.BQ real file read the file containing the first particle calculate its FFT cross-correlate with the second particle's FFT (giving the cross-correlation function) locates the position of its maximum read in the second Fourier transform bring this particle into alignment with the first one add the two Fourier transforms band-limit at specified spatial-frequency cutoff inverse transform of composite particle, now band-limited determine maximum and minimum values display image on video display

Note, an alternative newer approach would be to use the first 7 commands followed by:
TX SU FF RF 5 FR MM RA Transl & Xcor sum fast Fourier radial filter Fourier reverse max/min raster Translational cross-correlation add the two real space images calculate its FFT band-limit at specified spatial-frequency cutoff inverse transform of composite particle, now band-limited determine maximum and minimum values display image on video display

These commands are quicker, require less user input, but size of the images is limited to IX * IY must be less than or equal to ~135000 or 1/2 the size of the main PIC array. TX may not work for 512 x 512 images if the main PIC array is dimensioned 270000.

Example-4

PIC Instruction Manual Appendix - Examples

Example 4 Problem: We wish to read an image from file FILE1.BP, Fourier transform a 128 x 128 subarea taken from the top left had corner of the array, and then save the result in a file SUB1.BP. In this example all user input is included. User Input RD TM 1,1,128,128 FF WR PIC.LOG PIC MICROGRAPH DATA PROCESSING PROGRAM Version 15-DEC-1993 BEGIN INPUT AT 19:50:16 ON THE 23-JAN-94 >RD $INPUT READING FILE =herp.BP .BP = FILE1 from convert 256 256 TIME: 19:50:18 DATE: 23-JAN-94 FILE IN CORE :SIZE= 256* 256 < 0 0> NAME= 23-JAN-94ert / / ( 0) >TM ENTER COORDS OF NEW TOP CORNER AND NEW ARRAY SIZE 4I 1 1 128 128 TRIMMED TO 128* 128 >FF F.T. IN CORE >WR WRITE DK 3 WITH IX & IY = 130 128 IN CORE $OUTPUT WRITING FILE =sub1.BQ Description: The file to be read is file F1.BP FILE1 The required area is trimmed from the array Starting at the top left hand corner, the point (1,1) in the stored PIC array. The final array is 128 x 128. The Fourier transform is performed The transform is saved in file SUB1.BQ SUB1

Example-5

PIC Instruction Manual Appendix - Examples

.BQ = sub1 23-JAN-94ert >TR

FFT

Example-6

PIC Instruction Manual Appendix - Examples

Example 5 Problem: We wish to filter the Fourier Transform of an image stored in file FILE2.BP. The data has been roughly scaled, and only a rough filtration is needed. Detailed Command List:
RD FILE2 FF FL The file is read. Its size is 240 x 240 pixels and contains 10 x 10 unit cells approximately. The image is Fourier transformed. The square filter program is used to do the 10,10,3,3,5 filtration. The lattice constants are 10 x 10 since there are 10 x 10 unit cells in the array to be filtered. 9 (=3x3) sample points are taken through each filter 'hole' which is centered at the appropriate lattice points. Five orders are to be taken in each direction. The output from the routine is a filtered Fourier transform of the same size as the input array. The filtered Fourier transform is reversed Fourier transformed and the filtered image saved in file FILT.BP FILT

FR SV

PIC.LOG PIC MICROGRAPH DATA PROCESSING PROGRAM Version 15-DEC-1993 BEGIN INPUT AT 19:57:43 ON THE 23-JAN-94 >RD $INPUT READING FILE =file2.BP .BP = test 23-JAN-94ert 240 240 TIME: 19:57:46 DATE: 23-JAN-94 FILE IN CORE :SIZE= 240* 240 < 0 0> NAME= 23-JAN-94ert / / ( 0) >FF PIC Instruction Manual Appendix - Examples Example-9

F.T. IN CORE >FL ENTER X & Y LATTICE CONSTANTS,X & Y WINDOW SIZES AND MAX ORDER TO BE INCLUDED 5I
Example-7

PIC Instruction Manual Appendix - Examples

LATTICE CONSTANTS 10 10 : WINDOW SIZES 3 3 : HIGHEST ORDER= 5 FILTERED POWER IN THE SPOTS= 4.771 % ZERO ORDER= 1296. % : ( 0.3279915E+14, 0.2530788E+13) >FR REVERSE TRANSFORM IN CORE >SV WRITE DK 3 WITH IX & IY = 240 240 IN CORE $OUTPUT WRITING FILE =filt.BP .BP = filt 23-JAN-94ert OBJ >TR

Example-8

PIC Instruction Manual Appendix - Examples

Example 6 Problem: The user wishes to filter a file containing poorly aligned and scaled data, recovering as much information as possible and further improving the signal-to-noise ratio by selecting only the strongest diffraction spots for the reconstruction. For the purpose of this example, data will be generated using the CW function to allow the user to test the GF operation. Method: The file is read into PIC and then Fourier transformed. Due to poor scaling neither FL nor FC would be expected to work well, so the general filtering program is used. The filtered data is reversed transformed and displayed on the video monitor. Data may be generated as follows:
CW 80,80,5.,10 NR 1 30. 127. SV A CW 80,80,10.,5. NR 1 30. 127. SU 1.,1.,.5 A SV B Cosine wave 80 x 80 with a period of 5 in x and 10 in y Normalize the data to the range 0 - 255 average power (default) mean (default) Save test image in file A.BP Cosine Wave 80 x 80 with a period of 10 in x and 5 in y Normalize (default) (default) Sum together the two test images (default scaling constants) name of the file to sum with current PIC image Save the resultant test image in B.BP

Detailed Command List:


RD B MZ FF WR FF MD 0 MM RA RR FF The byte file B.BP is read into PIC The mean is determined and subtracted from the image. The image is Fourier transformed The Fourier is saved on disk ask FF.BQ The half-plane diffraction pattern is calculated. (use default - all orders) Determine max/min for scaling. Display the diffraction pattern and index (two) spots. Read back FF.BQ for filtration

Example-9

PIC Instruction Manual Appendix - Examples GF B 0 10,10,5,5,1. 5,5,10,10,1. -1 0 0 FR MM RA The general filter option is used to filter the transform. The File B.GF is created which contains the filter. The filter is typed in. first window second window cease input no corrections positive filter Fourier reverse (after filtration) Max/min for scaling filtered real space image Raster display (on the video monitor)

Note: In general, windows for GF will not be single matrix elements (not be a 1x1 window). An example of a real .GF filter that has been used is as follows: 11 29 5 46 23 17 35 11 5 0 12 29 6 47 23 18 35 12 6 1 -53 -35 -28 -17 -10 15 32 39 63 85 -45 -28 -21 -10 -3 20 39 46 70 91 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000

Example-10

PIC Instruction Manual Appendix - Examples

Example 7 Problem: The user has done a 1x1 unit cell filtration on his lattice, and approximately determined the location of his 6-fold rotation center. He wishes to refine this center of symmetry and to impose exact 6-fold rotational symmetry on the unit cell. 2x2-unit cell image is needed for display. Method: The location of the approximate rotation center is known, so CR can be used to refine the center. Once the refined center has been determined, TC 1 can be used to shift the center and FC used to impose the symmetry. LI is used to obtain the 2x2 unit- cells by for display purposes. Detailed Command List:
RD A CR 23.,39.,.5,3 1,5,6,2 ,,.25,3 0 ,,.1,3 0 0 TC 1 FC 1,1,10,2 2 0 6 1 LI 0 2,2 MM RA The file A.BQ containing the FFT of a single unit cell of the lattice is read into PIC Center Regression Guessed center (x,y), search step, number of steps Min and max orders, symmetry, lattice type New step, new number of steps same orders, symmetry, lattice type New step, new number of steps same orders, symmetry, lattice type no more steps (end of CR) Translate center according to that determined by CR Filter centers Lattice spacings, max radius, filter option Lattice type No points or weights 6-fold symmetry generate one unit cell Linear superposition Use single cell (default) Generate 2 cells in x and 2 in y determine min/max range Raster display of results on video monitor

Example-11

PIC Instruction Manual Appendix - Examples

Example 8 Problem: The user has produced a correctly scaled data array which he wishes to filter to produce a single unit cell, bandlimited to 5 Fourier orders. Method: The single unit-cell is generated using LI. This single unit-cell is band-limited with the filtering routine FL. Detailed command list:
RD A LI 30,30,10,10 0 FF FL 1,1,1,1,5 FR SV B The scaled image A.BP is read into PIC Linear superposition is the most efficient way to get the single unit-cell required. (default generates 1 unit-cell) FFT The FFT of the image is band limited to the 5 orders required. Fourier reverse Save the resulting image in B.BP

Note: Another approach would be to use FC after obtaining the Fourier transform of the entire area (with no LI). This is inefficient since a FF on a large array is more time consuming than a FF on a single unit cell. LI is an extremely efficient operation.

Example-12

PIC Instruction Manual Appendix - Examples

Example 9 Problem: The user is attempting to scale an array into a sample box that is 240x240, and wishes to check that the diffraction pattern of the array he has produced has improved somewhat over the last effort. Method: The raw data array is read and the new array is obtained from it by bilinear interpolation. FF is then used to obtain the Fourier transform needed to see how good the fit is after scaling. The compressed transform is saved, then the diffraction pattern is displayed as described previously. Detailed Command List:
RD A GI 240,240 4.,4.,100.,2.,2.,260.,1.,1.01 MZ FF TP WR DIFF MD 10,10 MM RA The raw data file is read. It contains a 300x300 array scanned so that 10 x 10 unit-cells of the structure approximately fit into a 240x240 area with the sampling lattice aligned with the real space lattice. The new array is now generated from the old one by bilinear interpolation of the old data. The real-space lattice of the structure was slightly skewed in both directions and this has been corrected in previous steps. The sampling scaling is now being carefully adjusted. Mean of the image is set to zero A Fourier transform is calculated. The total power is calculated to determine the accuracy of the GI. The higher the total power, the better the general interpolation. Save the results in DIFF.BQ Calculate the half-plane diffraction using 10 orders in x and 10 in y Max/min determined for scaling Raster display of the diffraction pattern

Example-13

PIC Instruction Manual Appendix - Examples

Example 10 Problem: The user has two STEM micrographs (on disk files) which have been taken of the same specimen, but in different conditions. The user would like to subtract the two images, form the autocorrelation function of the difference image to see if the noise has a significant structure, and display the results. Method: The first file is read into PIC. The difference is computed (and the second file read), followed by the Fourier transform. The FT of the autocorrelation function is then formed, and reversed transformed to yield the autocorrelation function. The final array is trimmed to display the central region around the origin of the autocorrelation function, which is displayed and saved on disk. Detailed Command List:
RD A SU B 1.,-1.,1. FF AU FR TM 65,65,128,128 MM RA WR AB The first file (A.BP of size 256x256) is read into PIC The first file is subtracted from the second (B.BP) and the difference image is Fourier transformed. The FT of the autocorrelation function is formed. and the ACF is then generated by reverse transforming it. The array size at this point is 256x256 (the same size as the original files). Therefore, the array can be trimmed to the central region of the ACF if desired. The maximum and minimum limits of the ACF are determined. and displayed on the raster video monitor for interpretation. Finally, the trimmed ACF is saved on disk as a real file AB.BQ.

Note: The FT has the origin at (1,1), but the ACF transform has its center in the center (ix/2+1, iy/2+1). If the phase shifting of the FT of the ACF is not wanted, then this can be canceled out by using the 'TC' command.

Example-14

PIC Instruction Manual Appendix - Examples

Example 11 Problem: The user has a computer generated half-plane diffraction pattern and would like to display the entire pattern on the raster video monitor. Method: The file is read and reflected in the x- and y-axes. The reflected file is then patched into the old unreflected file and the whole image is displayed. Detailed Command List:
RR IV 1 IV 2 PA 1 C 1,33 65,65 MM RA The file (C.BQ) is read into PIC; it consists of a diffraction pattern which is 65x33. Output from 'MD' consists of a half-plane diffraction. The half-plane is converted into the other half by first reflecting in the x axis and then in the y-axis. This (top) half is patched together with the bottom half in B.BQ (a carriage return shifts from .BP input to .BQ input here.) The two halves are put together so that the y zero order superimposes, and the final size is 65x65. Determine the max/min range of the full-plane diffraction Raster display of the results.

Comments: The example demonstrates how to generate full-sized diffraction patterns from half-plane patterns. The two sides are related by two reflections in the x and y axes. The use of the Patch command is also demonstrated. There is a new command PA 2 that was designed to start with a half plane diffraction and produce a full plane diffraction pattern. Detailed Command List:
RR PA 2 MM RA The file (C.BQ) is read into PIC; it consists of a diffraction pattern which is 65x33. Output from 'MD' consists of a half-plane diffraction. Generate whole plane diffraction pattern from 1/2 Determine the max/min range of the full-plane diffraction Raster display of the results.

Example-15

PIC Instruction Manual Appendix - Examples

Example 12 Problem: The user wishes to locate the center of symmetry of an object, which is thought to have 5-fold symmetry. The object has been viewed previously, and a rough center is available. Method: The data is read into PIC and the object is Pad-floated and centered in the array. The array is Fourier transformed and the phase center is moved to the center of the array. The FT is interpolated onto polar coordinates, and the center regression program is used to locate the center. Detailed Command List:
RD ABC PF 1 16,16,26,26,72,72 The file (ABC.BP) is read into PIC. The array is 50x50 centered at about 26,26 and is about 36 sample points across. The array is floated down using the rough edge option of PF so that the object, approximately centered, lies in a circle at the center of the array (37,37). The mean value of the surroundings has been subtracted and the array size increased so that the whole array is twice the size of the non-zero part of it. The Fourier transform is taken of the array and the phase center moved to the center of the array ready for the interpolation step. The FT is transferred to polar coordinates so that each radial sampling ring (10 of them) is divided into a multiple of 5 points. The radial sampling distance is one unit of the FT sampling distance, and this is fixed: finer sampling can only be gotten by increasing the original array size. The center search (polar) routine is entered and the search is begun around the point (1.,1.) in steps of .5. Five steps are made looking for 5-fold symmetry. After the first try the next cycle is made about the optimal center in steps of .1 samples. The final refined center is printed out after a carriage return ends this routine.

FF TC 37.,37 AI 5,10

CS 1.,1.,.5,5,5 ,,.1,.6,5

Comments: The procedure outlined in this example is best suited for a preliminary search, but there are numerous variations of it, which would be equally satisfactory. For example, the two cycles of search could be omitted and a single cycle performed on a finer grid. At the end of the routine the 'best' center found should be used to refine the center used in PF so that after one or two repetitions the windowing circle is centered on the optimal symmetry center. This condition is in fact very important since the asymmetric location of the windowing circle can degrade the final picture quality. In this example a circle with a hard edge was used; in fact, this may not be the best possible choice and the soft edge PF 2 may be better. A combination of the two is recommended (PF 1 followed by PF 2 later).
Example-16

PIC Instruction Manual Appendix - Examples

Example 13 Problem: The user wishes to align and average two images whose FTs are stored in .BQ files on disk. Method: The files are cross-correlated and the cross-correlation peak is located. One of the files is then translated, and the subtraction is performed. Detailed command list:
RR A XC B FR MM RR A TC 1 SU 1.,-1.,1. B WR C The first file's FFT is read into PIC its size is 122x120 in real space. The cross-correlation is performed between the first file (A.BQ) and the second file (B.BQ) which is read in the XC step. The FFT of the CCF is left in PIC after this step. The reverse transform of the CCF FT is performed. The CCF is now in the PIC array. The maximum value of the CCF is located and saved. The first file is read in again and its phase center is shifted to the location of the CCF peak. The second file is then subtracted from the first file (in Fourier space) and the results saved for later processing

Comments: This example illustrates one method of achieving alignment of two files. Note that alignment with XC is to within one pixel. An alternative approach would be to use TX or TX 1, which provides subpixel sampling. A further problem with the present example is that the translations are quasi-periodic, and often the exactly superimposed area must be trimmed out so that the wrap around edges may be thrown away. One way around this is to subtract the mean with MZ and pad with zeros as a first step. However, this approach has the effect of a sharp edge, and affects all the information in the file. PIC.LOG PIC MICROGRAPH DATA PROCESSING PROGRAM Version 15-DEC-1993 BEGIN INPUT AT 21:39:16 ON THE 23-JAN-94 >RR $INPUT
Example-17

PIC Instruction Manual Appendix - Examples

READING FILE =a.BQ .BQ = a 23-JAN-94ert FFT 120 122 FILE IN CORE :SIZE= 122* 120 < 0 0> NAME= 23-JAN-94ert / FF /FFT ( 0) >XC ENTER CENTERING FLAG I1 0 $INPUT $INPUT READING FILE =b.BQ .BQ = b 23-JAN-94ert FFT 120 122 FINISHED >FR REVERSE TRANSFORM IN CORE >MM MAX AT ( 5, 3) : MIN AT ( 118, 36) MAX= 0.1596536E+09 MIN= 0.1331857E+09 >RR $INPUT READING FILE =a.BQ .BQ = a 23-JAN-94ert FFT 120 122 FILE IN CORE :SIZE= 122* 120 < 0 0> NAME= 23-JAN-94ert / FF /FFT ( 0) >TC 1 ENTER COORDS OF NEW CENTER 2F7.2 # # 5.0000000 3.0000000 FINISHED >SU ENTER WEIGHTS FOR OLD (CURRENT), NEW, SUM, AND OPTION 3G,I 1.000000 -1.000000 1.000000 0 $INPUT $INPUT READING FILE =b.BQ

Example-18

PIC Instruction Manual Appendix - Examples

.BQ = b 23-JAN-94ert 120 122

FFT

FILES COMBINED 'SUM ' >WR WRITE DK 3 WITH IX & IY = 122 120 IN CORE $OUTPUT WRITING FILE =c.BQ .BQ = c 23-JAN-94ert SUM >TR The above commands can be simplified with the TX 1 or TX 2 command. TX 1 uses the TC 1 mechanism and provides integer alignment. TX2 fits a quadratic across the peak and provides real numbers in the alignment. Detailed command list:
RR B WR FF RD A TX 1 FF SU 1.,-1.,1. B WR C The second file's FFT is read into PIC its size is 122x120 in real space. and saved as FF.BQ The first image file is read in (not the FFT) Translational cross correlation shifts the first file to match the second file's FFT Calculate FFT of shifted A The second file is then subtracted from the first file (in Fourier space) and the results saved for later processing as C.BQ

Example-19

PIC Instruction Manual Appendix - Examples

Example 14 Problem: The user has obtained an image which may have angular (polar) symmetry. He wishes to produce a rotational power spectrum to determine the presence of such symmetry. Method: The data is read into PIC and converted to polar coordinates. The polar FT is calculated, and the polar power spectrum is calculated. Detailed Command List:
RD A AI 1,20 AF AM 5,15 1 0 The file (PPAVGS.BP) is read from disk containing the image. The image is angular interpolated into polar coordinates using the first 20 annuli and the FT formed from it. The angular power spectrum is calculated and the results typed on the terminal. Annuli 5 through 15 are used in the angular power spectrum. Dont save results over input array Option to change maximum to expand y-axis

PIC.LOG PIC MICROGRAPH DATA PROCESSING PROGRAM Version 15-DEC-1993 BEGIN INPUT AT 21:59:32 ON THE 23-JAN-94 >RD $INPUT READING FILE =ppavgs.BP .BP = ppavgs 2-JUL-85rom PRMEANA 50 50 TIME: 21:59:42 DATE: 23-JAN-94 FILE IN CORE :SIZE= 50* 50 < 0 0> NAME= 23-JAN-94rom PRMEANA/ / ( 0) >AI ENTER SYM, RADIUS, CENTER OF OBJ AND RADIAL SAMPLE DIST 2I5,3F8.2 1 20 26.00 26.00 1.00 INTERPOLATED ONTO 20 RINGS: SIZE= 80* 20 >AF ANGULAR FOURIER TRANSFORM
Example-20

PIC Instruction Manual Appendix - Examples

>AM .ENTER RANGE OF RADII 2I5 # # 5 15 $SAVE RESULTS IN ARRAY A? 0=YES 1=NO $MAX= 769.1 : ENTER NEW MAX: +TOTAL POWER SPECTRUM | * | * | * | * | * | * |* * |* * |* * |* * |* * |* * |* * |* * |* * |* * |* * |* * |** ** |******** |****************************************************** |---------|---------|---------|---------|---------|---$MAX IS= 769.1 : MIN IS= 0.6836E-03: CONTINUE? FINISHED >TR

Example-21

PIC Instruction Manual Appendix - Examples

Example 15 Problem: The user wishes to Fourier transform a large array stored on disk, padding it with a constant slightly, and keeping only regions around spots in the diffraction pattern. He then wishes to output the diffraction orders he has obtained for further study. Method: The problem requires only four commands, RD to read the image, PA to pad the array, FF to perform the Fourier transform, and OO to output the orders. Detailed Command List:
RD A PA 128,128,1,1,100. FF OO The image (A.BP) is read into PIC from disk. A is 100 x 100 Pad the array Pad to 128 x 128 with a 100's The FT of the image A is calculated. The specified orders are determined.

Example-22

PIC Instruction Manual Appendix - Examples

Example 16 Problem: The user wishes to optimize the scaling and alignment of a picture (of a 2-dimensional periodic specimen) prior to filtering it. The optical diffraction pattern has been used to previously decide upon a sensible sampling rate and to achieve a reasonable alignment of the lattice axes with the sampling raster of the densitometer (to within a few degrees). It is intended to work with a 240x240 array of tetragonal specimen, comprising 6x6 unit cells. Consequently, a file A.BP contains 260x260 array of raw data. Method: One uses bilinear interpolation GI to refine the scaling and refinement. However, there is no clear criteria which may be used to decide what is optimal, and to what lengths the user should go to achieve optimization. The present philosophy is that the benefits of exact sampling override the deterioration which interpolation may cause. Solution: The rough filtration of a 240x240 area is first obtained (see example 9). From the printout DP of the rough filtration, the user determines (subjectively) the centers of mass, or the coordinates of other equivalent positions in the top left, top right, and bottom left unit cells. These data are used to calculated the GI parameters which correspond to optimal alignment and scaling. Finally, a digital diffraction pattern of the optimized picture is a valuable check. The diffraction orders should lie exactly on or be distributed symmetrically about the reciprocal lattice, which in this case has a unit cell of 6x6 sample points. Explanation: A rough filtration is obtained as per solution to example 9. If it is displayed DP as follows: ------------------------->y | .(x1,y1) .(x2,y2) | | | .(x3,y3) x If the scaling and orientation had been perfect, then the following relations would be true: x1=x2

Example-23

PIC Instruction Manual Appendix - Examples

y1=y3 x3=x1+200 y2=y1+200 If not true, then we have to transform to a coordinate system where they are true using bilinear interpolation. Commands used:
RD A GI 240,240 x1,y1,xx,yy,yx,yy,sx,sy Read in A.BP from disk This option of 'GI' does not assume periodic continuation. The dimensions of the interpolated image is 240x240. The (1,1) point of the new array is at x1,y1 in the old array, in order to stay away from the edges. The values to be used for xx...sy are given by (xx,xy)=(10,10)+(x3-x1,y3-y1) (yx,yy)=(10,10)+(x2x1,y2-y1) sx=[(x3-x1)**2+(y3-y1)**2]**.5/200 sy=[(x2x1)**2+(y2-y1)**2]**.5/200 Save the rotated image in B.BP

SV B

Example-24

PIC Instruction Manual Appendix - Examples

Example 17 Problem The user wishes to pad an image with an average background value. The background is obtained by averaging a portion of the image. Commands used:
RD A TM 1,1,5,43 AV RD A FT 2 PA 1,1,512,512 SV B Read in A.BP from disk Trim out a rectangle that contains only background Determine the mean for the trimmed image Read in A.BP from disk Float image by subtracting mean Pad the image Save the new image in B.BP

Example-25

Vous aimerez peut-être aussi