1 ## Copyright (C) 2015 Loriane Weber
3 ## This program is free software; you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; either version 3 of the License, or
6 ## (at your option) any later version.
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ## GNU General Public License for more details.
13 ## You should have received a copy of the GNU General Public License
14 ## along with Octave; see the file COPYING. If not, see
15 ## <http://www.gnu.org/licenses/>.
19 ## Author: Loriane Weber <lweber@gpid16a-1802>
20 ## Created: 2015-12-11
22 function [ IdCTF ] = CTFPropagation_2D (ph, B, D, lambda, oversamp, ftot, gtot)
26 [mp_a, np_a] = size(B);
29 if (mp_a != mp || np_a != np)
30 disp('error in the dimensions !! Phi and B should have the same dimension')
34 % propagators in 2D (sin and cos)
35 ssq=2*ssquare2(lambda*D, ftot', gtot', 1);
36 csq=2*csquare2(lambda*D, ftot', gtot', 1);
39 tmp_B=zeros(2*mp, 2*np);
40 tmp_Phi=zeros(2*mp, 2*np);
43 %tmp_ph(1:mp,1:np)=ph;
45 tmp_B=im_pad(B, 2*np, 2*mp, "zeros");
46 tmp_Phi=im_pad(ph, 2*np, 2*mp, "zeros");
49 tmp_Phi=fft2(tmp_Phi);
51 tmp_Id=-csq.*tmp_B + ssq.*tmp_Phi;
52 tmp_Id=1+real(ifft2(tmp_Id));
54 IdCTF=cut(tmp_Id, mp, np);
58 ipf = [ 0.25 0.5 0.25; % modelise le binning du detecteur
61 Idd = conv2(IdCTF,ipf,'same')./conv2(ones(size(IdCTF)),ipf,'same');
62 Idd = Idd(oversamp:oversamp:end, oversamp:oversamp:end);
66 ipf = [0.25 0.50 0.50 0.50 0.25;
67 0.50 1.00 1.00 1.00 0.50;
68 0.50 1.00 1.00 1.00 0.50;
69 0.50 1.00 1.00 1.00 0.50;
70 0.25 0.50 0.50 0.50 0.25];
72 Idd = conv2(IdCTF,ipf,'same')./conv2(ones(size(IdCTF)),ipf,'same');
73 Idd = Idd(oversamp:oversamp:end, oversamp:oversamp:end);
76 end % end oversampling