code: def test_parcel_intra_from_3d_image(in_tmp_path):
      """Test that a parcellation is generated, starting from an input 3D image"""
      # Generate an image
      shape = (10, 10, 10)
      n_parcel, nn, mu = 10, 6, 1.0
      mask_image = Nifti1Image(np.ones(shape).astype("u1"), np.eye(4))
      surrogate_3d_dataset(mask=mask_image, out_image_file="image.nii")
  
      # run the algo
      for method in ["ward", "kmeans", "gkm"]:
          osp = fixed_parcellation(
              mask_image,
              ["image.nii"],
              n_parcel,
              nn,
              method,
              in_tmp_path,
              mu,
          )
          result = f"parcel_{method}.nii"
          assert exists(result)
          assert osp.k == n_parcel
  
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 3 for calling a global function with example usage: test_parcel_intra_from_3d_image(in_tmp_path) without return types