code: def slice_parcels(data, labels=None, axis=0):
      """
      A generator for slicing through parcels and slices of data...
  
      hmmm... a better description is needed
  
      >>> x=np.array([[0,0,0,1],[0,1,0,1],[2,2,0,1]])
      >>> for a in slice_parcels(x):
      ...     print(a, x[a])
      ...
      ((0,), array([ True,  True,  True, False], dtype=bool)) [0 0 0]
      ((0,), array([False, False, False,  True], dtype=bool)) [1]
      ((1,), array([ True, False,  True, False], dtype=bool)) [0 0]
      ((1,), array([False,  True, False,  True], dtype=bool)) [1 1]
      ((2,), array([False, False,  True, False], dtype=bool)) [0]
      ((2,), array([False, False, False,  True], dtype=bool)) [1]
      ((2,), array([ True,  True, False, False], dtype=bool)) [2 2]
      >>> for a in slice_parcels(x, axis=1):
      ...     b, c = a
      ...     print(a, x[b][c])
      ...
      ((slice(None, None, None), 0), array([ True,  True, False], dtype=bool)) [0 0]
      ((slice(None, None, None), 0), array([False, False,  True], dtype=bool)) [2]
      ((slice(None, None, None), 1), array([ True, False, False], dtype=bool)) [0]
      ((slice(None, None, None), 1), array([False,  True, False], dtype=bool)) [1]
      ((slice(None, None, None), 1), array([False, False,  True], dtype=bool)) [2]
      ((slice(None, None, None), 2), array([ True,  True,  True], dtype=bool)) [0 0 0]
      ((slice(None, None, None), 3), array([ True,  True,  True], dtype=bool)) [1 1 1]
      """
      for i, d in slice_generator(data, axis=axis):
          for p in parcels(d, labels=labels):
              yield (i, p)
  
file_path: nipy/nipy/core/utils/generators.py
imports: import numpy
  from nipy.utils import seq_prod
label_desc: Use image node_id 6 for calling a global function with example usage: slice_parcels(data, labels, axis) without return types