[FieldTrip] Align freesurfer surface to headmodel

Dorothy Sincasto dsincasto at gmail.com
Fri Sep 21 15:23:28 CEST 2018


Hi Jan-Mathijis

Thanks for the suggestion. Now, I load the freesurfer T1.mgz, I change the
transformation matrix obtained from the command  mri_info --vox2ras-tkr and
then I align the T1.mgz and with the obtained transformation matrix I
transform the surface. If I create a headmodel from the T1.mgz the surface
is perfectly aligned, however, if I use a headmodel from the original
mri it is slightly not aligned. For some reason, the T1.mgz headshape
alignment is less precise (as measured by the average distance of the
polhemus and the scalp points). Do you know why is that? Is it possible to
align the subject-space aligned T1.mgz with the subject-space aligned mri?

For the posterity that is the code I used:

system('mri_info --vox2ras-tkr /path2/T1.mgz > /path2/t1-vox2ras-tkr.xfm')



t1 = ft_read_mri('/path2/T1.mgz');

t1.transform = load('/path2/t1-vox2ras-tkr.xfm');



cfg=[];

cfg.method      =  'interactive';

cfg.coordsys    = 'ctf';

cfg.viewmode    = 'ortho';

mri_aligned1    = ft_volumerealign(cfg,t1);



cfg=[];

cfg.method    = 'headshape';

cfg.headshape.headshape = polhemus;

cfg.coordsys  = 'ctf';

cfg.headshape.interactive    = 'no';

cfg.headshape.icp    = 'yes';

cfg.checksize = 1e10 ; % don't remove scalp segmentation from output

mri_aligned2  = ft_volumerealign(cfg,mri_aligned1 );


sourcespace = ft_read_headshape({'/path2/surf/lh.white',
'/path2/surf/rh.white'});

sourcespace = ft_convert_units(sourcespace, 'mm');

sourcespace = ft_transform_geometry(mri_aligned2.transform/t1.transform,
sourcespace);


Thanks for your help,

Dorothy

On Fri, Sep 21, 2018 at 1:35 AM Schoffelen, J.M. (Jan Mathijs) <
jan.schoffelen at donders.ru.nl> wrote:

> 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,
>
> Jan-Mathijs
>
> 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> 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
> Dorothy
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180921/274fee57/attachment-0001.html>


More information about the fieldtrip mailing list