code: def test_parcel_hierarchical():
      """Test the algorithm for hierrachical parcellation"""
      # step 1:  generate some synthetic data
      n_subj = 10
      shape = (30, 30)
      dataset = surrogate_2d_dataset(n_subj=n_subj, shape=shape)
  
      # step 2 : prepare all the information for the parcellation
      nb_parcel = 10
      domain = grid_domain_from_binary_array(dataset[0] ** 2, np.eye(3))
      ldata = np.reshape(dataset, (n_subj, np.prod(shape), 1))
  
      # step 3 : run the algorithm
      Pa = hparcel(domain, ldata, nb_parcel)
  
      # step 4:  look at the results
      Label = Pa.individual_labels
      control = True
      for s in range(n_subj):
          control *= (
              np.unique(Label[:, s]) == np.arange(nb_parcel)
          ).all()
  
      assert control
  
file_path: nipy/nipy/labs/spatial_models/tests/test_parcel.py
imports: import numpy
  from nipy.algorithms.graph.field import field_from_coo_matrix_and_data
  from ...utils.simul_multisubject_fmri_dataset import surrogate_2d_dataset
  from ..discrete_domain import grid_domain_from_binary_array
  from ..hierarchical_parcellation import hparcel
  from ..parcellation import MultiSubjectParcellation
label_desc: Use image node_id 5 for calling a global function with example usage: test_parcel_hierarchical() without return types