-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsignal_bSSFP180_B0_DE.cpp
76 lines (56 loc) · 2.02 KB
/
signal_bSSFP180_B0_DE.cpp
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
70
71
72
73
74
75
#include <unsupported/Eigen/MatrixFunctions>
#include "signal_bSSFP180_B0_DE.h"
#include <complex>
#include <iostream>
using namespace Eigen;
void SSFP_steady_state_180_IV::compute ()
{
// Calculate remaining parameters.
double R1_S = 1.0/T1_S();
double R1_F = 1.0/T1_F();
double R2_S = 1.0/T2_S();
double R2_F = 1.0/T2_F();
// For dynamic equilibrium:
double M0_S = 1 - M0_F();
double k_SF = (M0_F()*k_FS())/M0_S;
// Define Bloch-McConnell terms:
VectorXd C(6);
C << 0.0, 0.0, (R1_F * M0_F()), 0.0, 0.0, (R1_S * M0_S);
MatrixXd A(6,6);
A << -R2_F-k_FS(), 0.0, 0.0, k_SF, 0.0, 0.0,
0.0, -R2_F-k_FS(), 0.0, 0.0, k_SF, 0.0,
0.0, 0.0, -R1_F-k_FS(), 0.0, 0.0, k_SF,
k_FS(), 0.0, 0.0, -R2_S-k_SF, 0.0, 0.0,
0.0, k_FS(), 0.0, 0.0, -R2_S-k_SF, 0.0,
0.0, 0.0, k_FS(), 0.0, 0.0, -R1_S-k_SF;
Mss.resize (FA.size(), 6);
Mss_Sig.resize (FA.size());
PartialPivLU<MatrixXd> lu (A);
VectorXd AinvC(6);
AinvC = lu.solve (C);
A *= TR();
MatrixXd em(6,6);
em = A.exp();
const std::complex<double> i(0.0,1.0);
double PCTheta = 3.14159265358979323846 + Delta();
MatrixXd PCM(6,6);
PCM << std::cos(PCTheta), -std::sin(PCTheta), 0.0, 0.0, 0.0, 0.0,
std::sin(PCTheta), std::cos(PCTheta), 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, std::cos(PCTheta), -std::sin(PCTheta), 0.0,
0.0, 0.0, 0.0, std::sin(PCTheta), std::cos(PCTheta), 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 1.0;
MatrixXd T(6,6);
for (int n = 0; n < FA.size(); n++) {
T << 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, std::cos(FA(n)), std::sin(FA(n)), 0.0, 0.0, 0.0,
0.0, -std::sin(FA(n)), std::cos(FA(n)), 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, std::cos(FA(n)), std::sin(FA(n)),
0.0, 0.0, 0.0, 0.0, -std::sin(FA(n)), std::cos(FA(n));
lu.compute (PCM - (em * T));
Mss.row(n) = lu.solve ((em - MatrixXd::Identity(6,6)) * AinvC);
// Extract signal component.
Mss_Sig(n) = std::abs((Mss(n,0) + (i * Mss(n,1))) + (Mss(n,3) + (i * Mss(n,4))));
}
}