code: def equalize(
      image,
      footprint,
      out=None,
      mask=None,
      shift_x=False,
      shift_y=False,
      shift_z=False,
  ):
      """Equalize image using local histogram.
  
      Parameters
      ----------
      image : ([P,] M, N) ndarray (uint8, uint16)
          Input image.
      footprint : ndarray
          The neighborhood expressed as an ndarray of 1's and 0's.
      out : ([P,] M, N) array (same dtype as input)
          If None, a new array is allocated.
      mask : ndarray (integer or float), optional
          Mask array that defines (>0) area of the image included in the local
          neighborhood. If None, the complete image is used (default).
      shift_x, shift_y, shift_z : int
          Offset added to the footprint center point. Shift is bounded to the
          footprint sizes (center must be inside the given footprint).
  
      Returns
      -------
      out : ([P,] M, N) ndarray (same dtype as input image)
          Output image.
  
      Examples
      --------
      >>> from skimage import data
      >>> from skimage.morphology import disk, ball
      >>> from skimage.filters.rank import equalize
      >>> import numpy as np
      >>> img = data.camera()
      >>> rng = np.random.default_rng()
      >>> volume = rng.integers(0, 255, size=(10,10,10), dtype=np.uint8)
      >>> equ = equalize(img, disk(5))
      >>> equ_vol = equalize(volume, ball(5))
  
      """
  
      np_image = np.asanyarray(image)
      if np_image.ndim == 2:
          return _apply_scalar_per_pixel(
              generic_cy._equalize,
              image,
              footprint,
              out=out,
              mask=mask,
              shift_x=shift_x,
              shift_y=shift_y,
          )
      elif np_image.ndim == 3:
          return _apply_scalar_per_pixel_3D(
              generic_cy._equalize_3D,
              image,
              footprint,
              out=out,
              mask=mask,
              shift_x=shift_x,
              shift_y=shift_y,
              shift_z=shift_z,
          )
      raise ValueError(
          f"`image` must have 2 or 3 dimensions, got {np_image.ndim}."
      )
  
imports: import numpy
  from scipy import ndimage
  from ..._shared.utils import check_nD, warn
  from ...morphology.footprints import _footprint_is_sequence
  from ...util import img_as_ubyte
  from .None import generic_cy
label_desc: Use image node_id 7 for calling a global function with example usage: equalize(image, footprint, out, mask, shift_x, shift_y, shift_z) and returns: _apply_scalar_per_pixel, _apply_scalar_per_pixel_3D