]> Creatis software - CreaPhase.git/blob - utilities_LW/CircleMat_Analytical.m
Useful functions for simulations (created by LW, free to use)
[CreaPhase.git] / utilities_LW / CircleMat_Analytical.m
1 ## Copyright (C) 2015 Loriane Weber
2 ## 
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.
7 ## 
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.
12 ## 
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/>.
16
17 ## PhantTibo_Analytical
18
19 ## Author: Loriane Weber <lweber@rnice7-0102>
20 ## Created: 2015-12-10
21
22 %%%%%% INPUT PARAMETERS
23 %% ps : is the physical pixel size, in um
24 %% RedAttFact : reduced attenuation factor
25 %% angles : angles of projections
26 %% save : 1 or 0 (1 if you want to save in edf, 0 sinon
27
28 function [MuP_tot, Phi_tot, B_tot] = CircleMat_Analytical (angles, ps, R_circle, circle_center, absorption_mat, beta_mat, delta_mat, taille, save)
29
30 du= 1; % echantillonage de la projection
31 angles_rad=(angles*pi/180) + pi/2; % in radians % +pi/2 to be coherent with radon transform
32
33 circle_center=circle_center - floor(taille/2);
34 u=[-(taille-1)/2:du:+(taille-1)/2]; 
35 disp('proj')
36
37
38 for i=1:length(angles)
39
40         u0_mat= cos(angles_rad(i))*circle_center(1) + sin(angles_rad(i))*circle_center(2);
41
42 ## Proj attenuation
43         MuP_mat=Analytical_1D(absorption_mat, u, R_circle, u0_mat);
44         MuP_tot(:, i) = MuP_mat * ps;
45
46 ## Proj Phi
47         Phi_mat=Analytical_1D(delta_mat, u, R_circle, u0_mat);
48         Phi_tot(:, i) = Phi_mat * ps;
49
50 ## Proj Beta
51         B_mat=Analytical_1D(beta_mat, u, R_circle, u0_mat);
52         B_tot(:, i) = B_mat *ps;
53
54 end
55
56 if save
57         edfwrite('Sino_AnalyticalCirclePET_Mu.edf', MuP_tot, 'float32')
58         edfwrite('Sino_AnalyticalCirclePET_Phi.edf', Phi_tot, 'float32')
59         edfwrite('Sino_AnalyticalCirclePET_B.edf', B_tot, 'float32')
60 end
61
62
63 endfunction