code: def test_read_volume_from_src():
      """Test reading volumes from a mixed source space."""
      pytest.importorskip("nibabel")
      labels_vol = ["Left-Amygdala", "Brain-Stem", "Right-Amygdala"]
  
      src = read_source_spaces(fname)
  
      # Setup a volume source space
      vol_src = setup_volume_source_space(
          "sample",
          mri=aseg_fname,
          pos=5.0,
          bem=fname_bem,
          volume_label=labels_vol,
          subjects_dir=subjects_dir,
      )
      # Generate the mixed source space, testing some list methods
      assert src.kind == "surface"
      assert vol_src.kind == "volume"
      src += vol_src
      assert src.kind == "mixed"
      assert vol_src.kind == "volume"
      assert src[:2].kind == "surface"
      assert src[2:].kind == "volume"
      assert src[:].kind == "mixed"
      with pytest.raises(RuntimeError, match="Invalid source space"):
          src[::2]
  
      volume_src = get_volume_labels_from_src(
          src, "sample", subjects_dir
      )
      volume_label = volume_src[0].name
      volume_label = "Left-" + volume_label.replace("-lh", "")
  
      # Test
      assert_equal(volume_label, src[2]["seg_name"])
  
      assert_equal(src[2]["type"], "vol")
  
imports: from pathlib import Path
  from shutil import copytree
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_array_less, assert_equal
  import mne
  from mne import SourceEstimate, add_source_space_distances, compute_source_morph, get_volume_labels_from_src, make_sphere_model, morph_source_spaces, pick_types, read_bem_solution, read_bem_surfaces, read_freesurfer_lut, read_source_spaces, read_trans, setup_source_space, setup_volume_source_space, write_source_spaces
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import _picks_to_idx
  from mne.datasets import testing
  from mne.fixes import _get_img_fdata
  from mne.source_estimate import _get_src_type
  from mne.source_space import compute_distance_to_sensors, get_decimated_surfaces
  from mne.source_space._source_space import _compare_source_spaces
  from mne.surface import _accumulate_normals, _triangle_neighbors
  from mne.utils import _record_warnings, requires_mne, run_subprocess
label_desc: Use image node_id 18 for calling a global function with example usage: test_read_volume_from_src() without return types