code: def slow_otsu(img, ignore_zeros=False):
      hist = fullhistogram(img)
      hist = hist.astype(np.double)
      Hsum = img.size - hist[0]
      if ignore_zeros:
          hist[0] = 0
      if Hsum == 0:
          return 0
      Ng = len(hist)
  
      nB = np.cumsum(hist)
      nO = nB[-1] - nB
      mu_B = 0
      mu_O = np.dot(np.arange(Ng), hist) / Hsum
      best = nB[0] * nO[0] * (mu_B - mu_O) * (mu_B - mu_O)
      bestT = 0
  
      for T in range(1, Ng):
          if nB[T] == 0:
              continue
          if nO[T] == 0:
              break
          mu_B = (mu_B * nB[T - 1] + T * hist[T]) / nB[T]
          mu_O = (mu_O * nO[T - 1] - T * hist[T]) / nO[T]
          sigma_between = nB[T] * nO[T] * (mu_B - mu_O) * (mu_B - mu_O)
          if sigma_between > best:
              best = sigma_between
              bestT = T
      return bestT
  
file_path: mahotas/mahotas/tests/test_thresholding.py
imports: import numpy
  from mahotas.thresholding import otsu, rc, bernsen, gbernsen
  from mahotas.histogram import fullhistogram
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: slow_otsu(img, ignore_zeros) and returns: bestT, int