Annex to Practical N°1

The random conical tilt series, using a simulated titlted pair of micrographs of Lumbricus terrestris giant hemoglobin


Nicolas Boisset

and

Ricardo Aramayo

IMPMC, CNRS UMR 7590

Campus Boucicaut, Université Paris 6

140 Rue de Lourmel

75015 Paris

The batches displayed in this practical session were written for the SPIDER Unix version number 14.16 issued in 2006. These batches should run on your workstation if you possess a more recent Spider version.

 

1. Windowing :

 

b00.fed

;-------------------------------------------------------------------------!
; b00.fed/hbl : batch to read back raw format images and translate them   !
;            in a spider format compatible with your own spider version   !
;-------------------------------------------------------------------------!
md
tr on
;	If this batch does not work please check in you manual the
;	spider operation "cp from raw". It might have changed with newer
;	spider versions. Here it works like this :
;
;	cp from raw		<--- Name of the operation
;	rawmic001		<--- Input image file name
;	8			<--- 8 bytes coding
;	736,780,1		<--- width,length,thickness (NSAM,NROW,NSLICE)
;	0			<--- Number of Header bytes to be skipped
;	scr002			<--- Output spider file
;
;
;-----[ translate rawmic001.hbl into mic001.hbl :
cp from raw
../micrographs/rawmic001
8
736,780,1
0
scr001
;	Find Fmax=x11 and Fmin=x12 densities
fs x11,x12
scr001
;	Compute dynamic range (Fmax-Fmin)=x15
x15=x11-x12
;	rescale image densities between 0.0 and 1.0
ar
scr001
../micrographs/mic001
((P1-X12)/X15)
;-----[ Reduce mic001.hbl by a factor of 2 into pic001.hbl
ip
../micrographs/mic001
../micrographs/pic001
368,390
;-----[ translate rawmic002.hbl into mic002.hbl :
cp from raw
../micrographs/rawmic002
8
1100,780,1
0
scr002
;	Find Fmax=x11 and Fmin=x12 densities
fs x11,x12
scr002
;	Compute dynamic range (Fmax-Fmin)=x15
x15=x11-x12
;	rescale image densities between 0.0 and 1.0
ar
scr002
../micrographs/mic002
((P1-X12)/X15)
;-----[ Reduce mic002.hbl by a factor of 2 into pic002.hbl
ip
../micrographs/mic002
../micrographs/pic002
550,390
;	Delete intermediate files :
de
scr001
de
scr002
en

dcu001.hbl

 
 ; hbl/hbl  dcu001.hbl   Tue Feb 13 16:49:44 2005
 0001 6    1.000000  568.000000  288.000000  284.000000  144.000000    1.000000
 0002 6    2.000000   62.000000   44.000000   31.000000   22.000000    1.000000
 0003 6    3.000000   96.000000  644.000000   48.000000  322.000000    1.000000
 0004 6    4.000000  940.000000   52.000000  470.000000   26.000000    1.000000
 0005 6    5.000000  950.000000  428.000000  475.000000  214.000000    1.000000
 0006 6    6.000000  896.000000  668.000000  448.000000  334.000000    1.000000
 0007 6    7.000000  424.000000  600.000000  212.000000  300.000000    1.000000
 0008 6    8.000000  340.000000  312.000000  170.000000  156.000000    1.000000
 0009 6    9.000000  288.000000  242.000000  144.000000  121.000000    1.000000
 0010 6   10.000000  324.000000  172.000000  162.000000   86.000000    1.000000
 0011 6   11.000000  268.000000  106.000000  134.000000   53.000000    1.000000
 0012 6   12.000000  204.000000  158.000000  102.000000   79.000000    1.000000
 0013 6   13.000000  160.000000   84.000000   80.000000   42.000000    1.000000
 0014 6   14.000000   62.000000  122.000000   31.000000   61.000000    1.000000
 0015 6   15.000000   64.000000  204.000000   32.000000  102.000000    1.000000
 0016 6   16.000000  166.000000  232.000000   83.000000  116.000000    1.000000
 0017 6   17.000000   60.000000  290.000000   30.000000  145.000000    1.000000
 0018 6   18.000000   64.000000  370.000000   32.000000  185.000000    1.000000
 0019 6   19.000000  202.000000  312.000000  101.000000  156.000000    1.000000
 0020 6   20.000000  176.000000  388.000000   88.000000  194.000000    1.000000
 0021 6   21.000000   98.000000  464.000000   49.000000  232.000000    1.000000
 0022 6   22.000000   64.000000  556.000000   32.000000  278.000000    1.000000
 0023 6   23.000000   64.000000  730.000000   32.000000  365.000000    1.000000
 0024 6   24.000000  200.000000  682.000000  100.000000  341.000000    1.000000
 0025 6   25.000000  186.000000  574.000000   93.000000  287.000000    1.000000
 0026 6   26.000000  242.000000  492.000000  121.000000  246.000000    1.000000
 0027 6   27.000000  298.000000  408.000000  149.000000  204.000000    1.000000
 0028 6   28.000000  412.000000  382.000000  206.000000  191.000000    1.000000
 0029 6   29.000000  376.000000  462.000000  188.000000  231.000000    1.000000
 0030 6   30.000000  338.000000  542.000000  169.000000  271.000000    1.000000
 0031 6   31.000000  284.000000  620.000000  142.000000  310.000000    1.000000
 0032 6   32.000000  282.000000  738.000000  141.000000  369.000000    1.000000
 0033 6   33.000000  374.000000  688.000000  187.000000  344.000000    1.000000
 0034 6   34.000000  498.000000  666.000000  249.000000  333.000000    1.000000
 0035 6   35.000000  520.000000  738.000000  260.000000  369.000000    1.000000
 0036 6   36.000000  554.000000  586.000000  277.000000  293.000000    1.000000
 0037 6   37.000000  474.000000  516.000000  237.000000  258.000000    1.000000
 0038 6   38.000000  508.000000  442.000000  254.000000  221.000000    1.000000
 0039 6   39.000000  542.000000  364.000000  271.000000  182.000000    1.000000
 0040 6   40.000000  448.000000  302.000000  224.000000  151.000000    1.000000
 0040 6   40.000000  430.000000  260.000000  215.000000  130.000000    1.000000
 0041 6   41.000000  454.000000  188.000000  227.000000   94.000000    1.000000
 0042 6   42.000000  432.000000  118.000000  216.000000   59.000000    1.000000
 0043 6   43.000000  356.000000   50.000000  178.000000   25.000000    1.000000
 0044 6   44.000000  518.000000   48.000000  259.000000   24.000000    1.000000
 0045 6   45.000000  572.000000  116.000000  286.000000   58.000000    1.000000
 0046 6   46.000000  574.000000  196.000000  287.000000   98.000000    1.000000
 0047 6   47.000000  684.000000   72.000000  342.000000   36.000000    1.000000
 0048 6   48.000000  814.000000   42.000000  407.000000   21.000000    1.000000
 0049 6   49.000000  810.000000  126.000000  405.000000   63.000000    1.000000
 0050 6   50.000000  684.000000  162.000000  342.000000   81.000000    1.000000
 0051 6   51.000000  682.000000  260.000000  341.000000  130.000000    1.000000
 0052 6   52.000000  790.000000  210.000000  395.000000  105.000000    1.000000
 0053 6   53.000000  934.000000  140.000000  467.000000   70.000000    1.000000
 0054 6   54.000000 1038.000000  104.000000  519.000000   52.000000    1.000000
 0055 6   55.000000 1026.000000  192.000000  513.000000   96.000000    1.000000
 0056 6   56.000000 1030.000000  268.000000  515.000000  134.000000    1.000000
 0057 6   57.000000 1034.000000  346.000000  517.000000  173.000000    1.000000
 0058 6   58.000000  910.000000  228.000000  455.000000  114.000000    1.000000
 0059 6   59.000000  822.000000  292.000000  411.000000  146.000000    1.000000
 0060 6   60.000000  674.000000  352.000000  337.000000  176.000000    1.000000
 0061 6   61.000000  638.000000  434.000000  319.000000  217.000000    1.000000
 0062 6   62.000000  628.000000  518.000000  314.000000  259.000000    1.000000
 0063 6   63.000000  802.000000  376.000000  401.000000  188.000000    1.000000
 0064 6   64.000000  744.000000  454.000000  372.000000  227.000000    1.000000
 0065 6   65.000000  862.000000  496.000000  431.000000  248.000000    1.000000
 0066 6   66.000000  730.000000  572.000000  365.000000  286.000000    1.000000
 0067 6   67.000000  646.000000  642.000000  323.000000  321.000000    1.000000
 0068 6   68.000000  666.000000  732.000000  333.000000  366.000000    1.000000
 0069 6   69.000000  770.000000  650.000000  385.000000  325.000000    1.000000
 0070 6   70.000000  862.000000  588.000000  431.000000  294.000000    1.000000
 0071 6   71.000000 1030.000000  492.000000  515.000000  246.000000    1.000000
 0072 6   72.000000  990.000000  568.000000  495.000000  284.000000    1.000000
 0073 6   73.000000 1022.000000  642.000000  511.000000  321.000000    1.000000
 0074 6   74.000000 1012.000000  734.000000  506.000000  367.000000    1.000000
 0075 6   75.000000  812.000000  722.000000  406.000000  361.000000    1.000000
 0076 6   76.000000  914.000000  346.000000  457.000000  173.000000    1.000000
 

dct001.hbl

 
 ; hbl/hbl  dct001.hbl   Tue Feb 13 16:49:54 2005
 0001 6    1.000000  384.000000  286.000000  192.000000  143.000000    1.000000
 0002 6    2.000000   44.000000   48.000000   22.000000   24.000000    1.000000
 0003 6    3.000000   62.000000  638.000000   31.000000  319.000000    1.000000
 0004 6    4.000000  632.000000   56.000000  316.000000   28.000000    1.000000
 0005 6    5.000000  634.000000  424.000000  317.000000  212.000000    1.000000
 0006 6    6.000000  602.000000  666.000000  301.000000  333.000000    1.000000
 0007 6    7.000000  288.000000  602.000000  144.000000  301.000000    1.000000
 0008 6    8.000000  234.000000  312.000000  117.000000  156.000000    1.000000
 0009 6    9.000000  198.000000  248.000000   99.000000  124.000000    1.000000
 0010 6   10.000000  220.000000  174.000000  110.000000   87.000000    1.000000
 0011 6   11.000000  184.000000  106.000000   92.000000   53.000000    1.000000
 0012 6   12.000000  140.000000  156.000000   70.000000   78.000000    1.000000
 0013 6   13.000000  112.000000   86.000000   56.000000   43.000000    1.000000
 0014 6   14.000000   46.000000  126.000000   23.000000   63.000000    1.000000
 0015 6   15.000000   50.000000  202.000000   25.000000  101.000000    1.000000
 0016 6   16.000000  114.000000  232.000000   57.000000  116.000000    1.000000
 0017 6   17.000000   46.000000  288.000000   23.000000  144.000000    1.000000
 0018 6   18.000000   42.000000  366.000000   21.000000  183.000000    1.000000
 0019 6   19.000000  140.000000  310.000000   70.000000  155.000000    1.000000
 0020 6   20.000000  122.000000  392.000000   61.000000  196.000000    1.000000
 0021 6   21.000000   64.000000  464.000000   32.000000  232.000000    1.000000
 0022 6   22.000000   46.000000  558.000000   23.000000  279.000000    1.000000
 0023 6   23.000000   42.000000  728.000000   21.000000  364.000000    1.000000
 0024 6   24.000000  138.000000  686.000000   69.000000  343.000000    1.000000
 0025 6   25.000000  128.000000  576.000000   64.000000  288.000000    1.000000
 0026 6   26.000000  166.000000  496.000000   83.000000  248.000000    1.000000
 0027 6   27.000000  200.000000  404.000000  100.000000  202.000000    1.000000
 0028 6   28.000000  280.000000  382.000000  140.000000  191.000000    1.000000
 0029 6   29.000000  250.000000  462.000000  125.000000  231.000000    1.000000
 0030 6   30.000000  226.000000  542.000000  113.000000  271.000000    1.000000
 0031 6   31.000000  192.000000  620.000000   96.000000  310.000000    1.000000
 0032 6   32.000000  190.000000  738.000000   95.000000  369.000000    1.000000
 0033 6   33.000000  250.000000  688.000000  125.000000  344.000000    1.000000
 0034 6   34.000000  336.000000  666.000000  168.000000  333.000000    1.000000
 0035 6   35.000000  352.000000  736.000000  176.000000  368.000000    1.000000
 0036 6   36.000000  374.000000  586.000000  187.000000  293.000000    1.000000
 0037 6   37.000000  320.000000  516.000000  160.000000  258.000000    1.000000
 0038 6   38.000000  340.000000  442.000000  170.000000  221.000000    1.000000
 0039 6   39.000000  364.000000  364.000000  182.000000  182.000000    1.000000
 0040 6   40.000000  286.000000  260.000000  143.000000  130.000000    1.000000
 0041 6   41.000000  302.000000  188.000000  151.000000   94.000000    1.000000
 0042 6   42.000000  292.000000  116.000000  146.000000   58.000000    1.000000
 0043 6   43.000000  242.000000   48.000000  121.000000   24.000000    1.000000
 0044 6   44.000000  348.000000   50.000000  174.000000   25.000000    1.000000
 0045 6   45.000000  388.000000  114.000000  194.000000   57.000000    1.000000
 0046 6   46.000000  388.000000  200.000000  194.000000  100.000000    1.000000
 0047 6   47.000000  460.000000   74.000000  230.000000   37.000000    1.000000
 0048 6   48.000000  548.000000   40.000000  274.000000   20.000000    1.000000
 0049 6   49.000000  544.000000  122.000000  272.000000   61.000000    1.000000
 0050 6   50.000000  458.000000  162.000000  229.000000   81.000000    1.000000
 0051 6   51.000000  462.000000  260.000000  231.000000  130.000000    1.000000
 0052 6   52.000000  532.000000  212.000000  266.000000  106.000000    1.000000
 0053 6   53.000000  624.000000  140.000000  312.000000   70.000000    1.000000
 0054 6   54.000000  702.000000  106.000000  351.000000   53.000000    1.000000
 0055 6   55.000000  690.000000  192.000000  345.000000   96.000000    1.000000
 0056 6   56.000000  690.000000  268.000000  345.000000  134.000000    1.000000
 0057 6   57.000000  692.000000  344.000000  346.000000  172.000000    1.000000
 0058 6   58.000000  606.000000  228.000000  303.000000  114.000000    1.000000
 0059 6   59.000000  554.000000  292.000000  277.000000  146.000000    1.000000
 0060 6   60.000000  454.000000  354.000000  227.000000  177.000000    1.000000
 0061 6   61.000000  428.000000  436.000000  214.000000  218.000000    1.000000
 0062 6   62.000000  420.000000  518.000000  210.000000  259.000000    1.000000
 0063 6   63.000000  538.000000  376.000000  269.000000  188.000000    1.000000
 0064 6   64.000000  504.000000  458.000000  252.000000  229.000000    1.000000
 0065 6   65.000000  576.000000  496.000000  288.000000  248.000000    1.000000
 0066 6   66.000000  492.000000  572.000000  246.000000  286.000000    1.000000
 0067 6   67.000000  436.000000  642.000000  218.000000  321.000000    1.000000
 0068 6   68.000000  446.000000  734.000000  223.000000  367.000000    1.000000
 0069 6   69.000000  518.000000  646.000000  259.000000  323.000000    1.000000
 0070 6   70.000000  576.000000  590.000000  288.000000  295.000000    1.000000
 0071 6   71.000000  690.000000  494.000000  345.000000  247.000000    1.000000
 0072 6   72.000000  664.000000  566.000000  332.000000  283.000000    1.000000
 0073 6   73.000000  688.000000  638.000000  344.000000  319.000000    1.000000
 0074 6   74.000000  680.000000  732.000000  340.000000  366.000000    1.000000
 0075 6   75.000000  548.000000  722.000000  274.000000  361.000000    1.000000
 0076 6   76.000000  612.000000  346.000000  306.000000  173.000000    1.000000
 

dcb001.hbl

 
 ; hbl/hbl  dcb001.hbl   Tue Feb 13 17:18:19 2005
 0121 6    0.000000    0.000000    0.000000    0.000000    7.000000    0.000000
 ; FITTED flag
 0122 6    1.000000    0.000000    0.000000    0.000000    0.000000    0.000000
 ; X0,Y0 ORIG. IN 0 DEG IM., XS0,YS0 ORIG. IN TILTED IM. REDUCTION FACTOR
 0123 6  284.000000  144.000000  191.033218  143.713867    2.000000    0.000000
 ; TILTANGLE, AXIS DIR. IN:  0 DEG IM.  THETA GAMMA PHI
 0124 6   48.954857   -0.237597   -0.333951    0.000000    0.000000    0.000000

b01.fed

;---------------------------------------------------------------------------!
; b01.fed/hbl : batch for boxing images from the 45 degree tilted specimen  :
;---------------------------------------------------------------------------!

; PARAMETERS
x76=76                                    ; last image number
x81=100.                                  ; image dimension
x82=x81/2.                                ; 1/2 image dimension

; INPUTS:
fr l
[init_tilted_coords]../doc/dct001         ; tilted image coordinates (from WEB)
fr l
[tilted_micrograph]../micrographs/mic001  ; tilted micrograph

; OUTPUTS:
fr l
[tilted_images]../images/tilt{*****x10}   ; windowed, tilted images
fr l
[new_tilted_coords]../doc/dwintilt        ; new tilted image coordinates

; END BATCH HEADER
;---------------------------------------------------------------------------!

md
tr on

;-----[ Starts the do loop of the boxing : 

do lb1 x10=1,x76

;   reads central X and Y coordinates for each particle in the micrograph
ud x10,x11,x12,x13,x14,x15,x16
[init_tilted_coords]

;   subtract 1/2 image dimension from center coordinates
X12=X12-x82
X13=X13-x82

;   boxing out of each particle in a set of small images
wi
[tilted_micrograph]
[tilted_images]
X81,X81
X12,X13

;   save windowing (top left) coordinates in a new document file
sd x10,x12,x13
[new_tilted_coords]

lb1

en

b02.fed

;-----------------------------------------------------------------!
; b02.fed/hbl : batch for boxing images from the untilted specimen:
;-----------------------------------------------------------------!

; PARAMETERS
x76=76                                      ; last image number
x81=100.                                    ; image dimension
x82=x81/2.                                  ; 1/2 image dimension

; INPUTS:
fr l
[init_untilted_coords]../doc/dcu001         ; untilted image coos (from WEB)
fr l
[untilted_micrograph]../micrographs/mic002  ; untilted micrograph

; OUTPUTS:
fr l
[untilted_images]../images/unt{*****x10}    ; windowed, untilted images
fr l
[new_untilted_coords]../doc/dwinunt         ; new untilted image coordinates

; END BATCH HEADER
;-----------------------------------------------------------------!

md
tr on

;-----[ Starts the do loop of the boxing : 

do lb1 x10=1,x76

;   reads central X and Y coordinates for each particle in the micrograph
    ud x10,x11,x12,x13,x14,x15,x16
    [init_untilted_coords]

;   subtract 1/2 image dimension from center coordinates
    X12=X12-x82
    X13=X13-x82

;   boxing out of each particle in a set of small images
    wi
    [untilted_micrograph]
    [untilted_images]
    x81,x81
    X12,X13

;   save windowing (top left) coordinates in a new document file
    sd x10,x12,x13
    [new_untilted_coords]

lb1

en

 

b03.fed

;-----------------------------------------------------------------------------!
; b03.fed/hbf : - iterative reference free alignment untilted-specimen images
;               - first part using AP SR reference free alignment :
;-----------------------------------------------------------------------------!

; PARAMETERS:
X63=1.       ; first image number
X62=76.      ; last image number
x50=100      ; image dimension
x51=x50/2+1  ; image center coordinates

; INPUT:
fr l
[untilted_images]../images/unt    ; untilted windowed image filename template

; OUTPUTS:
fr l
[masked_untilted]../images/mas    ; untilted masked images
fr l
[apsr_image]../r2d/avs***         ; AP SR output images
fr l
[apsr_doc]../doc/davs***          ; AP SR output doc files
; END BATCH HEADER
;-----------------------------------------------------------------------------!
md
tr on

;-----------------------------------------------------------------------------!
;   Apply a circular mask with Gaussian edge on all images   
;-----------------------------------------------------------------------------!

;   loop through particles
DO LB1 x10=X63,X62

;   apply a circular mask on the raw images and stack them 
    ma
    [untilted_images]{*****x10}
    [masked_untilted]{*****x10}
    (47.)    ; mask radius
    g        ; Gaussian cutoff
    c        ; background set to circumference average
    x51,x51  ; mask center
    (2.5)    ; Gaussian falloff
LB1

;-----------------------------------------------------------------------------!
;   Apply a reference free alignment as developped by 
;   Pawel Penczek et al., Ultramicroscopy 40 (1992) 33-53
;-----------------------------------------------------------------------------!

ap sr
[masked_untilted]*****
x63-x62        ; first and last image numbers
(75)           ; expected size of the particle in pixels
(5,38)         ; first and last rings used for rotationnal alignment
*              ; image to use for centering (* = a gaussian disk is used)
[apsr_image]   ; template for output global images
[apsr_doc]     ; template for output doc files

;-----------------------------------------------------------------------------!
;   Show how many cycles were necessary for reference free alignment
vm
ls -l ../r2d/avs*
vm
ls -l ../doc/davs*

; delete intermediate files
de a 
[masked_untilted]00001
en

b04.fed

;-----------------------------------------------------------------------------!
; b04.fed/hbf : - check last cycle of reference free alignment with respect 
;               - to horizontal and/or vertical orientation
;-----------------------------------------------------------------------------!
md
tr on

; PARAMETERS:
X61=4.   ; ending cycle number in the reference free alignment of b03.new

X63=1.   ; first image number
X62=76.  ; last image number
X71=1.   ; starting cycle number
x50=100  ; image dimension

; INPUT:
fr l
[untilted_images]../images/unt    ; untilted windowed image filename template
fr l
[masked_untilted]../images/mas    ; untilted masked images
fr l
[apsr_image]../r2d/avs***         ; AP SR output images
fr l
[apsr_doc]../doc/davs***          ; AP SR output doc files

; OUTPUTS:
fr l
[solapsr]../r2d/solapsr           ; two solutions final images
fr l
[doc_solapsr]../doc/dsolapsr      ; doc file with the two solutions
fr l
[MONTAGE]../r2d/MALIGN            ; montage of the intermediate images
; END BATCH HEADER

;-----------------------------------------------------------------------------!
; check alignment of the last reference free image with its mirror inversion
;-----------------------------------------------------------------------------!

;   get the size of the last apsr_image
fi n x21
[apsr_image]x61
(2)
x80=128
x81=(x80-x21)/2.
;   Put the average of cycle 3 in a larger image (128 x 128 pixels)
pd
[apsr_image]x61
scr001
x80,x80
b
x81,x81

;   Compute the mirror inverted copy of this image 
mr
scr001
scr002
Y

;   Compute the autocorrelation of the original image
ac ic
scr001
scr003

;   Compute the autocorrelation of the mirror inverted image
ac ic
scr002
scr004

;   Angular cross-correlation of the two autocorrelation functions
;	(rotation angle is kept in register x10)
or 2,x10,x90
scr004
scr003
(5,60)
(1)
(F)

;-----------------------------------------------------------------------------!
; TWO SOLUTIONS CAN BE FOUND TO GET THE DESIRED ORIENTATION OF YOUR IMAGES :
; Solution No.1 : apply a half rotation angle -x10/2.
; Solution No.2 : apply solution No.1 + 90 degrees 
;-----------------------------------------------------------------------------!
x55=1.
;   Apply a rotation of -x10/2. => Y axis = cylinder axis )
x11=-x10/2.
rt
[apsr_image]x61
scr005
x11
;   Search the new center of gravity of the rotated average
cg ph x21,x22,x12,x13
scr005
x12=-x12
x13=-x13

;   rotation and translation of the first solution 
rt sq
[apsr_image]x61
[solapsr]{***x55}
x11
x12,x13

;  save rotation and X Y shifts for solution No.1
sd x55,x11,X12,X13
[doc_solapsr]

;-----------------------------------------------------------------------------!
; Solution No.2 : apply solution No.1 + 90 degrees 
;-----------------------------------------------------------------------------!
x55=2.
x17=x11+90.  

rt
[apsr_image]x61
scr006
x17

;   Search the new center of gravity of the rotated average
cg ph x21,x22,x12,x13
scr006
x12=-x12
x13=-x13

;   rotation and translation of the +90 degree solution
rt sq
[apsr_image]x61
[solapsr]{***x55}
x17
x12,x13

;  save rotation and X Y shifts for solution No.2
sd x55,x17,X12,X13
[doc_solapsr]

;-----------------------------------------------------------------------------!
; Creates a montage with intermediate images of 
; solution No.1 left  column of the montage
; solution No.2 right column of the montage
;-----------------------------------------------------------------------------!
; put solution No.1 into 128x128 pixels format
pd
[solapsr]001
scr005
x80,x80
b
x81,x81
; put solution No.2 into 128x128 pixels format
pd
[solapsr]002
scr006
x80,x80
b
x81,x81
; Create montage file with two columns
mn s
scr***
1-6
2,2
2.
[MONTAGE]

; remove intermediate images
;de a
;scr001

en

b05.fed

;-----------------------------------------------------------------------------!
; b05.fed/hbf : - after reference free alignment and visual checking
;               - apply solution No.1 or 2. to all original files
;-----------------------------------------------------------------------------!
md
tr on

; PARAMETERS:
X61=4.     ; ending reference free alignment cycle number 
X10=2.     ; solution choosed No.1 or No.2 for final orientation of particles
x60=x61+1. ; additional and last alignment cycle number
;
X63=1.     ; first image number
X62=76.    ; last image number
x50=100    ; image dimension
x51=(x50/2.)+1  ; image central coordinates

; INPUT:
fr l
[untilted_images]../images/unt    ; untilted windowed image filename template
fr l
[doc_solapsr]../doc/dsolapsr      ; doc file with the two solutions
fr l
[apsr_doc]../doc/davs             ; AP SR output doc files

; OUTPUTS:
fr l
[aligned_untilt]../images/cenu    ; untilted aligned image filename template
fr l
[align_doc_untilt]../doc/dalu     ; untilted alignment doc file
fr l
[untilted_avg]../r2d/avgu         ; untilted centered average filename template
fr l
[untilted_var]../r2d/varu         ; untilted variance template for centered avg

; END BATCH HEADER
;-----------------------------------------------------------------------------!

; get rotation and shift from the designated solution:
  ud x10,x11,x12,x13
  [doc_solapsr]

; loop through images
do lb5 X90=x63,x62
    ud ic X90,X82,X84,X85
    [apsr_doc]{***x61}

;   apply sum alignment
    sa p,X82,X84,X85,X11,X12,X13,X52,X54,X55

;   save new rotation and shifts in an additional alignment doc file
    sd X90,X52,X54,X55
    [align_doc_untilt]001

;   rotation & centering of raw untilted images (unt*****.hbl):
    rt sq
    [untilted_images]{*****X90}
    scr004
    X52
    X54,X55

;   Apply a circular mask on the aligned and centered images

    ma
    scr004
    [aligned_untilt]{*****X90}
    (46.)    ; mask radius
    g        ; Gaussian cutoff
    c        ; background set to circumference average
    x51,x51  ; mask center
    (2.5)    ; Gaussian falloff
lb5

ud ice  ; close doc file
[apsr_doc]{***x61}

;   Computation of the average and variance maps of the last cycle
as dc
[aligned_untilt]*****
x63-x62
A
[untilted_avg]001
[untilted_var]001

;   Deletes intermediate files or images
de 
scr004

en

b06.fed

;-----------------------------------------------------------------------------!
; b06.fed/hbf : - Centering of the tilted-specimen images 
;-----------------------------------------------------------------------------!
md
tr on

; PARAMETERS:
X63=1.       ; first image number
X62=76.      ; last image number
x50=100      ; image dimension
x51=x50/2+1  ; image center coordinates

; INPUTS:
fr l
[tilted_images]../images/tilt   ; tilted windowed image filename template

; OUTPUTS:
fr l
[dummy_rotate]../doc/dummy      ; tilted rotation doc filename template
fr l
[aligned_tilted]../images/cent  ; tilted aligned tilted image filename template
fr l
[shift_doc_tilt]../doc/dshiftt  ; tilted shift doc filename template
fr l
[apsa_avg_tilt]../r2d/avst      ; tilted intermediate avg filename template
fr l
[alignment_doc]../doc/dalt      ; tilted alignment doc filename template
fr l
[tilted_avg]../r2d/avgt         ; tilted centered average filename template
fr l
[tilted_var]../r2d/vart         ; tilted variance template for centered avg

;-----------------------------------------------------------------------------!
;   Create a dummy doc file corresponding to a rotational alignment
;   where a zero degree rotation angle would be found for all images

; dummy variables for initial doc file
X31=0.0
x32=1.

DO LB1 X10=x63,x62
    SD X0,X0,X31,X32,X32
    [dummy_rotate]

;   Apply a circular mask on all the images 
    ma
    [tilted_images]{*****X10}
    [aligned_tilted]{*****X10}
    (47.)    ; mask radius
    g        ; Gaussian cutoff
    c        ; background set to circumference average
    x51,x51  ; mask center
    (2.5)    ; Gaussian falloff
LB1

;   Alignment by translation on all the masked images
AP SA
[aligned_tilted]00001
[dummy_rotate]
(1)  ; group number from AP RA (set to dummy variable x32=1)
N    ; not checking 360-degree range
[shift_doc_tilt]001
[apsa_avg_tilt]001

;   Search the center of gravity of the global average map AVSTX71
cg ph X21,X22
[apsa_avg_tilt]001

;   Apply X&Y translation (minus location of center of gravity) 
;   to all raw tilted-specimen images
DO LB4 X30=1,76
    UD IC X30,X31,X32,X33,X34,X35,X36
    [shift_doc_tilt]001

    X54=X34-X21
    X55=X35-X22

    SD X0,X0,X52,X54,X55
    [alignment_doc]001

    X91=X0

    RT SQ
    [tilted_images]{*****X91}
    scr001
    X52      ; rotation angle
    X54,X55  ; x-, y-shift

;   Apply a circular mask on the centrered images 
    ma
    scr001
    [aligned_tilted]{*****X91}
    (43.)
    g        ; Gaussian cutoff
    c        ; background set to circumference average
    x51,x51  ; mask center
    (2.5)    ; Gaussian falloff
LB4

;   Compute average and variance maps 
AS R
[aligned_tilted]*****
x63-x62
A
[tilted_avg]001
[tilted_var]001

;-----[ delete intermediate file
de
scr001

en d

b07.fed

;------------------------------------------------------------------------------!
; b07.fed/hbl : reads the eulerian angles and stores them in a doc file :
;------------------------------------------------------------------------------!
md
tr on

; SAMPLE INPUT FROM TILT_PARAM_DOC:
;
;  ; hbl/hbl  dcb001.hbl   Tue Feb 13 17:18:19 2002
; TILTANGLE, AXIS DIR. IN:  0 DEG IM.  THETA GAMMA PHI
; 0124 6   48.954857   -0.237597   -0.333951    0.000000    0.000000    
;            phi       tilt dir     tilt dir 
;                      untilted     tilted 
;------------------------------------------------------------------------------!

; SAMPLE INPUT FROM ALIGN_DOC_UNTILT:
;
;            theta   &    psi
;------------------------------------------------------------------------------!
;; ali/hbl   17-Feb-01  AT 21:34:26   ../doc/DAL004.hbl
;    1 4  149.07     0.67946    -0.47203    
;    2 4  170.17     0.13753     -2.6509    
;    3 4  189.85     -5.1422     -6.7959    
;    4 4  109.70     -2.2350    -0.48043    
;    5 4  70.323      3.7882     -1.6368    

; PARAMETERS:
x40=124.  ; index number for relevant line in TILT_PARAMS_DOC
X63=1.    ; first image number
X62=76.   ; last image number

; INPUTS: 
fr l
[tilt_params_doc]../doc/dcb001  ; doc file containing tilt parameters
fr l
[align_doc_untilt]../doc/dalu   ; untilted alignment doc filename template

; OUTPUT:
fr l
[angles_doc]../doc/dang         ; Eulerian angle doc file template

; END BATCH HEADER

;   Reads back the Eulerian angles theta and psi in your windowing doc file
;   (this is how WEB stores it when you fit the angles during particle picking)
ud x40,x32,x31
[tilt_params_doc]

;   Reads back the eulerian angles phi, corresponding to the in-plane rotation
;   applied to untiled-specimen images during their alignment (b05.new)
do lb1 X10=x63,x62
    ud ic x10,x33
    [align_doc_untilt]001

    x33=-x33     ; correct for sign convention
    x33=x33-x31  ; subtract relative rotation between tilt pair
    x34=0.0      ; dummy variable for Eulerian angle psi

;   Stores the three eulerian angles psi, theta, & phi in a doc file
    SD x0,x34,x32,x33
    [angles_doc]001
lb1

;------------------------------------------------------------------------------!
;   For clarity, we add or subtract 360 to angle phi so that its value is
;   restricted between 0 ET 360 (it helps if you want to check angles)
;------------------------------------------------------------------------------!

; loop through
DO LB9 X70=1,4
   X71=X70+1.  ; counter for new ANGLES_DOC

;  loop through particles
   DO LB8 X10=x63,x62
;     get old angles
      UD S X10,X21,X22,X23
      [angles_doc]{***x70}

;     force phi to be between 0 and 360
      IF(X23.GT.0.0)GOTO LB20
      X23=X23+360.

      LB20

      IF(X23.LT.360)GOTO LB22
      X23=X23-360.

      LB22

      SD X10,X21,X22,X23
      [angles_doc]{***x71}
   LB8
LB9

EN

b08.fed

;---------------------------------------------------------------------------!
; b08.fed/hbl : Multivariate Statsitical Analysis (MSA) on the aligned 
;		untilted-specimen images :
;---------------------------------------------------------------------------!
md
tr on

; PARAMETERS:
X63=1.   ; first image number
X62=76.  ; last image number
x25=0.2  ; additive constant, in case there are pixel values<0

; INPUTS:
fr l
[untilted_avg]../r2d/avgu         ; untilted centered average filename template
fr l
[aligned_untilt]../images/cenu    ; untilted aligned image filename template

; OUTPUTS:
fr l
[final_mask]../r2d/mask01         ; binary mask / thresholded average
fr l
[coran]../r2d/coran1              ; prefix for correspondence analysis
;                                   results files :
;                                   coran1_SEQ.hbl
;                                   coran1_IMC.hbl
;                                   coran1_PIX.hbl
;                                   coran1_EIG.hbl
fr l
[ps_map]../r2d/map.ps             ; postscript eigenvalue map

; END BATCH HEADER
;---------------------------------------------------------------------------!

; compute a spherical mask :
mo 
[final_mask]
100,100
c
43.
;   compute the contingency table (or sequential file) SEQ001.hbl :
ca s
[aligned_untilt]*****
X63-X62
[final_mask]
7
c
x25    ; additive constant*
[coran]
;
;   Computes the projection map corresponding to axes 1 and 2
ca sm  ; correspondance analysis, show map and eigenvalues
i       ; each _i_mage is represented by a vector in n-dimensional space
[coran] ; coordinate file prefix
1       ; number of horizontal patches
1,2     ; eigenvectors to map
s       ; represent by a _s_ymbol
+       ; symbol
Y       ; prepare postscript map
3.0     ; range, measured in standard deviations

[ps_map]
12,12
0



0



; The 8 blank lines above are used in CA SME as acceptance of default values.

en

b09.fed

;---------------------------------------------------------------------------!
; b09.fed/hbl : Explore the tendencies expressed by factorial axes 1 to 7
;		Creates montages MIMP001.hbl and MREC001.hbl
;---------------------------------------------------------------------------!
md
tr on

; INPUTS:
fr l
[coran]../r2d/coran1              ; prefix for correspondence analysis
;                                   results files :
;                                   coran1_SEQ.hbl
;                                   coran1_IMC.hbl
;                                   coran1_PIX.hbl
;                                   coran1_EIG.hbl
x81=1				;first image number
x82=76				;last image number

; OUTPUTS:
fr l
[importance_montage]../r2d/MIMP001     ; montage of importance images
fr l
[reconstituted_montage]../r2d/MREC001  ; montage of reconstituted images

; TEMPORARY FILES:
fr l
[importance_img]../r2d/imp             ; importance image filename template
fr l
[reconstituted_img]../r2d/rec          ; reconstituted image filename template

; END BATCH HEADER

x11=100.  ; initialize importance image file # for negative-most eigenvalue
x21=100.  ; initialize reconstituted image file # for negative-most eigenvalue

; loop through eigenvectors
do lb1 x10=1,7
;   importance images of (-) & (+) extremities along axes 1 to 7
    x11=x11+1.  ; increment file number for negative-most eigenvalue
    x12=x11+1.  ; increment file number for positive-most eigenvalue

    sd c
    [coran]
    x10                    ; factorial axis to be used
    tempdoc1
    sd s
    tempdoc1
    x81,x82
    (1)
    
    tempdoc{***x10}
    
    ud x81,x83
    tempdoc{***x10}
    
    
    CA SRD
    [coran]                ; correspondence analysis results files prefix
    x83                    ; file number 
    x10                    ; factorial axis to be used
    tmp***
    cp
    tmp{***x83}
    [importance_img]{***x11}    ; output importance image


    ud x82,x84
    tempdoc{***x10}


    CA SRD
    [coran]                ; correspondence analysis results files prefix
    x84                    ; file number 
    x10                    ; factorial axis to be used
    tmp***
    cp
    tmp{***x84}
    [importance_img]{***x12}    ; output importance image
    
    ud ice
    tempdoc2
    
    de
    tempdoc1
    de
    tmp{***x83}
    de
    tmp{***x84}



    x11=x12

;   reconstitution images of (-) & (+) extremities along axes 1 to 7
    x21=x21+1.  ; increment file number for negative-most eigenvalue
    x22=x21+1.  ; increment file number for positive-most eigenvalue

    CA SRA
    [coran]                ; correspondence analysis results files prefix
    x10                    ; factorial axis to be used
    (-0.2)                  ; eigenvalue for second file
    [reconstituted_img]{***x21} ; output importance image
    

    CA SRA
    [coran]                ; correspondence analysis results files prefix
    x10                    ; factorial axis to be used
    (0.2)                  ; eigenvalue for second file
    [reconstituted_img]{***x22} ; output importance image

    x21=x22

lb1

;   montages of importance and reconstitution images
mn s
[importance_img]***
102,104,106,108,110,112,114,101,103,105,107,109,111,113
7,2  ; images per row, margin width
2    ; margin value
[importance_montage]

mn s
[reconstituted_img]***
102,104,106,108,110,112,114,101,103,105,107,109,111,113
7,2  ; images per row, margin width
2    ; margin value
[reconstituted_montage]

;   delete intermediate files :
de a
[importance_img]101
de a
[reconstituted_img]101
de a
tempdoc001


en d

b10.fed

;---------------------------------------------------------------------------!
; b10.fed/hbl : Hierarchical Ascendant Classification (HAC) after the MSA :
;---------------------------------------------------------------------------!
md
tr on

; PARAMETERS:
x10=1.0  ; test value to jump ahead (1.) or not (0.0)
x26=112  ; maximum dendrogram branch point
x27=1    ; cutoff for branch points

; INPUTS:
fr l
[image_coordinates]../r2d/coran1_IMC ; (implicit) image coordinates
fr l
[dendro_doc]../doc/dhac001           ; dendrogram doc file (interactive session)
fr l
[aligned_untilt]../images/cenu       ; untilted aligned image filename template

; OUTPUTS:
fr l
[ps_dendrogram]../r2d/psdndplot      ; PostScript, truncated dendrogram plot
fr l
[class_count_doc]../doc/dcount001    ; doc file with number of images per class
fr l
[class_select_doc]../doc/dcla        ; class selection doc filename template
fr l
[class_avg]../r2d/clavg              ; class average filename template
fr l
[class_var]../r2d/clvar              ; class variance filename template
fr l
[class_avg_montage]../r2d/mclavg001  ; class average montage
fr l
[class_var_montage]../r2d/mclvar001  ; class variance montage

; END BATCH HEADER

if(x10.eq.1.0) goto lb19

;********************************************************************
; I RECOMMEND DOING THIS PART INTERACTIVELY -- SAVE THE RESULTS FILE
;********************************************************************
;   Runs classification and creates dendrogram doc file
cl hc
[image_coordinates]
1-7  ; eigenvectors to use
0    ; eigenvector weighting ('0'-->all 1's)
5    ; clustering criterion: Ward's method
n    ; postscript file? (we'll make a truncated one later)
y    ; dendrogram doc file?
[dendro_doc]

en
 (Check the dendrogram shape in results file and note Max and min values)

lb19


;   Starts again HAC and creates dendrogram file DEND001.hbl
;   In my case I used a threshold value of 3 for a max value of 203
cl hc
[image_coordinates]
1-7  ; eigenvectors to use
0    ; eigenvector weighting ('0'-->all 1's)
5    ; clustering criterion: Ward's method
t    ; _t_runcated postscript file
x27  ; cutoff
[ps_dendrogram]
n

;   Compute the number of images per class
x11=x27/x26  ; branch cutoff divided by maximum branch point

cl hd  ; hierarchical classification, calculate classes
x11
[dendro_doc]
[class_count_doc]

;   Creating doc files containing the image liste for each class
cl he
x11
[dendro_doc]
[class_select_doc]***


;   Compute average and variance maps for each class
do lb1 x10=1,4
    as dc
    [aligned_untilt]*****
    [class_select_doc]{***x10}
    a  ; sum _all_images
    [class_avg]{***x10}
    [class_var]{***x10}
lb1

;   Creates montage files of average and variance maps
mn s
[class_avg]***
1-4  ; file numbers
4,2  ; images per row, margin width
2    ; margin value
[class_avg_montage]

mn s
[class_var]***
1-4  ; file numbers
4,2  ; images per row, margin width
2    ; margin value
[class_var_montage]

en

b11.fed

;---------------------------------------------------------------------------!
; b11.fed/hbl : Creating symmetry document files taking into account 
;		the D6 point-group symmetry of Lumbricus hemoglobin :
;---------------------------------------------------------------------------!
md
tr on

; OUTPUTS:
fr l
[top_sym]../doc/d6top    ; top-view symmetry doc file
fr l
[side_sym]../doc/d6side  ; side-view symmetry doc file

; END BATCH HEADER

;   D6 Symmetry for hexagonal top views
;   6-fold axis parallel to Z axis)
do lb1 x10=1,12
    rr x11
    0.0,0.0,0.0,0.0,0.0,0.0,0.0,60.,120.,180.,240.,300.
    rr x12
    0.0,0.0,0.0,0.0,0.0,0.0,180.,180.,180.,180.,180.,180.
    rr x13
    0.0,60.,120.,180.,240.,300.,0.0,0.0,0.0,0.0,0.0,0.0

    sd x10,x13,x12,x11
    [top_sym]
lb1

;   D6 Symmetry for rectangular side views 
;   (6-fold axis parallel to Y axis)
do lb2 x20=1,12
    rr x11
    0.0,0.0,0.0,0.0,0.0,0.0,180.0,180.0,180.0,180.,180.,180.
    rr x12
    0.0,60.0,120.,180.,240.,300.,0.0,60.,120.,180.,240.,300.
    rr x13
    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
    sd x20,x13,x12,x11
    [side_sym]
lb2

en d
 

D6top.hbl

 ;fed/hbl   21-AUG-2006 AT 18:05:50   ../doc/d6top.hbl
    1 3   0.0000       0.0000       0.0000     
    2 3   60.000       0.0000       0.0000     
    3 3   120.00       0.0000       0.0000     
    4 3   180.00       0.0000       0.0000     
    5 3   240.00       0.0000       0.0000     
    6 3   300.00       0.0000       0.0000     
    7 3   0.0000       180.00       0.0000     
    8 3   0.0000       180.00       60.000     
    9 3   0.0000       180.00       120.00     
   10 3   0.0000       180.00       180.00     
   11 3   0.0000       180.00       240.00     
   12 3   0.0000       180.00       300.00     

D6side.hbl

 ;fed/hbl   21-AUG-2006 AT 18:05:50   ../doc/d6side.hbl
1 3 0.0000 0.0000 0.0000
2 3 0.0000 60.000 0.0000
3 3 0.0000 120.00 0.0000
4 3 0.0000 180.00 0.0000
5 3 0.0000 240.00 0.0000
6 3 0.0000 300.00 0.0000
7 3 0.0000 0.0000 180.00
8 3 0.0000 60.000 180.00
9 3 0.0000 120.00 180.00
10 3 0.0000 180.00 180.00
11 3 0.0000 240.00 180.00
12 3 0.0000 300.00 180.00

b12.fed

;------------------------------------------------------------------------------!
; b12.fed/hbl : 3D Reconstruction from the tilted-speci;en images 
;		corresponding to the three image classes obtained from MSA :
;------------------------------------------------------------------------------!
md
tr on

; NOTE:
;   Make sure that the view of the untilted class numbers in this batch file
;   are the ones you want, and that they correspond to the correct symmetry file.
;   For example, untilted class average #4 may not be the end-on view in your
;   own image set

; INPUTS:
fr l
[aligned_tilted]../images/cent  ; tilted aligned tilted image filename template
fr l
[class_select_doc]../doc/dcla   ; class selection doc filename template
fr l
[angles_doc]../doc/dang         ; Eulerian angle doc file template
fr l
[side_sym]../doc/d6side         ; side-view symmetry doc file
fr l
[top_sym]../doc/d6top           ; top-view symmetry doc file

; OUTPUTS:
fr l
[class_vol]../r3d/vcla          ; class volume filename template

; END BATCH HEADER

; 3D Reconstruction of image class No.1 :
bp rp
[aligned_tilted]0****
[class_select_doc]001
47.0        ; object radius
[angles_doc]005
[side_sym]
[class_vol]001
0.15e-04,0  ; correction weight, correction limit
50,1        ; iteration limit, mode 1 (smoothing)
0.0,2.00    ; minimum, maximum values in projections
0.999       ; smoothing constant

; 3D Reconstruction of image class No.3 :
bp rp
[aligned_tilted]0****
[class_select_doc]003
47.0        ; object radius
[angles_doc]005
[side_sym]
[class_vol]003
0.15e-04,0  ; correction weight, correction limit
50,1        ; iteration limit, mode 1 (smoothing)
0.0,2.00    ; minimum, maximum values in projections
0.999       ; smoothing constant

; 3D Reconstruction of image class No.4 :
bp rp
[aligned_tilted]0****
[class_select_doc]004
47.0        ; object radius
[angles_doc]005
[top_sym]
[class_vol]004
0.15e-04,0  ; correction weight, correction limit
50,1        ; iteration limit, mode 1 (smoothing)
0.0,2.00    ; minimum, maximum values in projections
0.999       ; smoothing constant

;----------------------------------------------------------------------!
; REMARK :  You might want to speed up the reconstruction.
; if bp rp to slow on your computer, you can also try operation "BP 3F"
;----------------------------------------------------------------------!
;bp 3f
;[aligned_tilted]0****
;[class_select_doc]001
;[angles_doc]005
;[side_sym]
;[class_vol]001
;; 
;bp 3f
;[aligned_tilted]0****
;[class_select_doc]003
;[angles_doc]005
;[side_sym]
;[class_vol]003
;; 
;bp 3f
;[aligned_tilted]0****
;[class_select_doc]004
;[angles_doc]005
;[top_sym]
;[class_vol]004
;;
en d

b13.fed

;------------------------------------------------------------------------------!
; b13.fed/hbl : Finding a common orientation for the three reconstructions :
;		2D projection of the volumes along axis Z
;		Rotation of side view volumes by 90 degrees around X axis 
;		2D projection of the rotated side view volumes 
;------------------------------------------------------------------------------!

md
tr on

; NOTE:
;   This batch file uses classes 1, 3, and 4.

; INPUTS:
fr l
[class_vol]../r3d/vcla    ; class volume filename template

; OUTPUTS:
fr l
[prj_montage]../r3d/mpro  ; projection montage filename template

; END BATCH HEADER
;------------------------------------------------------------------------------!

; Projection of the three reconstruction volumes
pj 3
[class_vol]001
100    ; dimension
scr001
0,0,0  ; projection angles

pj 3
[class_vol]003
100
scr003
0,0,0  ; projection angles

pj 3
[class_vol]004
100
scr004
0,0,0

;   montage of the 3 projections 
mn s
scr***
1,3,4
3,2
2.
[prj_montage]001

;   rotating the two side view volumes by 90 degrees around X axis
rt 3d
[class_vol]001
ttt001
90.0,90.0,-90.0
    
rt 3d
[class_vol]003
ttt003
90.0,90.0,-90.0 

;   2D Projection of the three reconstruction volumes after rotation
pj 3
ttt001
100
scr011
0,0,0

pj 3
ttt003
100
scr013
0,0,0

;   montage of the 3 new projections 
mn s
scr***
11,13,4
3,2
2.
[prj_montage]002

;   rotating VCLA003 by 90 degrees around X and 30 degrees around Z
rt 3d
[class_vol]003
ttt003
90.0,90.0,-60.0 

pj 3
ttt003
100
scr013
0,0,0

;   montage of the 3 new projections 
mn s
scr***
11,13,4
3,2
2.
[prj_montage]003

;   clean up
de a
scr001
de a
scr011
de
ttt001
de
ttt003

en d
 

b14.fed

;--------------------------------------------------------------------------!
; b14.fed/hbl : More general approach for the reorientation of the volumes
;		using a stochastic approach, using "OR 3Q" operation :
;		This test uses the hexagonal top view volume as reference
;--------------------------------------------------------------------------!

; NOTE:
;   By default, this batch file assumes [class_vol]004 is the reference, top view,
;   and aligns [class_vol]'s 001 and 003 to it.

; INPUTS:
fr l
[class_vol]../r3d/vcla         ; class volume filename template

; OUTPUT:
fr l
[vol_align_doc]../doc/dalv001  ; volume alignment doc filename template

; END BATCH HEADER

md
tr on

;	search best 3D alignment of VCLAx20 on VCLA004 using a starting
;	position of : phi = 90, theta = 90, and psi = -90

x20=1.  ; class volume # to align

or 3q x21,x22,x23,x24
[class_vol]004
[class_vol]{***x20}
41  ; radius
90.0,90.0    
-90.0   

sd x20,x21,x22,x23,x24
[vol_align_doc]

;	search best 3D alignment of VCLAx20 on VCLA004 using a starting
;	position of : phi = 90, theta = 90, and psi = -60 

x20=3.  ; class volume # to align

or 3q x21,x22,x23,x24
[class_vol]004
[class_vol]{***x20}
41
90.0,90.0    
-60.0    

sd x20,x21,x22,x23,x24
[vol_align_doc]

en
 

dalv001.hbl

 ;fed/hbl   21-AUG-2006 AT 18:59:26   ../doc/dalv001.hbl
    1 4   90.000       89.999      -90.000      0.89578     
    3 4   90.000       89.998      -59.978      0.89503     

b15.fed

;--------------------------------------------------------------------------!
; b15.fed/hbl : merging of the three conical tilt series in a single group
;		after modifying the eulerian angles of each image accordingly
;		Finally computation of a "multi-cone" or "merged" 3D
;		reconstruction volume (devoid of the missing cone artifact)
;--------------------------------------------------------------------------!

;	  volume of class #4 phi = 0.0, theta = 0.0, psi = 0.0
;	  volume of class #1 phi = 90., theta = 90., psi = -90.
;	  volume of class #3 phi = 90., theta = 90., psi = -60.
;   If these aren't the values you want, change the batch file below.

;INPUTS:
fr l
[class_count_doc]../doc/dcount001    ; doc file with number of images per class
fr l
[angles_doc]../doc/dang         ; Eulerian angle doc file template
fr l
[class_select_doc]../doc/dcla        ; class selection doc filename template
fr l
[aligned_tilted]../images/cent  ; tilted aligned tilted image filename template
fr l
[top_sym]../doc/d6top    ; top-view symmetry doc file

;OUTPUTS:
fr l
[merged_angles_doc]../doc/dang010  ; merged angles doc file
fr l
[merged_select_doc]../doc/dsel001  ; merged selectoin doc file
fr l
[merged_vol]../r3d/vtot001  ; merged volume

;TEMPORARY FILE:
;dint***
;--------------------------------------------------------------------------!
md
tr on

;   Reads the class number and the Eulerian rotation angles applied
;	  to reorient the corresponding volume :
do lb1 x50=1,3

;   (In the following read-register commands, there are fewer registers named
;   than there are numbers in the following line.  What this means is that, in
;   each cycle of the do-loop, the next number will be assigned to that register.

;
    rr x11
    4.,1.,3.

;   phi, one for each volume
    rr x51
    0.0,90.0,90.0

;   theta, one for each volume
    rr x52
    0.0,90.0,90.0

;   psi, one for each volume
    rr x53
    0.0,-90.,-60.

;   reads back the number of images per class
    ud x11,x12
    [class_count_doc]

;   Modify the original eulerian angles of the tilted-specimen images
;	  by applying the phi, theta, psi rotation angles, using "VO RA"
    vo ra
    [angles_doc]005
    x53,x52       ; psi, theta
    x51           ; phi
    dint{***x11}  ; temporary file

;   Internal DO loop for each image class
    do lb3 x60=1,x12
        x10=x10+1.0

	ud x60,x20
        [class_select_doc]{***x11}

;       Copy the tilted-specimen images of the three classe with
;	    consecutive and increasing numbers 1, 2, 3, etc.. 71, 72.
        cp
        [aligned_tilted]{*****x20}
        [aligned_tilted]1{****x10}

;       Creates the corresponding new eulerian angular doc file
        ud x20,x21,x22,x23
        dint{***x11}

	sd x10,x21,x22,x23
        [merged_angles_doc]

;       Creates a new selection doc file containing the image numbers
        sd x10,x10
        [merged_select_doc]
    lb3
de
dint{***x11}

lb1

;--------------------------------------------------------------------------!
;-----[ 3D Reconstruction from the merged 3 image classes : VTOT001.hbl
;--------------------------------------------------------------------------!
bp rp
[aligned_tilted]1****
[merged_select_doc]
47.0        ; radius
[merged_angles_doc]
[top_sym]
[merged_vol]
0.15e-04,0  ; correction weight (lambda), correction limit
50,1        ; iteration limit, mode (1=smoothing)
-5.0,5.0    ; min., max. values in 2D data set
0.999       ; smoothing constant

;--------------------------------------------------------------------------!
;if "bp rp" too slow, use operation "bp 3f" :
;--------------------------------------------------------------------------!
;bp 3f
;[aligned_tilted]1****
;[merged_select_doc]
;[merged_angles_doc]
;[top_sym]
;[merged_vol]
; 
en
 

b16.fed

;---------------------------------------------------------------------------!
; b16.fed/hbl : Renames .hbl files for web viewing, in case the ".DAT" bug 
; 		would still remain in your version of Web software. 
;---------------------------------------------------------------------------!
md
tr on

do lb1 x10=1,76

vm
cp ../images/cenu{*****x10}.hbl ../images/cenu{*****x10}.DAT

lb1

vm
cp ../doc/dhac001.hbl ../doc/dhac001.hbl.DAT

en d

dang010.hbl

 ;fed/hbl   21-AUG-2006 AT 18:59:37   ../doc/dang010.hbl
    1 3   0.0000       47.941       129.58     
    2 3   0.0000       47.941       39.550     
    3 3   0.0000       47.941       129.90     
    4 3   0.0000       47.941       219.52     
    5 3   0.0000       47.941       59.720     
    6 3   0.0000       47.941       49.600     
    7 3   0.0000       47.941       49.650     
    8 3   0.0000       47.941       139.74     
    9 3   0.0000       47.941       29.660     
   10 3   0.0000       47.941       119.71     
   11 3   0.0000       47.941       239.85     
   12 3   0.0000       47.941       149.62     
   13 3   0.0000       47.941       209.77     
   14 3   0.0000       47.941       119.75     
   15 3   0.0000       47.941       79.810     
   16 3   0.0000       47.941       339.87     
   17 3   0.0000       47.941       339.72     
   18 3   0.0000       47.941       19.680     
   19 3   0.0000       47.941       349.51     
   20 3   0.0000       47.941       99.680     
   21 3   0.0000       47.941       79.740     
   22 3   0.0000       47.941       339.85     
   23 3   0.0000       47.941       79.710     
   24 3   0.0000       47.941       69.650     
   25 3   0.0000       47.941       349.70     
   26 3   0.0000       47.941       189.79     
   27 3   0.0000       47.941       109.69     
   28 3   0.0000       47.941       9.6600     
   29 3   0.0000       47.941       19.810     
   30 3   0.0000       47.941       89.720     
   31 3   0.0000       47.941       69.650     
   32 3   0.0000       47.941       89.630     
   33 3   0.0000       47.941       359.76     
   34 3   0.0000       47.941       359.84     
   35 3   0.0000       47.941       149.85     
   36 3   0.0000       47.941       289.73     
   37 3   110.86       68.465       313.93     
   38 3   231.09       55.157       234.71     
   39 3   179.28       42.061       270.53     
   40 3   248.54       67.925       226.29     
   41 3   110.97       68.368       313.89     
   42 3   68.544       112.07       313.71     
   43 3   179.01       42.063       270.73     
   44 3   96.526       82.821       317.53     
   45 3   331.07       134.13       248.95     
   46 3   96.355       83.006       317.55     
   47 3   208.14       45.657       249.50     
   48 3   208.27       45.692       249.41     
   49 3   82.950       97.747       317.46     
   50 3   82.929       97.769       317.46     
   51 3   150.68       45.981       291.32     
   52 3   128.10       55.634       305.75     
   53 3   231.03       55.122       234.74     
   54 3   128.05       55.663       305.78     
   55 3   51.299       124.72       275.41     
   56 3   231.05       55.134       204.73     
   57 3   248.33       67.746       196.37     
   58 3   110.78       68.535       283.96     
   59 3   290.91       111.58       196.09     
   60 3   128.10       55.634       275.75     
   61 3   308.35       124.51       204.39     
   62 3   276.53       97.179       192.47     
   63 3   83.175       97.503       287.49     
   64 3   331.00       134.11       218.90     
   65 3   359.43       137.94       239.58     
   66 3   208.40       45.727       219.32     
   67 3   359.39       137.94       239.55     
   68 3   68.746       111.89       283.79     
   69 3   82.813       97.894       287.44     
   70 3   96.512       82.836       287.53     
   71 3   331.04       134.12       218.93     
   72 3   207.94       45.604       219.64     

dsel001.hbl

 ;fed/hbl   21-AUG-2006 AT 18:59:37   ../doc/dsel001.hbl
    1 1   1.0000     
    2 1   2.0000     
    3 1   3.0000     
    4 1   4.0000     
    5 1   5.0000     
    6 1   6.0000     
    7 1   7.0000     
    8 1   8.0000     
    9 1   9.0000     
   10 1   10.000     
   11 1   11.000     
   12 1   12.000     
   13 1   13.000     
   14 1   14.000     
   15 1   15.000     
   16 1   16.000     
   17 1   17.000     
   18 1   18.000     
   19 1   19.000     
   20 1   20.000     
   21 1   21.000     
   22 1   22.000     
   23 1   23.000     
   24 1   24.000     
   25 1   25.000     
   26 1   26.000     
   27 1   27.000     
   28 1   28.000     
   29 1   29.000     
   30 1   30.000     
   31 1   31.000     
   32 1   32.000     
   33 1   33.000     
   34 1   34.000     
   35 1   35.000     
   36 1   36.000     
   37 1   37.000     
   38 1   38.000     
   39 1   39.000     
   40 1   40.000     
   41 1   41.000     
   42 1   42.000     
   43 1   43.000     
   44 1   44.000     
   45 1   45.000     
   46 1   46.000     
   47 1   47.000     
   48 1   48.000     
   49 1   49.000     
   50 1   50.000     
   51 1   51.000     
   52 1   52.000     
   53 1   53.000     
   54 1   54.000     
   55 1   55.000     
   56 1   56.000     
   57 1   57.000     
   58 1   58.000     
   59 1   59.000     
   60 1   60.000     
   61 1   61.000     
   62 1   62.000     
   63 1   63.000     
   64 1   64.000     
   65 1   65.000     
   66 1   66.000     
   67 1   67.000     
   68 1   68.000     
   69 1   69.000     
   70 1   70.000     
   71 1   71.000     
   72 1   72.000