[FieldTrip] Align freesurfer surface to headmodel

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Fri Sep 21 10:12:28 CEST 2018

Hi Dorothy,

The best way to do this is indeed to follow the tutorial. If you don’t want to rerun the freesurfer pipeline things only get complicated.
The code you pasted is not correct, because of the reslicing step in between. Creating the ’T’ matrix as a combination of two vox2somethingelse transformation matrices is only allowed if the voxel spaces that correspond to each of the transformations is identical.

Best wishes,


PS: If you insist on trying it, the best way to go about this would be to use the T1w.mgz anatomical image from the freesurfer mri folder for the headmodel creation. Before the headmodel creation, you probably would want to coregister this image to the coordinate system of your EEG/MEG sensors.

J.M.Schoffelen, MD PhD
Senior Researcher, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands

On 19 Sep 2018, at 22:41, Dorothy Sincasto <dsincasto at gmail.com<mailto:dsincasto at gmail.com>> wrote:

Dear fieldtrippers

I would like to align the headmodel of a subject with the freesurfer surface. It seems that this is a bit different than the fieldtrip mne tutorial, as we already have the freesurfer surfaces  (so we did not align the mri, save them and run freesurfer).

To try to convert the freesurface surface coordinates to the subjects MEG coordinates I do:

cfg = [];
cfg.method = 'interactive';
cfg.coordsys = 'spm';
mri_spm    = ft_volumerealign(cfg, mri);

cfg            = [];
cfg.resolution = 1;
cfg.dim        = [256 256 256];
mri_spm_rs     = ft_volumereslice(cfg, mri);
transform_vox2spm = mri_spm_rs.transform;

cfg          = [];
cfg.method   = 'interactive';
cfg.coordsys = 'ctf';
mri_ctf_rs   = ft_volumerealign(cfg, mri_spm_rs);
transform_vox2ctf = mri_ctf_rs.transform;

T = transform_vox2ctf/transform_vox2spm;

sourcespace = ft_read_headshape({my_surface}
sourcespace = ft_transform_geometry(T, sourcespace);

However, although the surface and headmodel is quite aligned, the surface is a bit lower and posterior than the headmodel, as can be seen in this screenshot: https://ibb.co/eEVV2K

We also tried the transformation matrices from freesurfer outputed with the command mri_info surface.surf
voxel to ras transform:
               -1.0000   0.0000  -0.0000   131.6938
                0.0000   0.0000   1.0000  -111.6126
               -0.0000  -1.0000  -0.0000   157.1196
                0.0000   0.0000   0.0000     1.0000

voxel-to-ras determinant -1

ras to voxel transform:
               -1.0000  -0.0000  -0.0000   131.6938
                0.0000  -0.0000  -1.0000   157.1196
                0.0000   1.0000   0.0000   111.6126
               -0.0000  -0.0000  -0.0000     1.0000

But the results are worse. I am a bit desperate in finding a way to align the surface without having to rerun freesurface on all the subjects.

Is there a method to properly align the freesurfer surface to the aligned headmodel?

Thank you
fieldtrip mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180921/0cc0d979/attachment-0002.html>

More information about the fieldtrip mailing list