bmode#

deepinv.utils.bmode(x, dim=-2, *, amplitude_floor_db=-60.0, dynamic_range=None, reference=None, normalize=True)[source]#

Compute log-compressed brightness mode (B-Mode) image.

\[\mathrm{B}(x) = 20 \log_{10} \left(\frac{x_a}{x_\mathrm{ref}} \right),\]

where \(x_a\) is the envelope of \(x\), i.e. the modulus of its analytical signal (see deepinv.utils.hilbert()) or its modulus if \(x\) is complex-valued, and \(x_\mathrm{ref}\) a reference amplitude. The result is clipped to \([\mathrm{amplitude\_floor\_db}, \mathrm{amplitude\_floor\_db} + \mathrm{dynamic\_range}]\).

Parameters:
  • x (torch.Tensor) – input signal of shape (B, ...)

  • dim (int) – dimension along which the envelope is computed. (default: -2)

  • amplitude_floor_db (float) – lower bound of the display window, in dB relative to the reference. (default: -60)

  • dynamic_range (float) – width of the display window in dB. If None, the window ends at 0 dB. (default: None)

  • reference (float, torch.Tensor) – reference amplitude mapped to 0 dB. If None, the maximum of the envelope of each element of the batch. (default: None)

  • normalize (bool) – if True, the display window is linearly mapped to [0, 1], which is convenient for display or for saving the image. (default: True)

Returns:

(torch.Tensor) the log-compressed image, in dB or in [0, 1] if normalize is True.

Return type:

Tensor

Examples using bmode:#

Tour of ultrafast ultrasound in DeepInverse

Tour of ultrafast ultrasound in DeepInverse

In-vivo ultrafast ultrasound reconstruction with Plug-and-Play

In-vivo ultrafast ultrasound reconstruction with Plug-and-Play