[FieldTrip] align MRI- headmodel- EEG electrodes problem

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Jul 21 20:55:06 CEST 2015


Hi Nadia,

>From the code I cannot see any obvious flaws, but it’s hard to tell, without some pictorial feedback. It could be that all went well, but that the end result is just the best that can be achieved. Note that there will always be some discrepancy between the head surface reconstructed from the anatomical image (image distortion, thresholding issues etc), and the electrode positions (having the cap in between, some slight inacurracy between the recorded fiducial positions, and the positions obtained by clicking in the MR-image). Do you have an image of your ‘best result’?

Best,
Jan-Mathijs


Jan-Mathijs Schoffelen, MD PhD, Senior researcher

Max Planck Institute for Psycholinguistics
Donders Centre for Cognitive Neuroimaging

E-mail: j.schoffelen at donders.ru.nl<mailto:j.schoffelen at donders.ru.nl>
Telephone: +31-24-3614793

http://www.hettaligebrein.nl
http://www.fieldtriptoolbox.org





On Jul 21, 2015, at 4:56 PM, Konstantina Kalogianni <K.Kalogianni at tudelft.nl<mailto:K.Kalogianni at tudelft.nl>> wrote:

Dear fieldtrippers,

I am struggling with aligning the individual MRI, the headmodel and electrode positions(EEG) for some days now, without any success.
I would appreciate some help.

To begin with,  as an input I have the subject specific MRI which was segmented with the use of freesurfer and MNE software.
I load first the MRI ,the triangulated meshes for brain skull and skin, and the electrodes positions of 65-channel EEG.
I am then computing the bem headmodel from the brain skull skin (computed with the use of MNE software)
Afterwards I am aligning the MRI to my headmodel (ft_volumerealign) and then I identify the fiducials with the interactive mode (ft_volumerealign).
I do the transformation of the fiducial points  with ft_warp_apply to the coordinates specified at the alignment.
Then I call the  ft_electroderealign to align my electrodes to the mri’s fiducial points.
And then I realign  my electrodes manually.

The problem is that no matter how much rotation translation scaling I do, it’s IMPOSSIBLE TO FIT THE ELECTRODES TO THE HEADMODEL!

I tried the volume_realign with ctf coordinates as well and I tried the ft_electroderalign with the interactive mode only(without matching the fiducials), it doesn’t work.

Below you can find the code that I used.
Any ideas on this issue would be of great help!


%% READ
% read mri
mri=ft_read_mri([freesurferDir 'mri\orig.mgz']);
mri.coordsys='neuromag';

% read surfaces

brain=ft_read_headshape([freesurferDir 'bem\brain.surf\Pilot08_brain_surface']);

skull=ft_read_headshape([freesurferDir 'bem\brain.surf\Pilot08_inner_skull_surface' ]);
skin=ft_read_headshape([freesurferDir 'bem\brain.surfilot08_outer_skin_surface' ]);

% read electrodes positions
elec_file=[datadir '\raw\M10.elc'];
elec=ft_read_sens(elec_file );
elec.coordsys='neuromag';
elec.label=upper(elec.label);

%% HEADMODEL
%assign values of segmented surfaces
geom(1).tri=brain.tri;
geom(2).tri=skull.tri;
geom(3).tri=skin.tri;

geom(1).pnt=brain.pnt;
geom(2).pnt=skull.pnt;
geom(3).pnt=skin.pnt;
% compute headmodel
vol=ft_headmodel_bemcp(geom);
vol=ft_convert_units(vol, 'mm');
vol.coordsys='neuromag';

%% ALIGNMENTS
%align mri and headshape
mri_coord=ft_determine_coordsys(mri, 'interactive', 'yes');
vol_coord=ft_determine_coordsys(vol, 'interactive', 'yes');

cfg=[];
cfg.method = 'headshape';
cfg.headshape=vol_coord.bnd(3);
mri_headshape=ft_volumerealign(cfg,mri_coord);

%find fiducials
cfg=[];
cfg.method='interactive';
cfg.coordsys='neuromag';
mri_fid=ft_volumerealign(cfg,mri_headshape);


%% APPLY TRANSFORMATIONS ON FIDUCIALS

transm=mri_fid.transform;
nas=ft_warp_apply(transm,mri_fid.cfg.fiducial.nas, 'homogenous');
lpa=ft_warp_apply(transm,mri_fid.cfg.fiducial.rpa, 'homogenous');
rpa=ft_warp_apply(transm,mri_fid.cfg.fiducial.lpa, 'homogenous');



fid.chanpos       = [nas;  rpa; lpa];
fid.elecpos       =fid.chanpos;
fid.label         = {'NASION',  'RIGHTEAR','LEFTEAR'}; % same labels as in elec
fid.unit          = 'mm';            % same units as mri
% Automatic electrode alignment using the fiducials
cfg               = [];
cfg.method        = 'fiducial';
cfg.template      = fid;
cfg.elec          = elec;
cfg.fiducial      = {'NASION',  'RIGHTEAR','LEFTEAR'};  % labels of fiducials in fid and in sens
cfg.headshape=vol_coord.bnd(3); % use the scalp as headshape
elec_aligned_fid      = ft_electroderealign(cfg);


%% Interactive alignment of electrodes to fix some misalignment

cfg=[];
cfg.method='interactive';
cfg.elec=elec_aligned_fid;
cfg.headshape=vol_coord.bnd(3); % use the scalp as headshape
elec_aligned=ft_electroderealign(cfg);



Best Regards,

K. (Nadia) Kalogianni
PhD candidate

TU Delft /Department of Biomechanical Engneering
Neuromuscular Control Laboratory

Mekelweg 2
2628 CD Delft
Room: F-1-320
T +31 15-27 84230
E  k.kalogianni at tudelft.nl<mailto:k.kalogianni at tudelft.nl>

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


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


More information about the fieldtrip mailing list