/tomo/dfi

To get this branch, use:
bzr branch http://suren.me/webbzr/tomo/dfi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function [res]=pack_sinogram(sino, center, pad_multiply)
    angles = size(sino,1);

    n = size(sino,2);

    min_side = min(center, n - center);
    max_side = max(center, n - center);

    real_size = 2 * min_side;
    data_start = center - min_side + 1; 
    data_end = center + min_side; 

    %We can use the bigest half as projection, but the reconstruction on the
    %edge will be corrupted due to missing data.
    %real_size = 2 * max_size;
    %data_start = 1;
    %data_end = n;

    full = (2^(ceil(log2(real_size))))*pad_multiply;

    %negative values my produce distortions (we are padding with 0)
    norm_sino=sino-min(min(sino));

    pad = full - (data_end - data_start + 1);
    padded_sino=[norm_sino(:,(center+1):data_end) zeros(angles,pad) norm_sino(:,data_start:center)];

    %instead of fftshift we may do this interleaving to get spectrum in the center
    %mod_sino=zeros(angles,full);
    %mod_sino(:,1:2:end)=padded_sino(:,1:2:end);
    %mod_sino(:,2:2:end)=-padded_sino(:,2:2:end);

    spectrum=fft(padded_sino');
    res = fftshift(spectrum, 1);
end