Hi,
I have a problem with coregistration. I have a matrix which transforms sensor coordinates (in ITAB / device coordinate frame) to mni/acpc coordinate frame of standard 4x4 form (in a shorthand notation):
T = [[rotation matrix 3x3] [translation vector 3x1]
[0,0,0,1]]
Then I create a transform using
trans = mne.transforms.Transform('head', 'mri', trans=T)
Coordinates of sensors in both coordinate systems (ITAB/device and mri/acpc) are given in mm.
Problem is that when I plot alignment
f = mne.viz.plot_alignment(info=info, bem=bem, trans=trans, subject=subject, subjects_dir=subjects_dir,
surfaces='auto', meg=('helmet', 'sensors'), show_axes=True, coord_frame='mri',
src=src, fig=fig, verbose='info')
origins of head and MRI systems are shifted by distance of 42112.2 mm.
That probably implies there is a problem with scaling/units. In order to fix it I used a rescaling matrix:
a = 1000
R = [[a, 0, 0, 0],
[0, a, 0, 0],
[0, 0, a, 0],
[0, 0, 0, 1]]
T = np.matmul(T, R)
T = np.matmul(np.linalg.inv(R), T)
The distance between the systems is now decreased to 42.1 mm, but when I plot alignment itās wrong: helmet surface cuts through a head surface.
How to construct transformation, and what are exactly units used by trans?
PS: using identity matrix as T the outcome looks like this, so the problem is the form of the T: