code: def _ball_sample_locations(
      mesh, affine, ball_radius=3.0, n_points=20, depth=None
  ):
      """Locations to draw samples from to project volume data onto a mesh.
  
      For each mesh vertex, the locations of `n_points` points evenly spread in a
      ball around the vertex are returned.
  
      Parameters
      ----------
      mesh : pair of :obj:`numpy.ndarray`s.
          `mesh[0]` contains the 3d coordinates of the vertices
          (shape n_vertices, 3)
          `mesh[1]` contains, for each triangle,
          the indices into `mesh[0]` of its vertices (shape n_triangles, 3)
  
      affine : :obj:`numpy.ndarray` of shape (4, 4)
          Affine transformation from image voxels to the vertices' coordinate
          space.
  
      ball_radius : :obj:`float`, default=3.0
          Size in mm of the neighbourhood around each vertex in which to draw
          samples.
  
      n_points : :obj:`int`, default=20
          Number of samples to draw for each vertex.
  
      depth : `None`
          Raises a `ValueError` if not `None` because incompatible with this
          sampling strategy.
  
      Returns
      -------
      sample_location_voxel_space : :obj:`numpy.ndarray`, \
          shape (n_vertices, n_points, 3)
          The locations, in voxel space, from which to draw samples.
          First dimension iterates over mesh vertices, second dimension iterates
          over the sample points associated to a vertex, third dimension is x, y,
          z in voxel space.
  
      """
      if depth is not None:
          raise ValueError(
              "The 'ball' sampling strategy does not support "
              "the 'depth' parameter"
          )
      vertices, faces = mesh
      offsets_world_space = (
          _load_uniform_ball_cloud(n_points=n_points) * ball_radius
      )
      mesh_voxel_space = np.asarray(
          resampling.coord_transform(
              *vertices.T, affine=np.linalg.inv(affine)
          )
      ).T
      linear_map = np.eye(affine.shape[0])
      linear_map[:-1, :-1] = affine[:-1, :-1]
      offsets_voxel_space = np.asarray(
          resampling.coord_transform(
              *offsets_world_space.T, affine=np.linalg.inv(linear_map)
          )
      ).T
      sample_locations_voxel_space = (
          mesh_voxel_space[:, np.newaxis, :]
          + offsets_voxel_space[np.newaxis, :]
      )
      return sample_locations_voxel_space
  
imports: import gzip
  import os
  import warnings
  from collections import namedtuple
  from collections.abc import Mapping
  import nibabel
  import numpy
  import sklearn.cluster
  import sklearn.preprocessing
  from nibabel import freesurfer, gifti
  from scipy import interpolate, sparse
  from nilearn import _utils, datasets
  from nilearn._utils import stringify_path
  from nilearn._utils.path_finding import resolve_globbing
  from nilearn.image import get_data, load_img, resampling
label_desc: Use image node_id 7 for calling a global function with example usage: _ball_sample_locations(mesh, affine, ball_radius, n_points, depth) and returns: sample_locations_voxel_space