class_docstr: Compute confidence map from an ultrasound image.
  This transform uses the method introduced by Karamalis et al. in https://doi.org/10.1016/j.media.2012.07.005.
  It generates a confidence map by setting source and sink points in the image and computing the probability
  for random walks to reach the source for each pixel.
  
  Args:
      alpha (float, optional): Alpha parameter. Defaults to 2.0.
      beta (float, optional): Beta parameter. Defaults to 90.0.
      gamma (float, optional): Gamma parameter. Defaults to 0.05.
      mode (str, optional): 'RF' or 'B' mode data. Defaults to 'B'.
      sink_mode (str, optional): Sink mode. Defaults to 'all'. If 'mask' is selected, a mask must be when calling
          the transform. Can be 'all', 'mid', 'min', or 'mask'.
docstr: Compute attenuation weighting
  
  Args:
      img (NDArray): Image
      alpha: Attenuation coefficient (see publication)
  
  Returns:
      w (NDArray): Weighting expressing depth-dependent attenuation
docstr_tok: ["Compute","attenuation","weighting","Args",":","img","(","NDArray",")",":","Image","alpha",":","Attenuation","coefficient","(","see","publication",")","Returns",":","w","(","NDArray",")",":","Weighting","expressing","depth-dependent","attenuation"]
code: def attenuation_weighting(
      self, img: NDArray, alpha: float
  ) -> NDArray:
      """Compute attenuation weighting
  
      Args:
          img (NDArray): Image
          alpha: Attenuation coefficient (see publication)
  
      Returns:
          w (NDArray): Weighting expressing depth-dependent attenuation
      """
  
      # Create depth vector and repeat it for each column
      dw = np.linspace(0, 1, img.shape[0], dtype="float64")
      dw = np.tile(dw.reshape(-1, 1), (1, img.shape[1]))
  
      w: NDArray = 1.0 - np.exp(-alpha * dw)  # Compute exp inline
  
      return w
  
file_path: MONAI/monai/data/ultrasound_confidence_map.py
imports: from __future__ import annotations
  import numpy
  from numpy.typing import NDArray
  from monai.utils import min_version, optional_import
label_desc: Use image node_id 5 for calling the UltrasoundConfidenceMap obj's underlying member method code with example usage: obj.attenuation_weighting(img, alpha) and returns: w