-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModelCollagenTissueStruc.hpp
186 lines (141 loc) · 5.41 KB
/
ModelCollagenTissueStruc.hpp
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//
// ModelCollagenTissueStruc.hpp
// fullstructuralmodel
//
// Created by Will Zhang on 5/11/18.
// Copyright © 2018 Will Zhang. All rights reserved.
//
#ifndef ModelCollagenTissueStruc_hpp
#define ModelCollagenTissueStruc_hpp
#include "BetaDistribution.hpp"
#include "ModelCollagenEnsemble.hpp"
class model_col_tissue_struc_PF
{
// The parameters of this model are
// kC = arg[0]
// ODFmean = arg[1]
// ODFstdev = arg[2]
// Dxmean = arg[3]
// Dxstdev = arg[4]
// Dxlb = arg[5]
// DXub = arg[6]
// Dxaniso = arg[7]
// kI = arg[8]
//
// The constants of this model is
// PF11 = arg[9]
// PF12 = arg[10]
// PF21 = arg[11]
// PF22 = arg[12]
//
// The argument of this model are
// F11, F12, F21, F22
protected:
double F11_pushforward;
double F12_pushforward;
double F21_pushforward;
double F22_pushforward;
const int gq_n = 31; // The number of gauss quadrature points useed
const double *gq_abs = C_11_A31; // The non transformed abscissas
const double *gq_weight = C_11_W31; // The non-transformed weights
double cos2_theta[31];
double sin2_theta[31];
double cossin_theta[31];
double odfweight[31];
double lambda_pushforward[31];
double C_pushforward[31];
double lambda_odf_anisotropy[31];
double lambda_recruit_scaling[31];
double int_range_theta; //range of integration over the splay
double m_1_det;
void compute_range(double stdev){int_range_theta = fmin(M_PI_2, 4.0 * stdev);}
public:
double kC;
double ODFmean;
double ODFstdev;
double Dxmean;
double Dxstdev;
double Dxlb;
double Dxub;
double kI;
double Dx_aniso;
beta_ODF fiber_odf;
model_col_ens_struc_PF ensemblemodel;
void set_parameters();
model_col_tissue_struc_PF(): kC{100000.0}, kI{2000.0}, fiber_odf(0.0, 0.3),
ensemblemodel(1.2, 0.015, 1.0, 1.24), Dx_aniso{1.0}, int_range_theta(M_PI_2), m_1_det{1.0}
{
double theta; // orientation in the current reference state
double omega; // orientation in the original reference state
double cos_omega;
double sin_omega;
double dummie_cos;
double dummie_sin;
for (int i = 0; i < 31; i++) {
theta = int_range_theta * C_11_A31[i];
dummie_cos = cos(theta);
dummie_sin = sin(theta);
cos2_theta[i] = dummie_cos*dummie_cos;
sin2_theta[i] = dummie_sin*dummie_sin;
cossin_theta[i] = dummie_cos*dummie_sin;
omega = theta;
cos_omega = cos(omega);
sin_omega = sin(omega);
lambda_odf_anisotropy[i] = 1.0;
C_pushforward[i] = 1.0;
lambda_pushforward[i] = 1.0;
lambda_recruit_scaling[i] = 1.0;
odfweight[i] = int_range_theta * C_11_W31[i] * fiber_odf.ODF(omega);
}
};
model_col_tissue_struc_PF(double arg[13]):
kC{arg[0]},
ODFmean{arg[1]},
ODFstdev{arg[2]},
fiber_odf(arg[1], arg[2]),
ensemblemodel(arg[3], arg[4], arg[5], arg[6]),
Dx_aniso{arg[7]},
kI{arg[8]},
F11_pushforward{arg[9]},
F12_pushforward{arg[10]},
F21_pushforward{arg[11]},
F22_pushforward{arg[12]},
m_1_det{1.0/(arg[9]*arg[12] - arg[10]*arg[11])}
{
compute_range(arg[2]);
double theta;
double omega; // orientation in the original reference state
double cos_omega;
double sin_omega;
double dummie_cos;
double dummie_sin;
double mean_omega;
double dummie_R0;
double dummie_R1;
mean_omega =atan2(F11_pushforward*sin(ODFmean) - F21_pushforward*cos(ODFmean),
F22_pushforward*cos(ODFmean) - F12_pushforward*sin(ODFmean));
for (int i = 0; i < 31; i++) {
theta = int_range_theta * C_11_A31[i] + ODFmean;
dummie_cos = cos(theta);
dummie_sin = sin(theta);
cos2_theta[i] = dummie_cos*dummie_cos;
sin2_theta[i] = dummie_sin*dummie_sin;
cossin_theta[i] = dummie_cos*dummie_sin;
omega = atan2(F11_pushforward*dummie_sin - F21_pushforward*dummie_cos,
F22_pushforward*dummie_cos - F12_pushforward*dummie_sin);
cos_omega = cos(omega);
sin_omega = sin(omega);
dummie_R0 = cos(omega - mean_omega);
dummie_R1 = Dx_aniso * sin(omega - mean_omega);
lambda_odf_anisotropy[i] = sqrt(dummie_R0*dummie_R0 + dummie_R1*dummie_R1);
dummie_R0 = F11_pushforward*cos_omega + F12_pushforward*sin_omega;
dummie_R1 = F21_pushforward*cos_omega + F22_pushforward*sin_omega;
C_pushforward[i] = dummie_R0*dummie_R0 + dummie_R1*dummie_R1;
lambda_pushforward[i] = sqrt(C_pushforward[i]);
lambda_recruit_scaling[i] = lambda_pushforward[i]/lambda_odf_anisotropy[i];
odfweight[i] = int_range_theta * C_11_W31[i] * fiber_odf.ODF(omega) * C_pushforward[i] * m_1_det;
}
};
int stress(double vF[4], double res[4]);
};
#endif /* ModelCollagenTissueStruc_hpp */