code: def test_parcel_based_analysis(in_tmp_path):
      # Generate an image
      shape = (7, 8, 4)
      n_subj = 5
      n_parcel, nn, mu = 10, 6, 1.0
  
      data_image = ["image_%d.nii" % i for i in range(5)]
      for datim in data_image:
          surrogate_3d_dataset(shape=shape, out_image_file=datim)
      ldata = np.random.randn(n_subj, np.prod(shape), 1)
      domain = grid_domain_from_shape(shape)
      parcels = hparcel(domain, ldata, n_parcel, mu=3.0)
      prfx = parcellation_based_analysis(
          parcels,
          data_image,
          test_id="one_sample",
          rfx_path="prfx.nii",
          condition_id="",
          swd=in_tmp_path,
      )
      assert exists("prfx.nii")
      assert np.abs(prfx).max() < 15
  
file_path: nipy/nipy/labs/spatial_models/tests/test_parcel_io.py
imports: from os.path import exists
  import numpy
  from nibabel import Nifti1Image, save
  from numpy.testing import assert_array_equal
  from ...utils.simul_multisubject_fmri_dataset import surrogate_3d_dataset
  from ..discrete_domain import grid_domain_from_shape
  from ..hierarchical_parcellation import hparcel
  from ..parcel_io import fixed_parcellation, mask_parcellation, parcellation_based_analysis
label_desc: Use image node_id 6 for calling a global function with example usage: test_parcel_based_analysis(in_tmp_path) without return types