code: def make_likelihood_image_histogram(
      image,
      scrib,
      scribbles_bg_label,
      scribbles_fg_label,
      num_bins=64,
      return_label=False,
  ):
      if isinstance(image, torch.Tensor):
          image = image.numpy()
      # normalise image in range [0, 1] if needed
      min_img = np.min(image)
      max_img = np.max(image)
      if min_img < 0.0 or max_img > 1.0:
          image = (image - min_img) / (max_img - min_img)
  
      # generate histograms for background/foreground
      bg_hist, fg_hist, bin_edges = make_histograms(
          image,
          scrib,
          scribbles_bg_label,
          scribbles_fg_label,
          alpha_bg=1,
          alpha_fg=1,
          bins=num_bins,
      )
  
      # lookup values for each voxel for generating background/foreground probabilities
      dimage = np.digitize(image, bin_edges[:-1]) - 1
      fprob = fg_hist[dimage]
      bprob = bg_hist[dimage]
      retprob = np.concatenate([bprob, fprob], axis=0)
  
      # if needed, convert to discrete labels instead of probability
      if return_label:
          retprob = np.expand_dims(
              np.argmax(retprob, axis=0), axis=0
          ).astype(np.float32)
  
      return retprob
  
file_path: MONAILabel/monailabel/scribbles/utils.py
imports: import logging
  import numpy
  import numpymaxflow
  import torch
  from monai.networks.layers import GaussianMixtureModel
label_desc: Use image node_id 5 for calling a global function with example usage: make_likelihood_image_histogram(image, scrib, scribbles_bg_label, scribbles_fg_label, num_bins, return_label) and returns: retprob