code: def _extract_local_histogram(
      image,
      mask=slice(None),
      bins=19,
      rang="image",
      cutoffp=(0.0, 100.0),
      size=None,
      footprint=None,
      output=None,
      mode="ignore",
      origin=0,
  ):
      """
      Internal, single-image version of @see local_histogram
  
      Note: Values outside of the histograms range are not considered.
      Note: Mode constant is not available, instead a mode "ignore" is provided.
      Note: Default dtype of returned values is float.
      """
      if "constant" == mode:
          raise RuntimeError("boundary mode not supported")
      elif "ignore" == mode:
          mode = "constant"
      if "image" == rang:
          rang = tuple(numpy.percentile(image[mask], cutoffp))
      elif not 2 == len(rang):
          raise RuntimeError(
              'the rang must contain exactly two elements or the string "image"'
          )
  
      _, bin_edges = numpy.histogram([], bins=bins, range=rang)
      output = _get_output(
          float if None == output else output,
          image,
          shape=[bins] + list(image.shape),
      )
  
      # threshold the image into the histogram bins represented by the output images first dimension, treat last bin separately, since upper border is inclusive
      for i in range(bins - 1):
          output[i] = (image >= bin_edges[i]) & (
              image < bin_edges[i + 1]
          )
      output[-1] = (image >= bin_edges[-2]) & (image <= bin_edges[-1])
  
      # apply the sum filter to each dimension, then normalize by dividing through the sum of elements in the bins of each histogram
      for i in range(bins):
          output[i] = sum_filter(
              output[i],
              size=size,
              footprint=footprint,
              output=None,
              mode=mode,
              cval=0.0,
              origin=origin,
          )
      divident = numpy.sum(output, 0)
      divident[0 == divident] = 1
      output /= divident
  
      # Notes on modes:
      # mode=constant with a cval outside histogram range for the histogram equals a mode=constant with a cval = 0 for the sum_filter
      # mode=constant with a cval inside  histogram range for the histogram has no equal for the sum_filter (and does not make much sense)
      # mode=X for the histogram equals mode=X for the sum_filter
  
      # treat as multi-spectral image which intensities to extracted
      return _extract_feature(
          _extract_intensities, [h for h in output], mask
      )
  
imports: import numpy
  from scipy.ndimage import gaussian_filter, median_filter
  from scipy.ndimage import gaussian_gradient_magnitude
  from scipy.interpolate.interpolate import interp1d
  from scipy.ndimage import distance_transform_edt
  from scipy.ndimage._ni_support import _get_output
  from .utilities import join
  from ..core import ArgumentError
  from ..filter import sum_filter
label_desc: Use image node_id 13 for calling a global function with example usage: _extract_local_histogram(image, mask, bins, rang, cutoffp, size, footprint, output, mode, origin) and returns: _extract_feature