[FieldTrip] Aligning electrodes to template head model

Helen Wieffering helen.wieffering at gmail.com
Wed Sep 16 16:00:05 CEST 2015

Hi Jia,
Thanks so much for getting back to me. If you have a free moment, would you
mind looking over my code? I have tried the tutorial steps many times, even
having changed the label of the GSN fiducials to 'Nz', 'LPA', 'RPA',  but
seem to keep getting the same incorrect results.


% read electrode coordinates
elec = ft_read_sens('GSN-HydroCel-129.sfp');

% convert units to mm to match units of headmodel
elec = ft_convert_units(elec, 'mm');

% change label of fiducials
elec.label{1} = 'Nz';
elec.label{2} = 'LPA'
elec.label{3} = 'RPA';

% create fiducial structure
% draw fiducial coordinates from mri
nas = standard_mri.hdr.fiducial.mri.nas;
lpa = standard_mri.hdr.fiducial.mri.lpa;
rpa = standard_mri.hdr.fiducial.mri.rpa;

transm = standard_mri.transform;

nas = ft_warp_apply(transm, nas, 'homogenous');
lpa = ft_warp_apply(transm, lpa, 'homogenous');
rpa = ft_warp_apply(transm, rpa, 'homogenous');

% create a structure similar to a template set of electrodes
fid.chanpos = [nas; lpa; rpa]; % mni-coordinates of fiducials
fid.label = {'Nz','LPA','RPA'}; % same labels as in elec
fid.unit = 'mm'; % same units as mri

% alignment
cfg = [];
cfg.method = 'fiducial';
cfg.template = fid; % see above
cfg.elec = elec;
cfg.fiducial = {'Nz', 'LPA', 'RPA'}; % labels of fiducials in fid and in
elec_aligned = ft_electroderealign(cfg);

% plot to check
'edgecolor','none','facealpha',0.8,'facecolor',[0.6 0.6 0.8]);
hold on;
ft_plot_sens(elec_aligned,'style', 'sk');

For reference, the coordinates I get in the structure fid are the following:
fid =

    chanpos: [3x3 double]
      label: {'Nz'  'LPA'  'RPA'}
       unit: 'mm'


ans =

    35   -36     0
   118   -35     0
   -82   -35     0

If those are different from yours, would you let me know? I'm trying to
find out at which step I went wrong.
Again, thank you very much!


On Mon, Sep 14, 2015 at 11:00 PM, Wu, Jia <jia.wu at yale.edu> wrote:

> Helen,
> What a coincident. I'm also working on source analysis on EEG data using
> GSN HydroCel 128. I had a post a couple weeks ago about later steps. But I
> did get the alignment to work. The picture you posted looked like the
> status before the alignment. So i suspect that alignment did not happen.
> I'm not sure whether you have noticed it, but the fiducial positions in
> elec location file were called 'FidNz', 'FidT9', 'FidT10', instead of 'Nz','LPA','RPA'
> as in the tutorial. So they need to be changed. Then the alignment should
> work.
> best,
> -jia
> ------------------------------
> *From:* fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl]
> on behalf of Helen Wieffering [helen.wieffering at gmail.com]
> *Sent:* Monday, September 14, 2015 4:46 PM
> *To:* FieldTrip discussion list
> *Subject:* [FieldTrip] Aligning electrodes to template head model
> Hello all,
> I have a quick question on aligning electrodes to the standard_bem
> headmodel, which I downloaded from the FT server.
> Namely, are the standard_mri and the standard_bem in the same coordinate
> system? I assumed this would be so, since one was developed from the other.
> But when I try to align my electrodes to the standard_bem volume using
> fiducial positions from the standard_mri, I get very strange results:
> (image below and attached)
> [image: Inline image 1]
> I'm using a GSN HydroCel 128 Cap, and my elec structure contains the
> fiducial positions relative to the electrodes.
> I've been following the tutorial at
> http://www.fieldtriptoolbox.org/tutorial/headmodel_eeg
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fieldtriptoolbox.org_tutorial_headmodel-5Feeg&d=AwMFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=9ehCplyXHP0-m9ayYv1FOg&m=wNRiA8CLR4Y1ZrEaTkTaIoVaUczL5TYuWIx6FyQDphg&s=LjU77qpw8I7LnSHIEQrNIB0R0YLrutfAEtjjOMjBys0&e=>
> and would like to follow the steps under 'Automatic Alignment', but as I
> said: pulling the fiducial positions from the standard_mri seems to not
> work with the tutorial steps.
> Any help is appreciated - thanks in advance!
> Helen Wieffering
> Bowdoin College
> _______________________________________________
> fieldtrip mailing list
> 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/20150916/84a84d7b/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unaligned.jpg
Type: image/jpeg
Size: 13372 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150916/84a84d7b/attachment-0002.jpg>

More information about the fieldtrip mailing list