-
Notifications
You must be signed in to change notification settings - Fork 14
/
run_all.py
191 lines (174 loc) · 5.76 KB
/
run_all.py
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
187
188
189
190
191
"""
SPDX-FileCopyrightText: 2021 International Photoacoustic Standardisation Consortium (IPASC)
SPDX-FileCopyrightText: 2021 Andreas Hauptmann
SPDX-FileCopyrightText: 2022 Jenni Poimala
SPDX-FileCopyrightText: 2021 Janek Gröhl
SPDX-FileCopyrightText: 2021 François Varray
SPDX-License-Identifier: MIT
"""
from tests.reconstruction_algorithms.test_baseline_delay_and_sum import TestDelayAndSum
from tests.reconstruction_algorithms.test_delay_multiply_and_sum import TestDelayMultiplyAndSum
from tests.reconstruction_algorithms.test_fftbased_jaeger import TestFFTbasedJaeger
from tests.reconstruction_algorithms.test_baseline_fft_reconstruction import TestFFTbasedHauptmann
import matplotlib.pyplot as plt
# #####################################################################
# TEST IMAGES DOCUMENTATION
# All images are distributed via the MIT license
# #####################################################################
# #####################################################################
#
# IMAGE_IDX = 0
# Simulated image of two tubular structured underneath a horizontal layer
# provided by Janek Gröhl. SOS=1540
#
# #####################################################################
#
# IMAGE_IDX = 1
# Simulated image of point sources in a homogeneous medium provided by
# Janek Gröhl. SOS=1540
#
# #####################################################################
#
# IMAGE_IDX = 2
# Experimental image provided by Manojit Pramanik. It is a point absorber
# in a homogeneous medium. SOS=1480
#
# #####################################################################
#
# IMAGE_IDX = 3
# Simulated image of point sources in a homogeneous medium provided by
# François Varray. 10 point absorbers are located in a homogeneous medium
# at depths between 10 and 40 mm. With increasing depth, they are
# also positioned laterally between 0 and 30 mm. SOS=1540
#
# #####################################################################
#
# IMAGE_IDX = 4
# Experimental measurement of a point source in a homogeneous medium.
# Measurement is provided by Mengjie Shi. Apparent SOS: 1380
#
# #####################################################################
IMAGE_IDX = 5
# Experimental measurement of a point source in a homogeneous medium.
# Measurement is provided by Mengjie Shi. Apparent SOS: 1380
#
# #####################################################################
#
# IMAGE_IDX = 6
# Experimental measurement of a foot.
# Measurement is provided by Minsik Sung. Apparent SOS: 1500
#
# #####################################################################
SPEED_OF_SOUND = 1380
NON_NEGATIVITY_METHOD = "log" # One of "log", "hilbert", "abs", "zero", "hilbert_squared", "log_squared"
LOWCUT = 1e4
HIGHCUT = 2e7
out = TestDelayAndSum()
out.p_factor = 1
out.fnumber = 0
out.p_SCF = 0
out.speed_of_sound_m_s = SPEED_OF_SOUND
out.lowcut = LOWCUT
out.highcut = HIGHCUT
out.non_negativity_method = NON_NEGATIVITY_METHOD
result1 = out.back_project(IMAGE_IDX, visualise=False)
out.fnumber = 1.0
result2 = out.back_project(IMAGE_IDX, visualise=False)
out.fnumber = 0
out.p_factor = 1.5
result3 = out.back_project(IMAGE_IDX, visualise=False)
out.fnumber = 0
out.p_factor = 1
out.p_SCF = 1
result4 = out.back_project(IMAGE_IDX, visualise=False)
out.p_SCF = 0
out.p_PCF = 1
result5 = out.back_project(IMAGE_IDX, visualise=False)
out = TestFFTbasedJaeger()
out.non_negativity_method = NON_NEGATIVITY_METHOD
out.speed_of_sound_m_s = SPEED_OF_SOUND
out.time_delay = 0
out.zero_padding_transducer_dimension = 1
out.zero_padding_time_dimension = 1
out.coefficientT = 5
out.lowcut = LOWCUT
out.highcut = HIGHCUT
result6 = out.fftbasedJaeger(IMAGE_IDX, visualise=False)
out = TestDelayMultiplyAndSum()
out.speed_of_sound_m_s = SPEED_OF_SOUND
out.lowcut = LOWCUT
out.highcut = HIGHCUT
out.non_negativity_method = NON_NEGATIVITY_METHOD
out.fnumber = 0
out.signed_dmas = False
result8 = out.back_project(IMAGE_IDX, visualise=False)
out = TestDelayMultiplyAndSum()
out.speed_of_sound_m_s = SPEED_OF_SOUND
out.lowcut = LOWCUT
out.highcut = HIGHCUT
out.non_negativity_method = NON_NEGATIVITY_METHOD
out.fnumber = 1
out.signed_dmas = False
result9 = out.back_project(IMAGE_IDX, visualise=False)
out = TestDelayMultiplyAndSum()
out.speed_of_sound_m_s = SPEED_OF_SOUND
out.lowcut = LOWCUT
out.highcut = HIGHCUT
out.non_negativity_method = NON_NEGATIVITY_METHOD
out.fnumber = 0
out.signed_dmas = True
result10 = out.back_project(IMAGE_IDX, visualise=False)
vmin = None
vmax = None
if NON_NEGATIVITY_METHOD == "log" or NON_NEGATIVITY_METHOD == "log_squared":
vmin = -40
vmax = 0
plt.figure(figsize=(10, 9))
plt.subplot(3, 3, 1)
plt.title("DAS")
plt.axis("off")
plt.imshow(result1[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.subplot(3, 3, 2)
plt.axis("off")
plt.title("DAS + fnumber")
plt.imshow(result2[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.subplot(3, 3, 3)
plt.axis("off")
plt.title("DAS + p-factor")
plt.imshow(result3[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.subplot(3, 3, 4)
plt.axis("off")
plt.title("DAS + SCF")
plt.imshow(result4[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.subplot(3, 3, 5)
plt.axis("off")
plt.title("DAS + PCF")
plt.imshow(result5[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.subplot(3, 3, 6)
plt.axis("off")
plt.title("FFT-based")
plt.imshow(result6[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.subplot(3, 3, 7)
plt.axis("off")
plt.title("DMAS")
plt.imshow(result8[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.subplot(3, 3, 8)
plt.axis("off")
plt.title("DMAS + fnumber")
plt.imshow(result9[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.subplot(3, 3, 9)
plt.axis("off")
plt.title("sDMAS")
plt.imshow(result10[:, 0, :, 0, 0].T, vmin=vmin, vmax=vmax)
plt.colorbar()
plt.show()
plt.tight_layout()
plt.savefig("overview.png")