code: def test_coregister_fiducials():
      """Test coreg.coregister_fiducials()."""
      # prepare head and MRI fiducials
      trans = Transform(
          "head",
          "mri",
          rotation(0.4, 0.1, 0).dot(translation(0.1, -0.1, 0.1)),
      )
      coords_orig = np.array(
          [
              [-0.08061612, -0.02908875, -0.04131077],
              [0.00146763, 0.08506715, -0.03483611],
              [0.08436285, -0.02850276, -0.04127743],
          ]
      )
      coords_trans = apply_trans(trans, coords_orig)
  
      def make_dig(coords, cf):
          return (
              {
                  "coord_frame": cf,
                  "ident": 1,
                  "kind": 1,
                  "r": coords[0],
              },
              {
                  "coord_frame": cf,
                  "ident": 2,
                  "kind": 1,
                  "r": coords[1],
              },
              {
                  "coord_frame": cf,
                  "ident": 3,
                  "kind": 1,
                  "r": coords[2],
              },
          )
  
      mri_fiducials = make_dig(coords_trans, FIFF.FIFFV_COORD_MRI)
      info = {"dig": make_dig(coords_orig, FIFF.FIFFV_COORD_HEAD)}
  
      # test coregister_fiducials()
      trans_est = coregister_fiducials(info, mri_fiducials)
      assert trans_est.from_str == trans.from_str
      assert trans_est.to_str == trans.to_str
      assert_array_almost_equal(trans_est["trans"], trans["trans"])
  
imports: import os
  from functools import reduce
  from glob import glob
  from shutil import copyfile
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less
  import mne
  from mne._fiff.constants import FIFF
  from mne.channels import DigMontage
  from mne.coreg import Coregistration, _is_mri_subject, coregister_fiducials, create_default_subject, fit_matched_points, get_mni_fiducials, scale_labels, scale_mri, scale_source_space
  from mne.datasets import testing
  from mne.io import read_fiducials, read_info
  from mne.source_space import write_source_spaces
  from mne.transforms import Transform, _angle_between_quats, apply_trans, invert_transform, read_trans, rot_to_quat, rotation, scaling, translation
  from mne.utils import catch_logging
label_desc: Use image node_id 2 for calling a global function with example usage: test_coregister_fiducials() and returns: dict,  dict,  dict