code: def make_histograms(
      image,
      scrib,
      scribbles_bg_label,
      scribbles_fg_label,
      alpha_bg=1,
      alpha_fg=1,
      bins=32,
  ):
      # alpha forms the pseudo-counts for Dirichlet distribution used here as
      # conjugate prior to histogram distributions which enables us to make
      # histograms work in cases where only foreground or only background scribbles are provide
  
      # alpha can be:
      # - a scalar, where it is expanded into a list of size==bins
      # - a list of scalars, where it is checked against size==bins and applied
  
      def expand_pseudocounts(alpha):
          # expand pseudo-counts into array if needed
          if not isinstance(alpha, list):
              alpha = [alpha] * bins
          elif len(alpha) != bins:
              raise ValueError(
                  "pseudo-counts size does not match number of bins in histogram, received: {} | num_bins {}".format(
                      len(alpha), bins
                  )
              )
          alpha = np.array(alpha)
          return alpha
  
      alpha_bg = expand_pseudocounts(alpha_bg)
      alpha_fg = expand_pseudocounts(alpha_fg)
  
      # collect background voxels
      values = image[scrib == scribbles_bg_label]
      # generate histogram for background
      bg_hist, _ = np.histogram(
          values, bins=bins, range=(0, 1), density=False
      )
  
      # collect foreground voxels
      values = image[scrib == scribbles_fg_label]
      # generate histrogram for foreground
      fg_hist, fg_bin_edges = np.histogram(
          values, bins=bins, range=(0, 1), density=False
      )
  
      # add Dirichlet distribution as conjugate prior for our histogram distributions
      bg_hist = bg_hist + alpha_bg
      fg_hist = fg_hist + alpha_fg
  
      # normalise histograms
      bg_hist = bg_hist / np.sum(bg_hist)
      fg_hist = fg_hist / np.sum(fg_hist)
  
      # normalise histograms and return
      return (
          bg_hist.astype(np.float32),
          fg_hist.astype(np.float32),
          fg_bin_edges.astype(np.float32),
      )
  
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 4 for calling a global function with example usage: make_histograms(image, scrib, scribbles_bg_label, scribbles_fg_label, alpha_bg, alpha_fg, bins) and returns: bg_hist,  fg_hist,  fg_bin_edges, alpha