code: def bbox(img, border=None, as_slice=False):
      """
      min1,max1,min2,max2 = bbox(img, border={0}, as_slice={False})
  
      Calculate the bounding box of image img.
  
      Parameters
      ----------
      img : ndarray
          Any integer image type
  
      Returns
      -------
      min1,max1,min2,max2 : int,int,int,int
          These are such that ``img[min1:max1, min2:max2]`` contains all non-zero
          pixels. Returned when ``as_slice`` is false (the default)
      s : slice
          A slice representation of the bounding box. Returned when ``as_slice``
          is true
      """
      if not img.shape:
          return np.array([], dtype=np.intp)
      r = _bbox.bbox(img)
      if border:
          r = r.reshape((-1, 2))
          np.maximum(r.T[0] - border, 0, out=r.T[0])
          r.T[1] += border
          r = r.ravel()
      if as_slice:
          r = tuple([slice(s, e) for s, e in r.reshape((-1, 2))])
      return r
  
imports: from __future__ import division
  from .None import _bbox
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: bbox(img, border, as_slice) and returns: r, np