code: def _estimate_talxfm_rigid(subject, subjects_dir):
      from .coreg import _trans_from_params, fit_matched_points
  
      xfm = read_talxfm(subject, subjects_dir)
      # XYZ+origin + halfway
      pts_tal = np.concatenate([np.eye(4)[:, :3], np.eye(3) * 0.5])
      pts_subj = apply_trans(invert_transform(xfm), pts_tal)
      # we fit with scaling enabled, but then discard it (we just need
      # the rigid-body components)
      params = fit_matched_points(
          pts_subj, pts_tal, scale=3, out="params"
      )
      rigid = _trans_from_params((True, True, False), params[:6])
      return rigid
  
imports: import os.path
  from gzip import GzipFile
  from pathlib import Path
  import numpy
  from ._fiff.constants import FIFF
  from ._fiff.meas_info import read_fiducials
  from .surface import _read_mri_surface, read_surface
  from .transforms import Transform, _ensure_trans, apply_trans, combine_transforms, invert_transform, read_ras_mni_t
  from .utils import _check_fname, _check_option, _import_nibabel, _validate_type, get_subjects_dir, logger, verbose
label_desc: Use image node_id 24 for calling a global function with example usage: _estimate_talxfm_rigid(subject, subjects_dir) and returns: rigid