code: def test_parcel():
      parcelmap = np.zeros(DATA3.shape)
      parcelmap[0, 0, 0] = 1
      parcelmap[1, 1, 1] = 1
      parcelmap[2, 2, 2] = 1
      parcelmap[1, 2, 1] = 2
      parcelmap[2, 3, 2] = 2
      parcelmap[0, 1, 0] = 2
      parcelseq = (0, 1, 2, 3)
      expected = [np.prod(DATA3.shape) - 6, 3, 3, 0]
      iterator = gen.data_generator(
          DATA3, gen.parcels(parcelmap, labels=parcelseq)
      )
      for i, pair in enumerate(iterator):
          s, d = pair
          assert (expected[i],) == d.shape
      iterator = gen.data_generator(DATA3, gen.parcels(parcelmap))
      for i, pair in enumerate(iterator):
          s, d = pair
          assert (expected[i],) == d.shape
  
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 5 for calling a global function with example usage: test_parcel() without return types