zea.inverse.inversionΒΆ

High-level drivers for inverting the DAS beamformer.

Recovers pre-beamformed channel data from a post-beamformed (DAS) image. Two inversions are provided:

  • invert_direct() β€” solve for the full channel-data cube directly with CGLS. The DAS operator is massively underdetermined, so this yields the minimum-norm least-squares (pseudo-inverse) solution: it reproduces the image almost exactly but recovers the physical channel data poorly.

  • invert_scatterers() β€” fit point-scatterer magnitudes (positions seeded from the image, shared across transmits) whose simulated channel data reproduces the image. The scatterer parameterization regularizes the nullspace of the DAS operator and recovers channel data far better on point-target scans. Optionally refines positions and magnitudes jointly with Adam.

Functions

invert_direct(operator, image[, n_iter, ...])

Recover channel data from a beamformed image by pseudo-inversion.

invert_scatterers(operator, image[, ...])

Recover channel data from a beamformed image with a scatterer prior.

Classes

InversionResult(channel_data, image[, ...])

Result of a DAS inversion.

class zea.inverse.inversion.InversionResult(channel_data, image, positions=None, magnitudes=None)[source]ΒΆ

Bases: object

Result of a DAS inversion.

Parameters:
  • channel_data (object) – Recovered pre-beamformed channel data of shape (n_tx, n_ax, n_el).

  • image (object) – Re-beamformed image of the recovered channel data, flattened to shape (n_pix,). Compare against the measured image to assess the data fit.

  • positions (object) – Scatterer positions (n_scat, 3). Only set by invert_scatterers().

  • magnitudes (object) – Scatterer magnitudes (n_scat,). Only set by invert_scatterers().

channel_data: objectΒΆ
image: objectΒΆ
magnitudes: object = NoneΒΆ
positions: object = NoneΒΆ
zea.inverse.inversion.invert_direct(operator, image, n_iter=50, jit=True, verbose=False)[source]ΒΆ

Recover channel data from a beamformed image by pseudo-inversion.

Solves min ||operator(channel_data) - image||^2 over the full channel data cube with CGLS starting from zero, which converges to the minimum-norm (Moore-Penrose) solution. This fits the image essentially perfectly but, because the DAS operator has a large nullspace, the minimum-norm solution is generally not the physical channel data β€” see invert_scatterers() for a regularized alternative.

Parameters:
  • operator (DASOperator) – The beamforming operator to invert.

  • image (Tensor) – Measured beamformed image, flattened (n_pix,) or shaped (grid_size_z, grid_size_x).

  • n_iter (int, optional) – CGLS iterations. Defaults to 50.

  • jit (bool, optional) – JIT-compile the operator applications (JAX and TensorFlow backends). Defaults to True.

  • verbose (bool, optional) – Log CGLS progress. Defaults to False.

Returns:

Recovered channel data and its re-beamformed image.

Return type:

InversionResult

zea.inverse.inversion.invert_scatterers(operator, image, n_scatterers=5000, n_iter=50, prob_exponent=2.5, uniform_frac=0.3, refine_iters=0, refine_step_size=0.05, simulator=None, seed=None, jit=True, verbose=False)[source]ΒΆ

Recover channel data from a beamformed image with a scatterer prior.

Seeds point scatterers from the image envelope, then solves the convex subproblem for their magnitudes with CGLS (positions fixed): min ||operator(simulate(positions, magnitudes)) - image||^2. Optionally refines positions and magnitudes jointly with Adam afterwards (refine_iters > 0); positions are optimized in units of wavelength so a single step size applies to both variables.

The scatterer parameterization regularizes the nullspace of the DAS operator: unlike invert_direct(), the recovered channel data is constrained to physically consistent point-scatterer echoes.

Parameters:
  • operator (DASOperator) – The beamforming operator to invert.

  • image (Tensor) – Measured beamformed image, flattened (n_pix,) or shaped (grid_size_z, grid_size_x).

  • n_scatterers (int, optional) – Number of scatterers. Defaults to 5000.

  • n_iter (int, optional) – CGLS iterations for the magnitudes. Defaults to 50.

  • prob_exponent (float, optional) – Seeding sharpness, see zea.inverse.seed_scatterers(). Defaults to 2.5.

  • uniform_frac (float, optional) – Fraction of uniformly seeded scatterers, see zea.inverse.seed_scatterers(). Defaults to 0.3.

  • refine_iters (int, optional) – Adam iterations jointly refining positions and magnitudes. Defaults to 0 (disabled).

  • refine_step_size (float, optional) – Adam step size (wavelengths for positions). Defaults to 0.05.

  • simulator (ScattererSimulator, optional) – Custom simulator. Defaults to ScattererSimulator(operator.parameters).

  • seed (int, optional) – Seed for reproducible scatterer placement.

  • jit (bool, optional) – JIT-compile the operator applications (JAX and TensorFlow backends). Defaults to True.

  • verbose (bool, optional) – Log progress. Defaults to False.

Returns:

Recovered channel data, its re-beamformed image, and the scatterer positions and magnitudes.

Return type:

InversionResult