code: def _compute_morph_matrix(
      subject_from,
      subject_to,
      vertices_from,
      vertices_to,
      smooth=None,
      subjects_dir=None,
      warn=True,
      xhemi=False,
  ):
      """Compute morph matrix."""
      logger.info("Computing morph matrix...")
      subjects_dir = get_subjects_dir(subjects_dir, raise_error=True)
  
      tris = _get_subject_sphere_tris(subject_from, subjects_dir)
      maps = read_morph_map(
          subject_from, subject_to, subjects_dir, xhemi
      )
  
      # morph the data
  
      morpher = []
      for hemi_to in range(
          2
      ):  # iterate over to / block-rows of CSR matrix
          hemi_from = (1 - hemi_to) if xhemi else hemi_to
          morpher.append(
              _hemi_morph(
                  tris[hemi_from],
                  vertices_to[hemi_to],
                  vertices_from[hemi_from],
                  smooth,
                  maps[hemi_from],
                  warn,
              )
          )
  
      shape = (
          sum(len(v) for v in vertices_to),
          sum(len(v) for v in vertices_from),
      )
      data = [m.data for m in morpher]
      indices = [m.indices.copy() for m in morpher]
      indptr = [m.indptr.copy() for m in morpher]
      # column indices need to be adjusted
      indices[0 if xhemi else 1] += len(vertices_from[0])
      indices = np.concatenate(indices)
      # row index pointers need to be adjusted
      indptr[1] = indptr[1][1:] + len(data[0])
      indptr = np.concatenate(indptr)
      # data does not need to be adjusted
      data = np.concatenate(data)
      # this is equivalent to morpher = sparse_block_diag(morpher).tocsr(),
      # but works for xhemi mode
      morpher = sparse.csr_matrix((data, indices, indptr), shape=shape)
      logger.info("[done]")
      return morpher
  
imports: import copy
  import os.path
  import warnings
  import numpy
  from scipy import sparse
  from .fixes import _get_img_fdata
  from .morph_map import read_morph_map
  from .parallel import parallel_func
  from .source_estimate import _BaseSourceEstimate, _BaseSurfaceSourceEstimate, _BaseVolSourceEstimate, _get_ico_tris
  from .source_space._source_space import SourceSpaces, _ensure_src, _grid_interp
  from .surface import _compute_nearest, mesh_edges, read_surface
  from .utils import BunchConst, ProgressBar, _check_fname, _check_option, _custom_lru_cache, _ensure_int, _import_h5io_funcs, _import_nibabel, _validate_type, check_version, fill_doc, get_subjects_dir, logger, use_log_level, verbose, warn
  from .utils import warn
label_desc: Use image node_id 14 for calling a global function with example usage: _compute_morph_matrix(subject_from, subject_to, vertices_from, vertices_to, smooth, subjects_dir, warn, xhemi) and returns: morpher