MNE source points in the MRI coordinate system

Dear MNE users,

I am trying to transform the coordinates of the MNE source points (in
"Head coordinates") of a subject to the coordinate system of the original
anatomical MR image of the subject (in "RAS coordinates"?).

Following the description in the manual
(http://martinos.org/mne/stable/manual/forward.html) it seems that I have
to apply two coordinate transformations to these points: from "Head
coordinates" to "Surface RAS coordinates" and from "Surface RAS" to "RAS
coordinates".

I have extracted the two transformations by using these commands:
mne_show_fiff --in example_subject/mri/T1-neuromag/sets/COR.fif --verbose
mne_make_cor_set --mgh example_subject/mri/orig.mgz --verbose

The commands output the following lines:

head -> MRI (surface RAS)
  0.99551 -0.04669 -0.08235 0.57
  0.02221 0.96082 -0.27627 -13.19
  0.09202 0.27320 0.95754 -22.42
  0.00000 0.00000 0.00000 1.00

Coordinate transformation: MRI (surface RAS) -> RAS (non-zero origin)
   1.000000 0.000000 0.000000 0.46 mm
   0.000000 1.000000 0.000000 42.65 mm
   0.000000 0.000000 1.000000 -11.77 mm
   0.000000 0.000000 0.000000 1.00

If I understood correctly, applying these transformations to the
coordinates of the MNE source points listed in the file
'example_subject-7-lh.pnt' in the bem directory should then give me the
source points in the original MRI coordinate system. However, these
transformed coordinates are nowhere near the cortical surface in the
original anatomical MR image (they are off tens of centimeters).

(the first few lines of the 'example_subject-7-lh.pnt' file are as follows:
# CoordinateSystem "Head"
# X (mm) Y (mm) Z (mm)
-15.949615 -101.250862 10.354758
-11.817389 -99.757225 24.933018
-8.782373 -99.445816 11.100106
-15.355161 -100.348282 7.023144
...)

Where is the error in these steps? Is there an easier way to get the MNE
source points in the original anatomical MRI coordinate system? Any help
clarifying these coordinate systems and their transformations is
appreciated.

Thanks,
--Jukka Saari

The easiest way is to read the source spaces from the source space file in Matlab or Python. The coordinates are then directly the surface RAS coordinates and a simple origin shift is needed to transform to the non-zero origin RAS.

- Matti

Reading the source points from the file example_subject-7-src.fif in
Python and transforming these points with the Surface RAS -> RAS
transformation solved the problem. Thank you!

--Jukka