code: def test_flash_bem(tmp_path):
      """Test mne flash_bem."""
      pytest.importorskip("nibabel")
      check_usage(mne_flash_bem, force_help=True)
      # Copy necessary files to tempdir
      tempdir = Path(str(tmp_path))
      mridata_path = Path(subjects_dir) / "sample" / "mri"
      subject_path_new = tempdir / "sample"
      mridata_path_new = subject_path_new / "mri"
      flash_path = mridata_path_new / "flash"
      flash_path.mkdir(parents=True, exist_ok=True)
      bem_path = mridata_path_new / "bem"
      bem_path.mkdir(parents=True, exist_ok=True)
      shutil.copyfile(
          op.join(mridata_path, "T1.mgz"),
          op.join(mridata_path_new, "T1.mgz"),
      )
      shutil.copyfile(
          op.join(mridata_path, "brain.mgz"),
          op.join(mridata_path_new, "brain.mgz"),
      )
      # Copy the available mri/flash/mef*.mgz files from the dataset
      for kind in (5, 30):
          in_fname = mridata_path / "flash" / f"mef{kind:02d}.mgz"
          in_fname_echo = flash_path / f"mef{kind:02d}_001.mgz"
          shutil.copyfile(in_fname, flash_path / in_fname_echo.name)
      # Test mne flash_bem with --noconvert option
      # (since there are no DICOM Flash images in dataset)
      for s in ("outer_skin", "outer_skull", "inner_skull"):
          assert not op.isfile(subject_path_new / "bem" / f"{s}.surf")
  
      # First test without flash30
      with ArgvSetter(
          ("-d", tempdir, "-s", "sample", "-n", "-r", "-3"),
          disable_stdout=False,
          disable_stderr=False,
      ):
          mne_flash_bem.run()
      for s in ("outer_skin", "outer_skull", "inner_skull"):
          surf_path = subject_path_new / "bem" / f"{s}.surf"
          assert surf_path.exists()
          surf_path.unlink()  # cleanup
      shutil.rmtree(flash_path / "parameter_maps")  # remove old files
  
      # Test synthesize flash5 with MEF flash5 and flash30 default locations
      flash5_img = convert_flash_mris(
          subject="sample", subjects_dir=tempdir, unwarp=False
      )
      assert flash5_img == (
          flash_path / "parameter_maps" / "flash5.mgz"
      )
      assert flash5_img.exists()
      shutil.rmtree(flash_path / "parameter_maps")  # remove old files
  
      # Test with flash5 and flash30
      shutil.rmtree(flash_path)  # first remove old files
      with ArgvSetter(
          (
              "-d",
              tempdir,
              "-s",
              "sample",
              "-n",
              "-3",
              str(mridata_path / "flash" / "mef30.mgz"),
              "-5",
              str(mridata_path / "flash" / "mef05.mgz"),
          ),
          disable_stdout=False,
          disable_stderr=False,
      ):
          mne_flash_bem.run()
  
      kwargs = dict(rtol=1e-5, atol=1e-5)
      for s in ("outer_skin", "outer_skull", "inner_skull"):
          rr, tris = read_surface(
              op.join(subject_path_new, "bem", f"{s}.surf")
          )
          assert_equal(len(tris), 5120)
          assert_equal(tris.min(), 0)
          assert_equal(rr.shape[0], tris.max() + 1)
          # compare to the testing flash surfaces
          rr_c, tris_c = read_surface(
              op.join(subjects_dir, "sample", "bem", f"{s}.surf")
          )
          assert_allclose(rr, rr_c, **kwargs)
          assert_allclose(tris, tris_c, **kwargs)
  
imports: import glob
  import os
  import shutil
  from os import path
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_equal
  import mne
  from mne import concatenate_raws, read_bem_solution, read_bem_surfaces, read_source_spaces, read_surface
  from mne.bem import ConductorModel, convert_flash_mris
  from mne.commands import mne_anonymize, mne_browse_raw, mne_bti2fiff, mne_clean_eog_ecg, mne_compare_fiff, mne_compute_proj_ecg, mne_compute_proj_eog, mne_coreg, mne_flash_bem, mne_kit2fiff, mne_make_scalp_surfaces, mne_prepare_bem_model, mne_report, mne_setup_forward_model, mne_setup_source_space, mne_show_fiff, mne_show_info, mne_surf2bem, mne_sys_info, mne_watershed_bem, mne_what
  from mne.datasets import testing
  from mne.io import read_info, read_raw_fif, show_fiff
  from mne.utils import ArgvSetter, _record_warnings, _stamp_to_dt, requires_freesurfer, requires_mne
label_desc: Use image node_id 15 for calling a global function with example usage: test_flash_bem(tmp_path) without return types