code: def _project_sensors_onto_inflated(
      info,
      trans,
      subject,
      subjects_dir=None,
      picks=None,
      max_dist=0.004,
      flat=False,
      verbose=None,
  ):
      """Project sensors onto the brain surface.
  
      Parameters
      ----------
      %(info_not_none)s
      %(trans_not_none)s
      %(subject)s
      %(subjects_dir)s
      %(picks_base)s only ``seeg`` channels.
      %(max_dist_ieeg)s
      flat : bool
          Whether to project the sensors onto the flat map of the
          inflated brain instead of the normal inflated brain.
      %(verbose)s
  
      Returns
      -------
      %(info_not_none)s
  
      Notes
      -----
      This is useful in sEEG analysis for visualization
      """
      subjects_dir = get_subjects_dir(subjects_dir, raise_error=True)
      surf_data = dict(lh=dict(), rh=dict())
      x_dir = np.array([1.0, 0.0, 0.0])
      surfs = ("pial", "inflated")
      if flat:
          surfs += ("cortex.patch.flat",)
      for hemi in ("lh", "rh"):
          for surf in surfs:
              for img in ("", ".T1", ".T2", ""):
                  surf_fname = (
                      subjects_dir / subject / "surf" / f"{hemi}.{surf}"
                  )
                  if surf_fname.is_file():
                      break
              if surf.split(".")[-1] == "flat":
                  surf = "flat"
                  coords, faces, orig_faces = _read_patch(surf_fname)
                  # rotate 90 degrees to get to a more standard orientation
                  # where X determines the distance between the hemis
                  coords = coords[:, [1, 0, 2]]
                  coords[:, 1] *= -1
              else:
                  coords, faces = read_surface(surf_fname)
              if surf in ("inflated", "flat"):
                  x_ = coords @ x_dir
                  coords -= (
                      np.max(x_) * x_dir
                      if hemi == "lh"
                      else np.min(x_) * x_dir
                  )
              surf_data[hemi][surf] = (coords / 1000, faces)  # mm -> m
      # get channel locations
      picks_idx = _picks_to_idx(
          info, "seeg" if picks is None else picks
      )
      locs = np.array(
          [info["chs"][idx]["loc"][:3] for idx in picks_idx]
      )
      trans = _ensure_trans(trans, "head", "mri")
      locs = apply_trans(trans, locs)
      # initialize projected locs
      proj_locs = np.zeros(locs.shape) * np.nan
      surf = "flat" if flat else "inflated"
      for hemi in ("lh", "rh"):
          hemi_picks = np.where(
              locs[:, 0] <= 0 if hemi == "lh" else locs[:, 0] > 0
          )[0]
          # compute distances to pial vertices
          nearest, dists = _compute_nearest(
              surf_data[hemi]["pial"][0],
              locs[hemi_picks],
              return_dists=True,
          )
          mask = dists / 1000 < max_dist
          proj_locs[hemi_picks[mask]] = surf_data[hemi][surf][0][
              nearest[mask]
          ]
      # back to the "head" coordinate frame for storing in ``raw``
      proj_locs = apply_trans(invert_transform(trans), proj_locs)
      montage = info.get_montage()
      montage_kwargs = (
          montage.get_positions()
          if montage
          else dict(ch_pos=dict(), coord_frame="head")
      )
      for idx, loc in zip(picks_idx, proj_locs):
          montage_kwargs["ch_pos"][info.ch_names[idx]] = loc
      info.set_montage(make_dig_montage(**montage_kwargs))
      return info
  
file_path: mne-python/mne/preprocessing/ieeg/_projection.py
imports: from itertools import combinations
  import numpy
  from scipy.spatial.distance import pdist, squareform
  from ..._fiff.pick import _picks_to_idx
  from ...channels import make_dig_montage
  from ...surface import _compute_nearest, _read_mri_surface, _read_patch, fast_cross_3d, read_surface
  from ...transforms import _cart_to_sph, _ensure_trans, apply_trans, invert_transform
  from ...utils import _ensure_int, _validate_type, get_subjects_dir, verbose
label_desc: Use image node_id 2 for calling a global function with example usage: _project_sensors_onto_inflated(info, trans, subject, subjects_dir, picks, max_dist, flat, verbose) and returns: info