[FieldTrip] Aligning electrodes to template head model

Helen Wieffering helen.wieffering at gmail.com
Thu Sep 17 02:20:12 CEST 2015


Hi again, Jia,
I agree- something must be going wrong when I plot the head model, or maybe
when I warp the fiducial coordinates from the mri, because the alignment is
certainly worse off after I complete all the alignment steps than it was
originally! But since all my steps draw from the standard_mri and
standard_bem, I'm not sure what the problem could be.

My best success has been simply from interactively aligning the electrodes
and verifying it visually. I'm attaching a matlab figure of what it looks
like just in case anyone has input - I think it looks accurately aligned,
but this is my first time creating a head model in field trip so I have
limited experience to draw upon.

As always, thanks for your help.

Best,
Helen Wieffering
Bowdoin College

On Wed, Sep 16, 2015 at 3:50 PM, Helen Wieffering <
helen.wieffering at gmail.com> wrote:

> Hi Jia,
> Thanks so much for taking the time to help me. I'll try what you suggested
> and see how it goes!
>
> Best,
> Helen
>
> On Wed, Sep 16, 2015 at 11:59 AM, Wu, Jia <jia.wu at yale.edu> wrote:
>
>> Helen,
>> I ran your code and it seemed to work with the mri and headmodel I have.
>> I looked back at the picture you sent originally. It looks like the
>> electrodes were aligned (before alignment, the tip of the head is facing
>> upwards, after alignment with the mri provided by the wiki it points to the
>> right), but the headmodel is not plotted correctly. The headmodel needs to
>> be driven from mri. You can double check the headmodel, which is standard_bem
>> in your code.
>> -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:* Wednesday, September 16, 2015 10:00 AM
>> *To:* FieldTrip discussion list
>> *Subject:* Re: [FieldTrip] Aligning electrodes to template head model
>>
>> 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.
>>
>> % ALIGN ELECTRODES TO STANDARD_BEM
>>
>> % 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
>> elec_aligned = ft_electroderealign(cfg);
>>
>> % plot to check
>> figure;
>> ft_plot_mesh(standard_bem.bnd(1),
>> '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'
>>
>> fid.chanpos
>>
>> 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!
>>
>> Best,
>> Helen
>>
>>
>> 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
>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.science.ru.nl_mailman_listinfo_fieldtrip&d=AwMFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=9ehCplyXHP0-m9ayYv1FOg&m=kW18ZarjEMl0kcSTFdA9daM4KYcFZdGymg7wgboAsmc&s=9wDX5VD5t6xGdP84l_wit7DYMhK57vFlE5v1OkxjFgA&e=>
>>>
>>
>>
>> _______________________________________________
>> 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/daf7c152/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/daf7c152/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: head model.fig
Type: application/x-matlab-figure
Size: 176386 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150916/daf7c152/attachment-0002.bin>


More information about the fieldtrip mailing list