code: def otsu(img, ignore_zeros=False):
      """
      T = otsu(img, ignore_zeros=False)
  
      Calculate a threshold according to the Otsu method.
  
      Example::
  
          import mahotas as mh
          import mahotas.demos
  
          im = mahotas.demos.nuclear_image()
          # im is stored as RGB, let's convert to single 2D format:
          im = im.max(2)
  
          #Now, we compute Otsu:
          t = mh.otsu(im)
  
          # finally, we use the value to form a binary image:
          bin = (im > t)
  
      See Wikipedia for details on methods:
      https://en.wikipedia.org/wiki/Otsu's_method
  
      Parameters
      ----------
      img : an image as a numpy array.
          This should be of an unsigned integer type.
      ignore_zeros : Boolean
          whether to ignore zero-valued pixels
          (default: False)
  
      Returns
      -------
      T : integer
          the threshold
      """
      _verify_is_integer_type(img, "otsu")
      hist = fullhistogram(img)
      hist = np.asanyarray(hist, dtype=np.double)
      if ignore_zeros:
          hist[0] = 0
      return _histogram.otsu(hist)
  
file_path: mahotas/mahotas/thresholding.py
imports: from __future__ import division
  import numpy
  from .histogram import fullhistogram
  from .None import _histogram
  from .internal import _verify_is_integer_type
label_desc: Use image node_id 1 for calling a global function with example usage: otsu(img, ignore_zeros) and returns: _histogram