; Controls back projection
; window.bat 
;
; PURPOSE: Windows a volume using a doc file then rotates and sums the
;          windowed sub-volumes.
;
; I/O PARAMETERS AND FILES ARE SET HERE:
;
; ----------------- INPUT REGISTERS -------------------------------------

x15 = 50           ; Number of volumes to be summed
x51 = 90           ; Rotated volume size (x, y, & z)
x81 = 60           ; Final volume size (x, y, & z)

; -------------- INPUT FILES -------------------------------------
; -------------- May have to edit these names -----------------------
; -------------- DO NOT COPY FROM WEB BROWSER -----------------------
FR G
[align_doc]doc_unique          ; Input alignment parameters doc. file

FR G
[big_vol]large_vol   ; Large input volume


; ----------------- OUTPUT FILES -------------------------------------------

FR G
[win_vol]_2                    ; Temporary output file  

FR G
[rot_vol]jnk_rot               ; Temporary output file stem  

FR G
[big_output_vol]_3             ; Big summed output file  

FR G
[small_output_vol]_4           ; Small summed output file  

FR G
[output_vol]motif_avg          ; Windowed averaged output file  

FR G
[aligned_vol]motif_aligned     ; Windowed rotated output file  
; -------------------------------------------------------------------------

x61 = INT(x51/2)+1         ; Center to corner offset
x91=INT((x51-x81)/2)+1     ; Corner inside big summed output

X55 = INT((x51-15)/2)+1 
X56 = INT((x51-20)/2)+1 
X57 = INT((x51-30)/2)+1 


DO LB1 x50=1,x15

  ; Format of the align parameters doc file is:
  ; angle, angle, angle, Sx, Sy, Sz, CC
  UD IC,x50,x31,x32,x33,x41,x42,x43,x49
  [align_doc]         ; Input alignment parameters doc. file

  x71=x41-x61      ; Top left coord.
  x72=x42-x61
  x73=x43-x61

  WI
  [big_vol]           ; Large input volume
  [win_vol]           ; Windowed output
  (x51,x51,x51)       ; Dimensions
  (x71,x72,x73)       ; Top left

  RT 3D
  [win_vol]           ; Windowed output
  [rot_vol]{***x50}   ; Rotated Windowed output file  
  -x33,-x32,-x31      ; Phi, theta, & psi
  
  WI
  [rot_vol]{***x50}      ; rotated volume
  [aligned_vol]{***x50}    ; Windowed output
  (x81,x81,x81)         ; Dimensions
  (x91,x91,x91)         ; Top left

LB1

AD S
[rot_vol]***           ; Rotated Windowed Output series  
1-x15
[big_output_vol]       ; Summed Output file  



WI
[big_output_vol]      ; Large input volume
[output_vol]    ; Windowed output
(x81,x81,x81)         ; Dimensions
(x91,x91,x91)         ; Top left


FS 
[output_vol]          ; Summed Output file  

VM
\rm [rot_vol]*



EN
;