|
1 | | -# This is an example of python code using VTS to Compute fluence for a two-layer |
2 | | -# medium as a function of radial extent and depth at a given set of optical properties |
| 1 | +# This is an example of python code using VTS to Compute photon hitting density for a two-layer |
| 2 | +# medium at a given set of optical properties |
3 | 3 | # |
4 | 4 | # Import PythonNet |
5 | 5 | from pythonnet import load |
|
59 | 59 | opRegionsArray = Array[Array[IOpticalPropertyRegion]]([opRegions]) |
60 | 60 | # predict the tissue's fluence(rho, z) for the given optical properties |
61 | 61 | fluenceOfRhoAndZ = solver.FluenceOfRhoAndZ(opRegionsArray, allRhos, zs ); |
62 | | -#print("*********************************** FLUENCE *****************************************") |
63 | | -#print(list(fluenceOfRhoAndZ)) |
64 | 62 |
|
65 | 63 | #PHD |
66 | | -print("*********************************** Fluence *****************************************") |
67 | | -print('len(fluenceOfRhoAndZ)=',len(fluenceOfRhoAndZ)) |
68 | 64 | sourceDetectorSeparation = 10 |
69 | 65 | opArray = Array.CreateInstance(OpticalProperties, 2) |
70 | 66 | opArray[0] = OpticalProperties(0.1, 1, 0.8, 1.4) |
71 | 67 | opArray[1] = OpticalProperties(0.01, 1, 0.8, 1.4) |
72 | 68 |
|
73 | 69 | phdOfRhoAndZ = ComputationFactory.GetPHD(solver, fluenceOfRhoAndZ, sourceDetectorSeparation, opArray, Array[Double](allRhos.tolist()), Array[Double](zs.tolist())) |
74 | 70 |
|
75 | | -print("*********************************** RHOS *****************************************") |
76 | | -print(allRhos.tolist()) |
77 | | - |
78 | 71 | # log transform |
79 | 72 | log_fluence = [Math.Log(f) for f in phdOfRhoAndZ] |
80 | 73 |
|
81 | 74 | size = len(zs) |
82 | 75 | # split into rows |
83 | 76 | fluenceRowsToPlot = np.array([log_fluence[i:i+size] for i in range(0, len(log_fluence), size)]) |
84 | | -#print("*********************************** FLUENCE ROWS TO PLOT *****************************************") |
85 | | -#print(fluenceRowsToPlot) |
86 | 77 |
|
| 78 | +# Heatmap function to convert the data into a heat map |
87 | 79 | def heatmap(values, x, y, x_label="", y_label="", title=""): |
88 | 80 | """Create a heatmap chart.""" |
89 | 81 | # values should be a 2D array-like (list of lists or 2D numpy array) |
|
0 commit comments