-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSPTQ_example.m
More file actions
67 lines (52 loc) · 2.16 KB
/
Copy pathSPTQ_example.m
File metadata and controls
67 lines (52 loc) · 2.16 KB
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
% Small example for the use of the SPTQ method to determine the 23Na TQ
% signal from the FID only.
% Here, we used a simulated FID with relaxation times of a 6% agar + 154Mm
% NaCl sample.
% see [Paper doi] for detailed desctiption of the SP method
% % % Can be replaced by experimental FID
% 23Na T2 relaxation times for 6% agarose + 154mM NaCl solution at 9.4T
T2s = 32.0e-3; % ms
T2f = 3.7e-3; % ms
ts = 0:1e-4:400e-3; % sampling times
FID = 0.4*exp(-ts./T2s) + 0.6*exp(-ts./T2f); % simulated FID at sampling times
% % %
% calculating the SPTQ signal
[intFID, fid, TQ, tevos] = getSPTQ(ts, FID);
% Plot intFID, fid and TQ signals
figure(); hold on;
plot(tevos, intFID*100, 'linewidth', 2);
plot(tevos, fid*100, 'linewidth', 2);
plot(tevos, TQ*100, 'linewidth', 2);
pbaspect([1 1 1]);
ylabel('Normalized signal [%]')
xlabel("Evolution time [ms]");
legend("SQ(\tau_{evo})+TQ(\tau_{evo}) = \int FID(t,\tau_{evo})dt", "SQ(\tau_{evo})=FID(0,\tau_{evo})", "TQ(\tau_{evo}) = \int FID(t,\tau_{evo})dt-FID(0,\tau_{evo})", 'Location','northeast')
title("Signal of SPTQ method");
set(gca,'FontSize',12);
set(gca,'linewidth',1.5);
grid on;
box on;
% set(gca,'Fontweight','bold');
% Determine the 23Na TQ signal using only the FID
% Input: ts: sampling times
% FID: FID sampled at ts
% Output: intFID: integral over FID for all evolution times
% fid: FID(0:NumTevoPoints-1)
% TQ: TQ signal
function [intFID, fid, TQ, tevos] = getSPTQ(ts, FID)
FID = FID/real(FID(1)); % normalize FID to avoid rounding errors
NumTevoPoints = floor(length(FID)/2);
intFID = zeros([1 NumTevoPoints]);
fid = zeros([1 NumTevoPoints]);
tevos = ts(1:NumTevoPoints);
for i = 1:1:NumTevoPoints
fid_i = (FID(i:end-(NumTevoPoints-i) ));
intFID_i = sum(fid_i); % integral of fid
fid0_i = fid_i(1); % first point of fid ~ int(spec)
fid(i) = fid0_i;
intFID(i) = intFID_i;
end
intFID = intFID/intFID(1) ; % normalize intFID
fid = fid/fid(1); % normalize fid
TQ = intFID-fid; % TQ signal is given by normalized difference
end