zea.beamform.pixelgrid

Pixel grid calculation for ultrasound beamforming.

Functions

cartesian_pixel_grid(xlims, zlims[, ...])

Generate a Cartesian pixel grid based on input parameters.

check_for_aliasing(scan)

Checks if the scan class parameters will cause spatial aliasing due to a too low pixel density.

polar_pixel_grid(polar_limits, zlims, ...)

Generate a polar grid.

radial_pixel_grid(rlims, dr, oris, dirs)

Generate a focused pixel grid based on input parameters.

zea.beamform.pixelgrid.cartesian_pixel_grid(xlims, zlims, grid_size_x=None, grid_size_z=None, dx=None, dz=None)[source]

Generate a Cartesian pixel grid based on input parameters.

Parameters:
  • xlims (tuple) – Azimuthal limits of pixel grid ([xmin, xmax])

  • zlims (tuple) – Depth limits of pixel grid ([zmin, zmax])

  • grid_size_x (int) – Number of azimuthal pixels, overrides dx and dz parameters

  • grid_size_z (int) – Number of depth pixels, overrides dx and dz parameters

  • dx (float) – Pixel spacing in azimuth

  • dz (float) – Pixel spacing in depth

Raises:

ValueError – Either grid_size_x and grid_size_z or dx and dz must be defined.

Returns:

Pixel grid of size (grid_size_z, nx, 3) in

Cartesian coordinates (x, y, z)

Return type:

grid (np.ndarray)

zea.beamform.pixelgrid.check_for_aliasing(scan)[source]

Checks if the scan class parameters will cause spatial aliasing due to a too low pixel density. If so, a warning is printed with a suggestion to increase the pixel density by either increasing the number of pixels, or decreasing the pixel spacing, depending on which parameter was set by the user.

zea.beamform.pixelgrid.polar_pixel_grid(polar_limits, zlims, num_radial_pixels, num_polar_pixels)[source]

Generate a polar grid.

Uses radial_pixel_grid but based on parameters that are present in the scan class.

Parameters:
  • polar_limits (tuple) – Polar limits of pixel grid ([polar_min, polar_max])

  • zlims (tuple) – Depth limits of pixel grid ([zmin, zmax])

  • num_radial_pixels (int, optional) – Number of depth pixels.

  • num_polar_pixels (int, optional) – Number of polar pixels.

Returns:

Pixel grid of size (num_radial_pixels, num_polar_pixels, 3) in Cartesian coordinates (x, y, z)

Return type:

grid (np.ndarray)

zea.beamform.pixelgrid.radial_pixel_grid(rlims, dr, oris, dirs)[source]

Generate a focused pixel grid based on input parameters.

To accommodate the multitude of ways of defining a focused transmit grid, we define pixel “rays” or “lines” according to their origins (oris) and directions (dirs). The position along the ray is defined by its limits (rlims) and spacing (dr).

Parameters:
  • rlims (tuple) – Radial limits of pixel grid ([rmin, rmax])

  • dr (float) – Pixel spacing in radius

  • oris (np.ndarray) – Origin of each ray in Cartesian coordinates (x, y, z) with shape (nrays, 3)

  • dirs (np.ndarray) – Steering direction of each ray in azimuth, in units of radians (nrays, 2)

Returns:

Pixel grid of size (nr, nrays, 3) in

Cartesian coordinates (x, y, z), with nr being the number of radial pixels.

Return type:

grid (np.ndarray)