zea.beamform.lens_correction

Lens corrected delay computation for ultrasound beamforming.

Functions

compute_lens_corrected_travel_times(...[, ...])

Compute the travel time of the shortest path between the element and the pixel.

compute_travel_time(pos_a, pos_b, c)

Compute the travel time between two points.

compute_xl(element_pos_2d, pixel_pos_2d, ...)

Computes the lateral point on the lens that the shortest path goes through based on Fermat's principle.

dxl(xe, ze, xl, xs, zs, zl, c_lens, c_medium)

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.

Parameters:
  • element_pos (ndarray) – The position of the element of shape (n_elements, 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_elements).

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).