UltrasoundWithZea#

class deepinv.physics.UltrasoundWithZea(pipeline, parameters, transmits_per_group=None, **kwargs)[source]#

Bases: LinearPhysics

Ultrasound imaging operator with a zea beamforming pipeline.

General ultrasound physics where measurements y are IQ or RF raw channel data, and images x are IQ or RF beamformed images.

Implemented with zea [1]. The adjoint \(A^{\top}\) is defined by a closed-form differentiable beamforming pipeline (typically delay-and-sum (DAS)), and the forward operator \(A\) is computed with automatic differentiation.

Allows any type of ultrasound geometry and transmit scheme supported by zea, e.g. plane waves, diverging waves, focused lines, etc., as well as any linear preprocessing that is part of the pipeline, such as demodulation and downsampling.

The acquisition (probe, transmits, pixel grid, …) is described by a zea.Parameters object.

Measurements y have shape (B, C, n_tx, n_ax, n_el) where C = n_ch (1 for RF, 2 for IQ data, 1 if parameters has no n_ch), and the image x has shape (B, C', ...) e.g. (B, 2, Z, X) for an IQ image.

Tip

Beamforming many transmits at once can use a lot of memory. Use transmits_per_group to process transmits in groups sequentially.

Note

For a plane-wave operator with a closed-form forward operator, see deepinv.physics.UltrasoundPlaneWave.

Note

This class requires zea. Install with pip install zea and set KERAS_BACKEND=torch before importing zea.

Note

This physics does not yet support updating the zea pipeline, params or geometry on the fly. If this feature is important for you, please raise a feature request issue on GitHub.

Parameters:
  • pipeline (zea.Pipeline) – zea linear beamforming (adjoint) pipeline that maps channel data to an image e.g. zea.Pipeline([Demodulate(), Downsample(4), Beamform()]).

  • parameters (zea.Parameters) – zea acquisition parameters. The transmits in parameters.selected_transmits correspond to the transmit axis of the measurements.

  • transmits_per_group (int, None) – number of transmits beamformed at once. If None (default), all transmits are beamformed at once.


Examples:

With params a zea.Parameters and y RF channel data of shape (B, 1, n_tx, n_ax, n_el):

from zea.ops import Beamform, Demodulate, Downsample

pipeline = zea.Pipeline([Demodulate(), Downsample(factor=4), Beamform()])
physics = dinv.physics.UltrasoundWithZea(pipeline, params)
x_das = physics.A_adjoint(y)  # DAS image, (B, 2, Z, X)
y_hat = physics.A(x_das)  # back to channel data, (B, 1, n_tx, n_ax, n_el)


References:

A(x, **kwargs)[source]#

Computes the channel data \(Ax\), as the adjoint of the zea pipeline obtained with automatic differentiation.

Parameters:

x (torch.Tensor) – image of shape (B, C', ...).

Returns:

(torch.Tensor) channel data of shape (B, C, n_tx, n_ax, n_el).

Return type:

torch.Tensor

A_adjoint(y, **kwargs)[source]#

Beamforms the channel data with the zea pipeline, i.e. computes \(A^{\top}y\).

Parameters:

y (torch.Tensor) – channel data of shape (B, C, n_tx, n_ax, n_el).

Returns:

(torch.Tensor) image of shape (B, C', ...).

Return type:

torch.Tensor

Examples using UltrasoundWithZea:#

Ultrasound regularized beamforming with zea toolbox

Ultrasound regularized beamforming with zea toolbox