code: def read_morph_map(
      subject_from,
      subject_to,
      subjects_dir=None,
      xhemi=False,
      verbose=None,
  ):
      """Read morph map.
  
      Morph maps can be generated with mne_make_morph_maps. If one isn't
      available, it will be generated automatically and saved to the
      ``subjects_dir/morph_maps`` directory.
  
      Parameters
      ----------
      subject_from : str
          Name of the original subject as named in the ``SUBJECTS_DIR``.
      subject_to : str
          Name of the subject on which to morph as named in the ``SUBJECTS_DIR``.
      subjects_dir : path-like
          Path to ``SUBJECTS_DIR`` is not set in the environment.
      xhemi : bool
          Morph across hemisphere. Currently only implemented for
          ``subject_to == subject_from``. See notes of
          :func:`mne.compute_source_morph`.
      %(verbose)s
  
      Returns
      -------
      left_map, right_map : ~scipy.sparse.csr_matrix
          The morph maps for the 2 hemispheres.
      """
      subjects_dir = get_subjects_dir(subjects_dir, raise_error=True)
  
      # First check for morph-map dir existence
      mmap_dir = subjects_dir / "morph-maps"
      if not mmap_dir.is_dir():
          try:
              os.mkdir(mmap_dir)
          except Exception:
              warn(
                  'Could not find or make morph map directory "%s"'
                  % mmap_dir
              )
  
      # filename components
      if xhemi:
          if subject_to != subject_from:
              raise NotImplementedError(
                  "Morph-maps between hemispheres are currently only "
                  "implemented for subject_to == subject_from"
              )
          map_name_temp = "%s-%s-xhemi"
          log_msg = "Creating morph map %s -> %s xhemi"
      else:
          map_name_temp = "%s-%s"
          log_msg = "Creating morph map %s -> %s"
  
      map_names = [
          map_name_temp % (subject_from, subject_to),
          map_name_temp % (subject_to, subject_from),
      ]
  
      # find existing file
      fname = None
      for map_name in map_names:
          fname = mmap_dir / f"{map_name}-morph.fif"
          if fname.exists():
              return _read_morph_map(fname, subject_from, subject_to)
      # if file does not exist, make it
      logger.info(
          'Morph map "%s" does not exist, creating it and saving it to '
          "disk" % fname
      )
      logger.info(log_msg % (subject_from, subject_to))
      mmap_1 = _make_morph_map(
          subject_from, subject_to, subjects_dir, xhemi
      )
      if subject_to == subject_from:
          mmap_2 = None
      else:
          logger.info(log_msg % (subject_to, subject_from))
          mmap_2 = _make_morph_map(
              subject_to, subject_from, subjects_dir, xhemi
          )
      _write_morph_map(fname, subject_from, subject_to, mmap_1, mmap_2)
      return mmap_1
  
file_path: mne-python/mne/morph_map.py
imports: import os
  import numpy
  from scipy.sparse import csr_matrix, eye
  from ._fiff.constants import FIFF
  from ._fiff.open import fiff_open
  from ._fiff.tag import find_tag
  from ._fiff.tree import dir_tree_find
  from ._fiff.write import end_block, start_and_end_file, start_block, write_float_sparse_rcs, write_int, write_string
  from .surface import _compute_nearest, _find_nearest_tri_pts, _get_tri_supp_geom, _normalize_vectors, _triangle_neighbors, read_surface
  from .utils import get_subjects_dir, logger, verbose, warn
label_desc: Use image node_id 1 for calling a global function with example usage: read_morph_map(subject_from, subject_to, subjects_dir, xhemi, verbose) and returns: mmap_1, _read_morph_map