code: def test_read_freesurfer_lut(fname, tmp_path):
      """Test reading volume label names."""
      pytest.importorskip("nibabel")
      atlas_ids, colors = read_freesurfer_lut(fname)
      assert list(atlas_ids).count("Brain-Stem") == 1
      assert len(colors) == len(atlas_ids) == 1266
      label_names, label_colors = get_volume_labels_from_aseg(
          aseg_fname, return_colors=True
      )
      assert isinstance(label_names, list)
      assert isinstance(label_colors, list)
      assert label_names.count("Brain-Stem") == 1
      for c in label_colors:
          assert isinstance(c, np.ndarray)
          assert c.shape == (4,)
      assert len(label_names) == len(label_colors) == 46
      with pytest.raises(ValueError, match="must be False"):
          get_volume_labels_from_aseg(
              aseg_fname, return_colors=True, atlas_ids=atlas_ids
          )
      label_names_2 = get_volume_labels_from_aseg(
          aseg_fname, atlas_ids=atlas_ids
      )
      assert label_names == label_names_2
      # long name (only test on one run)
      if fname is not None:
          return
      fname = tmp_path / "long.txt"
      names = [
          "Anterior_Cingulate_and_Medial_Prefrontal_Cortex-" + hemi
          for hemi in ("lh", "rh")
      ]
      ids = np.arange(1, len(names) + 1)
      colors = [(id_,) * 4 for id_ in ids]
      with open(fname, "w") as fid:
          for name, id_, color in zip(names, ids, colors):
              out_color = " ".join("%3d" % x for x in color)
              line = "%d    %s %s\n" % (id_, name, out_color)
              fid.write(line)
      lut, got_colors = read_freesurfer_lut(fname)
      assert len(lut) == len(got_colors) == len(names) == len(ids)
      for name, id_, color in zip(names, ids, colors):
          assert name in lut
          assert name in got_colors
          assert_array_equal(got_colors[name][:3], color[:3])
          assert lut[name] == id_
      with open(fname, "w") as fid:
          for name, id_, color in zip(names, ids, colors):
              out_color = " ".join(
                  "%3d" % x for x in color[:3]
              )  # wrong length!
              line = "%d    %s %s\n" % (id_, name, out_color)
              fid.write(line)
      with pytest.raises(RuntimeError, match="formatted"):
          read_freesurfer_lut(fname)
  
file_path: mne-python/mne/tests/test_freesurfer.py
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  import mne
  from mne import get_volume_labels_from_aseg, head_to_mni, read_freesurfer_lut, read_talxfm, vertex_to_mni
  from mne._freesurfer import _check_subject_dir, _estimate_talxfm_rigid, _get_mgz_header, read_lta
  from mne.datasets import testing
  from mne.transforms import _angle_between_quats, _get_trans, apply_trans, rot_to_quat
label_desc: Use image node_id 7 for calling a global function with example usage: test_read_freesurfer_lut(fname, tmp_path) without return types