code: def test_morph_labels():
      """Test morph_labels."""
      pytest.importorskip("nibabel")
      # Just process the first 5 labels for speed
      parc_fsaverage = read_labels_from_annot(
          "fsaverage", "aparc", subjects_dir=subjects_dir
      )[:5]
      parc_sample = read_labels_from_annot(
          "sample", "aparc", subjects_dir=subjects_dir
      )[:5]
      parc_fssamp = morph_labels(
          parc_fsaverage, "sample", subjects_dir=subjects_dir
      )
      for lf, ls, lfs in zip(parc_fsaverage, parc_sample, parc_fssamp):
          assert lf.hemi == ls.hemi == lfs.hemi
          assert lf.name == ls.name == lfs.name
          perc_1 = np.isin(lfs.vertices, ls.vertices).mean() * 100
          perc_2 = np.isin(ls.vertices, lfs.vertices).mean() * 100
          # Ideally this would be 100%, but we do not use the same algorithm
          # as FreeSurfer ...
          assert perc_1 > 92
          assert perc_2 > 88
      with pytest.raises(ValueError, match="wrong and fsaverage"):
          morph_labels(
              parc_fsaverage,
              "sample",
              subjects_dir=subjects_dir,
              subject_from="wrong",
          )
      with pytest.raises(
          RuntimeError, match="Number of surface vertices"
      ):
          _load_vert_pos("sample", subjects_dir, "white", "lh", 1)
      for label in parc_fsaverage:
          label.subject = None
      with pytest.raises(
          ValueError, match="subject_from must be provided"
      ):
          morph_labels(
              parc_fsaverage, "sample", subjects_dir=subjects_dir
          )
  
imports: import glob
  import os
  import pickle
  import shutil
  from itertools import product
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_equal
  from scipy import sparse
  from mne import grow_labels, labels_to_stc, morph_labels, random_parcellation, read_label, read_labels_from_annot, read_source_estimate, read_source_spaces, read_surface, spatial_tris_adjacency, split_label, stc_to_label, write_labels_to_annot
  from mne.datasets import testing
  from mne.label import Label, _blend_colors, _load_vert_pos, _n_colors, _read_annot, _read_annot_cands, label_sign_flip, select_sources
  from mne.source_estimate import mesh_edges
  from mne.source_space import SourceSpaces
  from mne.surface import _mesh_borders
  from mne.utils import _record_warnings, get_subjects_dir
label_desc: Use image node_id 11 for calling a global function with example usage: test_morph_labels() without return types