API Reference
MultilayerCartesianPulseEchoData
Dataset class for pulse-echo data in cartesian coordinate system
Source code in synaptus\multilayer_cartesian_migration.py
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 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
__init__(raw_data, fs, f_low, f_high, x_step, y_step=None, t_delay=0.0, wave_velocities=(1500,), layer_thicknesses=None, nfft_t=None, nfft_x=None, nfft_y=None, omega_upsampling_factor=1)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_data
|
NDArray
|
2D or 3D array containing pulse-echo data, The first dimension corresponds to time, the second to spatial dimension x, and the third to spatial dimension y (if present). |
required |
fs
|
float
|
Sampling frequency of the data (in time domain) in Hz. |
required |
f_low
|
float
|
Low frequency cutoff for the transducer band in Hz. |
required |
f_high
|
float
|
High frequency cutoff for the transducer band in Hz. |
required |
x_step
|
float
|
Spatial step size in the x direction in meters. This is the distance between adjacent transducer positions. |
required |
y_step
|
float | None
|
Spatial step size in the y direction in meters (for 3D data). |
None
|
t_delay
|
float
|
Time delay from pulse transmission to start of data acquisition, in seconds. By default 0.0 |
0.0
|
wave_velocities
|
tuple[float]
|
Wave velocities in the medium(s) through which the wave travels, in meters per second. If only one value is provided, it is assumed that the wave velocity is constant throughout the medium. If not specified, a default value of 1500 m/s is used, which is typical for water/soft tissue. |
(1500,)
|
layer_thicknesses
|
tuple[float] | None
|
Thicknesses of layers through which the wave travels, in meters. If not specified, it is assumed that there is only one layer, and the thickness is estimated the raw data. If multiple layers are specified, the number of layer thicknesses must match the number of wave velocities. |
None
|
nfft_t
|
int | None
|
Number of points for FFT in time dimension. If None, set to the next power of 2 greater than the number of time samples in the raw data. |
None
|
nfft_x
|
int | None
|
Number of points for FFT in x dimension. If None, set to the next power of 2 greater than the number of spatial samples in the x dimension. |
None
|
nfft_y
|
int | None
|
Number of points for FFT in y dimension. If None, set to the next power of 2 greater than the number of spatial samples in the y dimension. |
None
|
omega_upsampling_factor
|
int
|
Factor by which to upsample the omega vector. This is useful for improving the resolution of the frequency-domain representation. Default is 1 (no upsampling). Ignored if nfft_t is specified. |
1
|
Notes
- When processing data in the Fourier domain, "aliasing" artefacts can appear in
the focused image. This problem can be mitigated by increasing the number of
points in the FFTs used, i.e.
nfft_t,nfft_x, ornfft_y. In the time/spatial domain, this corresponds to zero-padding the data.
Source code in synaptus\multilayer_cartesian_migration.py
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 | |
z_shift_wavefield(wavefield, wave_velocity, dz)
Apply a phase shift to the wavefield to account for a depth shift.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavefield
|
NDArray
|
Wavefield in the frequency domain. |
required |
wave_velocity
|
float
|
Wave velocity in the medium (in m/s). |
required |
dz
|
float
|
Depth shift to apply (in meters). |
required |
Returns:
| Type | Description |
|---|---|
NDArray
|
Wavefield with the applied depth shift. |
Source code in synaptus\multilayer_cartesian_migration.py
MultilayerOmegaKMigration
Bases: MultilayerCartesianPulseEchoData
Source code in synaptus\multilayer_cartesian_migration.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
__init__(*args, omega_upsampling_factor=4, **kwargs)
mulok_migrate()
Perform multilayer omega-k (ω-k) migration on the wavefield.
This method applies Stolt migration sequentially to each subsurface layer,
as defined by the provided wave velocities and layer thicknesses. For each layer:
- The depth sampling interval (dz) is computed based on the local wave velocity
and frequency bounds.
- The wavefield is migrated using a Stolt transform, and the resulting image for
the current layer is extracted.
- The wavefield is then propagated (shifted) to the next interface for further migration.
Returns: tuple[list[NDArray], list[NDArray]]: A tuple containing a list of migrated images (one per layer) and a list of corresponding z coordinate vectors for each layer.
Notes: - The migration is performed in the frequency-wavenumber (ω-k) domain.
Source code in synaptus\multilayer_cartesian_migration.py
PhaseShiftMigration
Bases: MultilayerCartesianPulseEchoData
Class for performing phase shift migration on pulse-echo data.
Source code in synaptus\multilayer_cartesian_migration.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
__init__(*args, **kwargs)
calc_phase_shift_tensor(wave_velocity)
Computes the phase shift tensor for wavefield extrapolation at a specified wave velocity.
This method constructs the vertical wavenumber (kz) grid based on the spatial and frequency grids, then calculates the phase shift tensor used for propagating wavefields in depth. The depth increment (dz) is determined from the frequency range and wave velocity. The method supports both 2D and 3D grids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wave_velocity
|
float
|
The propagation velocity of the wave (in meters per second). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
phase_shift_tensor |
NDArray
|
Complex-valued tensor representing the phase shift for each grid point. |
real_wave_index |
NDArray
|
Boolean or integer array indicating the indices of physically meaningful (real) wavenumbers. |
Notes
The phase shift tensor is computed as exp(1j * kz * dz), where kz is the vertical wavenumber grid and dz is the depth increment. This is commonly used in wavefield extrapolation methods such as phase-shift migration.
Source code in synaptus\multilayer_cartesian_migration.py
phase_shift_migrate()
Perform phase shift migration on the wavefield for each subsurface layer.
This method applies the phase shift migration algorithm to the current wavefield, propagating it through each defined subsurface layer using the corresponding wave velocity and layer thickness. For each layer, the wavefield is phase-shifted in the frequency domain, and an image is constructed by inverse Fourier transforming the summed wavefield at each depth step.
Returns: list[NDArray]: A list of 2D or 3D NumPy arrays (depending on self.ndim), where each array represents the migrated image for a corresponding subsurface layer. The images are absolute-valued and cropped to the original spatial dimensions. list[np.ndarray]: A list of 1D NumPy arrays, where each array contains the z coordinate values (in meters) corresponding to the depths of each image. Note that the resolution is not the same in each layer, as it depends on the local wave velocity.
Notes: - The method assumes that self.wavefield, self.wave_velocities, self.layer_thicknesses, self.f_low, self.f_high, self.nx, self.ny, and self.ndim are properly initialized. - Non-physical wave components are suppressed using the real wave index.
Source code in synaptus\multilayer_cartesian_migration.py
load_mat_dataset(filename)
Loads a .mat dataset from the shared datasets folder using scipy.io.
Source code in synaptus\datasets.py
log_image(im)
plot_us_image(image, axes=None, x_val=None, y_val=None, x_label='', y_label='', title='', min_db=-60, max_db=0, figsize=(6, 4), cmap='viridis')
Plot ultrasound image (abs.val.) on logarithmic scale, with colorbar
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray
|
Ultrasound image, typically array of float or complex |
required |
axes
|
Axes | None
|
Axes into which to plot. If None, a new figure and Axes object is created. |
None
|
x_val
|
NDArray | None
|
Vector of values corresponding to horizontal axis (columns) of image. |
None
|
y_val
|
NDArray | None
|
Vector of values corresponding to vertical axis (rows) of image. |
None
|
x_label
|
str
|
Label displayed below X axis in plot, by default "" |
''
|
y_label
|
str
|
Label displayed beside Y axis in plot, by default "" |
''
|
title
|
str
|
Title displayed above plot, by default "" |
''
|
min_db
|
float
|
Minimum value displayed (in dB), by default -60 |
-60
|
max_db
|
float
|
Maximum value displayed (in dB), by default 0 Since the image is normalized so that the maximum value corresponds to 0 dB, there is usually no need to change this. |
0
|
figsize
|
tuple[float, float]
|
Size of figure (if axes parameter is None), by default (6, 4) |
(6, 4)
|
cmap
|
str | Colormap
|
Colormap used when plotting image, by default "viridis" |
'viridis'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
Raises error if image array is not 2D. |