/tomo/dfi

To get this branch, use:
bzr branch http://darksoft.org/webbzr/tomo/dfi

« back to all changes in this revision

Viewing changes to pack_sinogram.m

  • Committer: Suren A. Chilingaryan
  • Date: 2013-03-22 00:21:41 UTC
  • Revision ID: csa@dside.dyndns.org-20130322002141-40r2i2pfmza3lpfc
Initial release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [res]=pack_sinogram(sino, center, pad_multiply)
 
2
    angles = size(sino,1);
 
3
 
 
4
    n = size(sino,2);
 
5
 
 
6
    min_side = min(center, n - center);
 
7
    max_side = max(center, n - center);
 
8
 
 
9
    real_size = 2 * min_side;
 
10
    data_start = center - min_side + 1; 
 
11
    data_end = center + min_side; 
 
12
 
 
13
    %We can use the bigest half as projection, but the reconstruction on the
 
14
    %edge will be corrupted due to missing data.
 
15
    %real_size = 2 * max_size;
 
16
    %data_start = 1;
 
17
    %data_end = n;
 
18
 
 
19
    full = (2^(ceil(log2(real_size))))*pad_multiply;
 
20
 
 
21
    %negative values my produce distortions (we are padding with 0)
 
22
    norm_sino=sino-min(min(sino));
 
23
 
 
24
    pad = full - (data_end - data_start + 1);
 
25
    padded_sino=[norm_sino(:,(center+1):data_end) zeros(angles,pad) norm_sino(:,data_start:center)];
 
26
 
 
27
    %instead of fftshift we may do this interleaving to get spectrum in the center
 
28
    %mod_sino=zeros(angles,full);
 
29
    %mod_sino(:,1:2:end)=padded_sino(:,1:2:end);
 
30
    %mod_sino(:,2:2:end)=-padded_sino(:,2:2:end);
 
31
 
 
32
    spectrum=fft(padded_sino');
 
33
    res = fftshift(spectrum, 1);
 
34
end