[FieldTrip] FW: align MRI- headmodel- EEG electrodes problem

Herring, J.D. (Jim) j.herring at donders.ru.nl
Wed Jul 29 15:27:01 CEST 2015

Dear Nadia,

Looking at your images the registration seems to be quite fine. Having some electrodes in/outside of the head due to the issues JM addressed is not a  problem as electrode positions are projected onto the scalp surface anyway when creating the leadfield.



From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Konstantina Kalogianni
Sent: woensdag 22 juli 2015 15:53
To: FieldTrip discussion list
Subject: [FieldTrip] FW: align MRI- headmodel- EEG electrodes problem

Hi Jan-Mathijs,

You can download my best result from this link: https://surfdrive.surf.nl/files/public.php?service=files&t=6d591406015bcb7715ffaebd18fd7d03
I don't think is optimal.
Some of the frontal electrodes are placed inside the head and some of the back ones are floating.

In my case the automatic alignment with the fiducials didn't work well, do you have any suggestions on how to make this in a better way?

After reading posts on the discussion list, I  defined left ear as what seems the right ear.
But are there some other tricks that I should apply on the fiducials identification  or at the ft_warp_apply?

I agree that it will never be optimal because of the issues you described.
But I was wondering when is it satisfying in order not to influence my inverse solution.

One more question,  is there a function that I should I use that will optimize my electrodes locations after doing the alignment?

Thank you for your help.


From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Schoffelen, J.M. (Jan Mathijs)
Sent: dinsdag 21 juli 2015 20:55
To: FieldTrip discussion list
Subject: Re: [FieldTrip] align MRI- headmodel- EEG electrodes problem

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'?


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


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 mri
mri=ft_read_mri([freesurferDir 'mri\orig.mgz']);

% 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 );

%assign values of segmented surfaces

% compute headmodel
vol=ft_convert_units(vol, 'mm');

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

cfg.method = 'headshape';

%find fiducials


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.headshape=vol_coord.bnd(3); % use the scalp as headshape

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>

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

More information about the fieldtrip mailing list