code: def _set_dig_kit(mrk, elp, hsp, eeg):
      """Add landmark points and head shape data to the KIT instance.
  
      Digitizer data (elp and hsp) are represented in [mm] in the Polhemus
      ALS coordinate system. This is converted to [m].
  
      Parameters
      ----------
      mrk : path-like | array_like, shape (5, 3) | None
          Marker points representing the location of the marker coils with
          respect to the MEG Sensors, or path to a marker file.
      elp : path-like | array_like, shape (8, 3) | None
          Digitizer points representing the location of the fiducials and the
          marker coils with respect to the digitized head shape, or path to a
          file containing these points.
      hsp : path-like | array, shape (n_points, 3) | None
          Digitizer head shape points, or path to head shape file. If more
          than 10`000 points are in the head shape, they are automatically
          decimated.
      eeg : dict
          Ordered dict of EEG dig points.
  
      Returns
      -------
      dig_points : list
          List of digitizer points for info['dig'].
      dev_head_t : Transform
          A dictionary describing the device-head transformation.
      hpi_results : list
          The hpi results.
      """
      from ...coreg import _decimate_points, fit_matched_points
  
      if isinstance(hsp, (str, Path, PathLike)):
          hsp = _read_dig_kit(hsp)
      n_pts = len(hsp)
      if n_pts > KIT.DIG_POINTS:
          hsp = _decimate_points(hsp, res=0.005)
          n_new = len(hsp)
          warn(
              f"The selected head shape contained {n_pts} points, which is more than "
              f"recommended ({KIT.DIG_POINTS}), and was automatically downsampled to "
              f"{n_new} points. The preferred way to downsample is using FastScan."
          )
  
      if isinstance(elp, (str, Path, PathLike)):
          elp_points = _read_dig_kit(elp)
          if len(elp_points) != 8:
              raise ValueError(
                  "File %r should contain 8 points; got shape "
                  "%s." % (elp, elp_points.shape)
              )
          elp = elp_points
      elif len(elp) not in (6, 7, 8):
          raise ValueError(
              "ELP should contain 6 ~ 8 points; got shape "
              "%s." % (elp.shape,)
          )
      if isinstance(mrk, (str, Path, PathLike)):
          mrk = read_mrk(mrk)
  
      mrk = apply_trans(als_ras_trans, mrk)
  
      nasion, lpa, rpa = elp[:3]
      nmtrans = get_ras_to_neuromag_trans(nasion, lpa, rpa)
      elp = apply_trans(nmtrans, elp)
      hsp = apply_trans(nmtrans, hsp)
      eeg = OrderedDict(
          (k, apply_trans(nmtrans, p)) for k, p in eeg.items()
      )
  
      # device head transform
      trans = fit_matched_points(
          tgt_pts=elp[3:], src_pts=mrk, out="trans"
      )
  
      nasion, lpa, rpa = elp[:3]
      elp = elp[3:]
  
      dig_points = _make_dig_points(
          nasion, lpa, rpa, elp, hsp, dig_ch_pos=eeg
      )
      dev_head_t = Transform("meg", "head", trans)
  
      hpi_results = [
          dict(
              dig_points=[
                  dict(
                      ident=ci,
                      r=r,
                      kind=FIFF.FIFFV_POINT_HPI,
                      coord_frame=FIFF.FIFFV_COORD_UNKNOWN,
                  )
                  for ci, r in enumerate(mrk)
              ],
              coord_trans=dev_head_t,
          )
      ]
  
      return dig_points, dev_head_t, hpi_results
  
file_path: mne-python/mne/io/kit/coreg.py
imports: import pickle
  import re
  from collections import OrderedDict
  from os import SEEK_CUR, PathLike
  from pathlib import Path
  import numpy
  from ..._fiff._digitization import _make_dig_points
  from ...channels.montage import _check_dig_shape, read_custom_montage, read_dig_polhemus_isotrak, read_polhemus_fastscan
  from ...transforms import Transform, als_ras_trans, apply_trans, get_ras_to_neuromag_trans
  from ...utils import _check_fname, _check_option, warn
  from .constants import FIFF, KIT
label_desc: Use image node_id 3 for calling a global function with example usage: _set_dig_kit(mrk, elp, hsp, eeg) and returns: dig_points,  dev_head_t,  hpi_results