[[iter],[grp]] ; ; Copies angles into image headers
; cpang.pam -- a defocus group loop   al July 2001
;
; MASTER COPY: /net/bali/usr1/spider/docs/techs/recon/newprogs
;
; PURPOSE: Runs for each defocus group in prepare. Copies angles from
;          current align doc. files into image header locations.
;
; CALLED FROM: prepare.pam  
;
; INPUT REGISTERS:
;   [iter] - Iteration counter         (varies with iteration)
;   [grp] - Defocus group              (varies with group)
;
; INPUT FILES:
;   input/align{**[iter]}_{***[grp]}     [group_align]   
;   input/dala{**[iter]}_{***[grp]}      [aligned_images]  (overwritten!!)
;
; OUTPUT FILES:
;   input/dala{**[iter]}_{***[grp]}@     [aligned_images]    2d stack
;
; ---------------------------------------------------------------------
; -------------- END BATCH HEADER -----------------------------------------------

VM
echo "In cpang,  Group: {**[grp]}"
VM
date

; Set [num-img] to number of particles in this group
UD IC [grp],[num-img]
[order_select]                              ; Need this input file

DO LB1 [img]=1,[num-img]                  ; Loops over images 

   ; Retrieve align data for this image from align. doc file
   ; Format of the align parameters doc file is:
   ; angle, angle, angle, CC, inplane angle, Sx, Sy, mirror, ang. diff
   ; x29=flag for Y-mirror (0-no mirror; 1-mirror)

   UD IC [img],x81,x82,x83,x11,x23,x24,x25,x29
   [group_align]                            ; Align doc file (input)

   ; Store align data in image header for next iteration
   ST                                       ; Set header values
   [aligned_images]@{******[img]}           ; Image output file
   B                                        ; ST type
   (100,101,102,103,104,105,106,107,108)    ; Header locations
   [img],x81,x82,x83,[iter],x23,x24,x25,x29 ; Header values

;  FI x80,X81,X82,X83,x18,x23,x24,x25,x29
;  [aligned_images]@{******[img]}           ; Image output file
;  (100,101,102,103,104,105,106,107,108)    ; Header positions of angles

LB1

UD ICE
[group_align]


RE
;