%% Setting up tomograms:

N_TOMOS = 4;
tomo_ix = [1 3 4 5];

tomos_list = dyn2rel.create_tomos_list(N_TOMOS);
tomo_size = [7676, 7420, 1600];
pix_size = 1.1;

for i = 1:N_TOMOS
    base_tomo_dir = sprintf('data/tomo_%02d/',tomo_ix(i));
    stack_name = [base_tomo_dir 'tiltstack.st'];
    tlt_name   = [base_tomo_dir 'tiltstack.tlt'];
    xf_name    = [base_tomo_dir 'tiltstack.xf'];
    def_name   = [base_tomo_dir 'tiltstack.defocus'];
    
    tomos_list(i).index = tomo_ix(i);
    tomos_list(i).set_stack(stack_name,pix_size);
    tomos_list(i).read_ali_files(tlt_name,xf_name);
    tomos_list(i).set_tomogram_size(tomo_size);
    tomos_list(i).set_defocus( def_name );
end

%%  OPTIONAL: Add BFactor information:

BFactors = [29.36 17.24 26.28 32.34]; % Obtained with GCTF on the HD frames.
for i = 1:N_TOMOS
    tomos_list(i).set_bfactor( BFactors(i) );
end

%%

exporter = dyn2rel.Exporter;
exporter.tbl_mul = 2; % binning of the table with normal binning, means 2 X coordinate in table
exporter.out_siz = 400; %unbinned box size
exporter.out_bin = 1; %1 means binning 2, output box becomes 200 with bin1
exporter.split_h = 23; %column23 is assigning of half dataset
exporter.xcor_sel = 0.9; % 90% of ptcls contribute to final volume
exporter.exec('hyb_b1',tomos_list,'sta_rslt.tbl');
