code: def test_sliceparcel():
      parcelmap = np.asarray(
          [[0, 0, 0, 1, 2], [0, 0, 1, 1, 2], [0, 0, 0, 0, 2]]
      )
      parcelseq = ((1, 2), 0, 2)
      o = np.zeros(parcelmap.shape)
      iterator = gen.slice_parcels(parcelmap, labels=parcelseq)
      for i, pair in enumerate(iterator):
          a, s = pair
          o[a][s] = i
      assert_array_equal(
          o,
          np.array([[1, 1, 1, 0, 2], [4, 4, 3, 3, 5], [7, 7, 7, 7, 8]]),
      )
  
file_path: nipy/nipy/core/utils/tests/test_generators.py
imports: import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
  from ...api import slice_generator, write_data
  from ..None import generators
label_desc: Use image node_id 9 for calling a global function with example usage: test_sliceparcel() without return types