UltrasoundWithZea#
- class deepinv.physics.UltrasoundWithZea(pipeline, parameters, transmits_per_group=None, **kwargs)[source]#
Bases:
LinearPhysicsUltrasound imaging operator with a zea beamforming pipeline.
General ultrasound physics where measurements
yare IQ or RF raw channel data, and imagesxare 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.Parametersobject.Measurements
yhave shape(B, C, n_tx, n_ax, n_el)whereC = n_ch(1 for RF, 2 for IQ data, 1 ifparametershas non_ch), and the imagexhas 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_groupto 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 withpip install zeaand setKERAS_BACKEND=torchbefore 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_transmitscorrespond 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
paramsazea.ParametersandyRF 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:
- 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:
Examples using UltrasoundWithZea:#
Ultrasound regularized beamforming with zea toolbox