forked from qMRLab/qMRI-MOOC_T2-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiexpo_T2_histogram.m
69 lines (52 loc) · 2.1 KB
/
multiexpo_T2_histogram.m
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%% Requirements
% qMRLab must be installed: git clone https://www.github.com/qMRLab/qMRLab.git
% The mooc chapter branch must be checked out: git checkout mooc-03-T2
% qMRLab must be added to the path inside the MATLAB session: startup
% The Matlab Statistics and Machine Learning Toolbox must be installed
% Define the model
Model = mwf;
%Add rician noise
Opt.SNR = 200;
% Set simulation options
Opt.T2Spectrumvariance_Myelin = 100;
Opt.T2Spectrumvariance_IEIntraExtracellularWater = 100;
% Generate synthetic MRI data
data = struct;
data.T2MW = 40;
MW = data.T2MW;
data.T2IEW = 120;
IEW = data.T2IEW;
% Get the echo times
EchoTimes = Model.Prot.MET2data.Mat; % Get the echo times
T2 = getT2(Model, EchoTimes); % Get the T2 values
T2_vals = T2.vals; % Extract the T2 values
%% Case 1 : MWF = 0
data.MWF = 0;
% Run gitting simulation and plot the respective curve
figure('Name','Single Voxel Curve Simulation');
FitResult_1 = Model.Sim_Single_Voxel_Curve(data, Opt);
[Smodel_1, Spectrum_1] = Model.equation(data, Opt); % Get the Spectrum
%% Case 2 : MWF = 25
data.MWF = 25;
% Run gitting simulation and plot the respective curve
figure('Name','Single Voxel Curve Simulation');
FitResult_2 = Model.Sim_Single_Voxel_Curve(data, Opt);
[Smodel_2, Spectrum_2] = Model.equation(data, Opt); % Get the Spectrum
%% Case 3 : MWF = 50
data.MWF = 50;
% Run gitting simulation and plot the respective curve
figure('Name','Single Voxel Curve Simulation');
FitResult_3 = Model.Sim_Single_Voxel_Curve(data, Opt);
[Smodel_3, Spectrum_3] = Model.equation(data, Opt); % Get the Spectrum
%% Case 4 : MWF = 75
data.MWF = 75;
% Run gitting simulation and plot the respective curve
figure('Name','Single Voxel Curve Simulation');
FitResult_4 = Model.Sim_Single_Voxel_Curve(data, Opt);
[Smodel_4, Spectrum_4] = Model.equation(data, Opt); % Get the Spectrum
%% Case 5 : MWF = 100
data.MWF = 100;
% Run gitting simulation and plot the respective curve
figure('Name','Single Voxel Curve Simulation');
FitResult_5 = Model.Sim_Single_Voxel_Curve(data, Opt);
[Smodel_5, Spectrum_5] = Model.equation(data, Opt); % Get the Spectrum