-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPres.py
More file actions
60 lines (39 loc) · 2.29 KB
/
Copy pathPres.py
File metadata and controls
60 lines (39 loc) · 2.29 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
import variables
import numpy as np
import math
class Pres:
def __init__(self,cind, vind, sigma0, amplitude0, pres_bias) -> None:
self.cind = cind
self.vind = vind
self.sigma0 = sigma0
self.amplitude0 = amplitude0
self.pres_bias = pres_bias
def CTP(self):
for tt in range(0, self.cind.size):
s=self.cind[0,tt]
# Density as defined by Equations (3c)
density = np.sum(variables.celltype[0,s+variables.index_bias]>0)/len(variables.index_bias)
# Euclidean distance in Equation (2), (4a)
# dist = sum((variables.nod3xyz[pres_bias,0:] - np.tile(variables.nod3xyz[s, 0:],(len(pres_bias),1)))**2) ** .5
dist = np.array((np.sum((variables.nod3xyz[s + self.pres_bias, 0:] - np.tile(variables.nod3xyz[s, 0:],(len(self.pres_bias),1))) ** 2, axis=1))**.5)
# Alpha in Equation (4b) is assumed to be constant
amplitude=self.amplitude0
# Sigma as defined by Equation (4c)
sigma = (self.sigma0*density**2)/((density**2)+(0.5**2))+0.05
# Pressure based on Gaussian function as in Equation (4a)
variables.pres[0:,s+self.pres_bias] = variables.pres[0:,s+self.pres_bias] + amplitude * math.e ** ((-dist**2)/(2*sigma**2))
def VTP(self):
for ss in range(0,self.vind.size):
v = self.vind[0,ss]
# Tumor cell density around vessel cell, here I assume vessel
# only causes additional pressure inside tumor due to membrane
# effect [Ref]
density = np.sum(variables.celltype[0,v+variables.index_bias]>0)/len(variables.index_bias)
# Equation (4b), alpha0 set to be 0.01
amplitude = (0.01*density**2)/(density**2 + 0.5**2)
# Euclidean distance in Equation (4a)
dist = np.array((np.sum((variables.nod3xyz[v + self.pres_bias, 0:] - np.tile(variables.nod3xyz[v, 0:],(len(self.pres_bias),1))) ** 2, axis=1))**.5)
# Equation (4c)
sigma = np.array((self.sigma0*density**2)/((density**2)+(0.5**2))+0.05)
# Add vessel cell induced pressure
variables.pres[0:,v+self.pres_bias] = variables.pres[0:,v+self.pres_bias] + amplitude * math.e ** ((-dist**2)/(2*sigma**2))