code: def test_surface_vector_source_morph(tmp_path):
      """Test surface and vector source estimate morph."""
      pytest.importorskip("h5io")
      inverse_operator_surf = read_inverse_operator(fname_inv_surf)
  
      stc_surf = read_source_estimate(fname_smorph, subject="sample")
      stc_surf.crop(0.09, 0.1)  # for faster computation
  
      stc_vec = _real_vec_stc()
  
      source_morph_surf = compute_source_morph(
          inverse_operator_surf["src"],
          subjects_dir=subjects_dir,
          smooth=1,
          warn=False,
      )  # smooth 1 for speed
      assert source_morph_surf.subject_from == "sample"
      assert source_morph_surf.subject_to == "fsaverage"
      assert source_morph_surf.kind == "surface"
      assert isinstance(source_morph_surf.src_data, dict)
      assert isinstance(
          source_morph_surf.src_data["vertices_from"], list
      )
      assert isinstance(source_morph_surf, SourceMorph)
      stc_surf_morphed = source_morph_surf.apply(stc_surf)
      assert isinstance(stc_surf_morphed, SourceEstimate)
      stc_vec_morphed = source_morph_surf.apply(stc_vec)
      with pytest.raises(
          ValueError, match="Invalid value for the 'output'"
      ):
          source_morph_surf.apply(stc_surf, output="nifti1")
  
      # check if correct class after morphing
      assert isinstance(stc_surf_morphed, SourceEstimate)
      assert isinstance(stc_vec_morphed, VectorSourceEstimate)
  
      # check __repr__
      assert "surface" in repr(source_morph_surf)
  
      # check loading and saving for surf
      source_morph_surf.save(tmp_path / "42.h5")
  
      source_morph_surf_r = read_source_morph(tmp_path / "42.h5")
  
      assert all(
          [
              read == saved
              for read, saved in zip(
                  sorted(source_morph_surf_r.__dict__),
                  sorted(source_morph_surf.__dict__),
              )
          ]
      )
  
      # check wrong subject correction
      stc_surf.subject = None
      assert isinstance(
          source_morph_surf.apply(stc_surf), SourceEstimate
      )
  
      # degenerate
      stc_vol = read_source_estimate(fname_vol_w, "sample")
      with pytest.raises(
          TypeError, match="stc_from must be an instance"
      ):
          source_morph_surf.apply(stc_vol)
  
imports: from inspect import signature
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_array_less
  from scipy.sparse import csr_matrix
  from scipy.sparse import eye
  from scipy.spatial.distance import cdist
  import mne
  from mne import SourceEstimate, SourceMorph, VectorSourceEstimate, VolSourceEstimate, VolVectorSourceEstimate, compute_source_morph, get_volume_labels_from_aseg, grade_to_vertices, make_ad_hoc_cov, make_forward_solution, make_sphere_model, read_evokeds, read_forward_solution, read_freesurfer_lut, read_source_estimate, read_source_morph, setup_volume_source_space
  from mne._freesurfer import _get_atlas_values, _get_mri_info_data
  from mne.datasets import testing
  from mne.fixes import _get_img_fdata
  from mne.minimum_norm import apply_inverse, make_inverse_operator, read_inverse_operator
  from mne.source_space._source_space import _add_interpolator, _grid_interp
  from mne.transforms import quat_to_rot
  from mne.utils import _record_warnings, catch_logging
label_desc: Use image node_id 8 for calling a global function with example usage: test_surface_vector_source_morph(tmp_path) without return types