([winsiz],[xover],[yover],[xd],[yd],[radius]) ; ; PURPOSE: Computes power spectrum. Called from: power.spi ; ; SOURCE: power_p1.spi FR ?micrograph image?[mic] FR ?pw_avg?[spectrum] FR ?roo?[roo] FR ?tmparr?[tmparr] FI [x],[y] ; Get dimensions of the full image [mic] 12,2 ; [winsiz] = large window size ;[v87]=(([x]-2*[xd])*([y]-2*[yd]))number of pieces in this micrograph [nox]=100/(100-[xover]); Normalization of % of the overlap in x [noy]=100/(100-[yover]); Normalization of % of the overlap in y [npx]=INT([nox]*(([x]-2*[xd])/[winsiz]-1)+1) ; Number of pieces horizontal dim.(X) [npy]=INT([noy]*(([y]-2*[yd])/[winsiz]-1)+1) ; Number of pieces vertical dim.(Y) [v94] = 0 ; -------------------- Loops over X and Y -------------- DO [v12] = 1, [npy] [uly] = ([winsiz]/[noy])*([v12]-1) + [yd] ; Y-direction DO [v13] = 1, [npx] [ulx] = ([winsiz]/[nox])*([v13]-1) + [xd] ; X-direction WI ; Window image [mic] ; Get small pieces of the input image _5 [winsiz],[winsiz] ; Size of small pieces [ulx],[uly] ; Coordinates of the upper left corner RA ; Correct ramp effects _5 _6 PW ; Calc power spectrum of each small piece _6 _7 SQ ; Square image _7 _9 [v94]=[v94]+1 IF ([v94].ge.2) THEN AD ; Add images _3 _9 _3 * ELSE CP ; Copy image _9 _3 ENDIF ENDDO ENDDO ; --------- End Loops. Resulting spectrum in _3 ------------ AR ; Average over power spectra of small pieces _3 _8 P1/[v94] WU ; Calculate the square root _8 _2 IF ([radius].NE.0) THEN ; Mask out center FI H [nsam],[nrow] _2 NSAM,NROW ; Get image dimensions [cx] = [nsam]/2 + 1 [cy] = [nrow]/2 + 1 GP [pv] ; Get pixel intensity _2 ([cx]+10,5) MA ; Mask image _2 _9 (0.0,[radius]*[nsam]) ; Radius of the central dot. e.g., (2 * 5A/px / 200A) / x 500 = 25 pixels D E [pv] ([cx],[cy]) CP ; Copy image _9 _2 ENDIF ; End maskout if clause. Spectrum in _2 CP ; Write the output file _2 [spectrum] ; Create the document file, with column headings & spatial freq. column RO _2 _3 ; 1D rotational average LI D _3 [tmparr] ; Doc file (output) R 1 ; Labels for columns in output file SD / Amplitude X-axis Spat.Freq. [roo] ; Doc file (output) [winsizd2] = [winsiz]/2 ; 1/2 large window size DO [v70] = 1,[winsizd2] UD IC [v70], [v72],[v73] [tmparr] ; Doc file (input) [sfreq] = [v70] / (2.0 * [winsizd2]) ; Compute spatial freq. SD [v70],[v72],[v73],[sfreq] [roo] ; Doc file (output) ENDDO RE