zea.beamform.lens_correction¶
Lens-corrected delay computation for ultrasound beamforming.
The acoustic lens fitted over most ultrasound probes has a lower speed of sound than the surrounding medium (tissue / water), ~1000 m/s versus 1540 m/s, which shortens the travel time near the face of the transducer and alters the effective focus. We assume a flat lens with uniform thickness and speed of sound.
The corrected one-way travel time from each transducer element to each image pixel is computed by finding the lateral crossing point \(x_l\) on the lens surface that minimises total travel time (Fermat’s principle):
where \((x_e, 0)\) is the element position, \((x_s, z_s)\) is the pixel position, and \(z_l\) is the lens thickness. Setting \(\partial T / \partial x_l = 0\) recovers Snell’s law:
The root is found iteratively via Newton-Raphson.
Note
This is more physically accurate than the scalar lensCorrection field
used by Verasonics, which adds a single constant delay offset uniformly
across all elements and ignores angle-dependent refraction.
Functions
|
Compute the travel time of the shortest path between the element and the pixel. |
|
Compute the travel time between two points. |
|
Computes the lateral point on the lens that the shortest path goes through based on Fermat's principle. |
|
Computes the update step for the lateral point on the lens that the shortest path using the Newton-Raphson method. |
- zea.beamform.lens_correction.compute_lens_corrected_travel_times(element_pos, pixel_pos, lens_thickness, c_lens, c_medium, n_iter=1)[source]¶
Compute the travel time of the shortest path between the element and the pixel.
Note
This function assumes a flat array geometry.
- Parameters:
element_pos (ndarray) – The position of the element of shape (n_el, 3).
pixel_pos (ndarray) – The position of the pixel of shape (n_pixels, 3).
lens_thickness (float) – The thickness of the lens in meters.
c_lens (float) – The speed of sound in the lens in m/s.
c_medium (float) – The speed of sound in the medium in m/s.
n_iter (int) – The number of iterations to run the Newton-Raphson method.
- Returns:
The travel times of shape (n_pixels, n_el).
- Return type:
ndarray
- zea.beamform.lens_correction.compute_travel_time(pos_a, pos_b, c)[source]¶
Compute the travel time between two points.
- zea.beamform.lens_correction.compute_xl(element_pos_2d, pixel_pos_2d, lens_thickness, c_lens, c_medium, n_iter)[source]¶
Computes the lateral point on the lens that the shortest path goes through based on Fermat’s principle.
- Parameters:
element_pos_2d (float) – The 2D position of the element.
pixel_pos_2d (float) – The 2D position of the pixel.
lens_thickness (float) – The thickness of the lens in meters.
c_lens (float) – The speed of sound in the lens in m/s.
c_medium (float) – The speed of sound in the medium in m/s.
n_iter (int) – The number of iterations to run the Newton-Raphson method.
- Returns:
The x-coordinate of the lateral point on the lens.
- Return type:
float
- zea.beamform.lens_correction.dxl(xe, ze, xl, xs, zs, zl, c_lens, c_medium)[source]¶
Computes the update step for the lateral point on the lens that the shortest path using the Newton-Raphson method.
Notes
This result was derived by defining the total travel time through the lens and the medium as a function of the lateral point on the lens and then taking the derivative. We then have a function whose root is the lateral point on the lens that the shortest path goes through. We then compute the derivative and update the lateral point on the lens using the Newton-Raphson method: x_new = x - f(x) / f’(x).