[FieldTrip] source analysis EEG data without MRI

IMALI THANUJA HETTIARACHCHI ith at deakin.edu.au
Thu Apr 11 03:14:23 CEST 2013


Hi Ingrid,

I had similar issues with creating my own BEM as I too did not have the individual MRI's nor the digitized electrode positions.

I created a BEM using the Curry (Neuroscan) software and imported in .mat format to use with Fieldtrip. However these are also based on the MNI template.
I am not sure whether this extends  lower enough for your situation. I am attaching here a picture of my head model showing the skull and cortex with my registered electrodes. If you are happy with it, I am more than happy to share it with you.

Please let me know.

Regards
Imali

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Ingrid Nieuwenhuis
Sent: Thursday, 11 April 2013 4:22 AM
To: fieldtrip at science.ru.nl
Subject: Re: [FieldTrip] source analysis EEG data without MRI

Hi all,

Just had a brain wave, I'll share it for people with similar situation that might be interested in this thread. I think I should just get a random structural MRI that extends lower (includes ears and bit below), optimally of a subject with a head similar to the MNI template. Make a BEM model (hmm, have to fix these errors I mentioned earlier then, well, should be doable on linux using dipoli). Then use ft_electroderealign to align the electrodes to this MRI, do the source analysis for all subjects using this model, and subsequently use ft_volumenormalise to normalize to MNI template if I want to use any atlas functionality.

If anyone did this already using FieldTrip and has a pre-made BEM (just like the standard_bem), would be really nice if you're willing to share :)
If not, I'll make my own, and people with low electrodes and no structural MRI and or no linux access can email me if they want to use it.

Cheers,
Ingrid


--

Ingrid Nieuwenhuis PhD

Postdoctoral Fellow

Sleep and Neuroimaging Laboratory

Department of Psychology

University of California, Berkeley

California 94720-1650

Tolman Hall, room 5305
On 4/10/2013 10:17 AM, Ingrid Nieuwenhuis wrote:
Hi Lilla and Imali,

Thanks for your replies. In my case, the problem is not the aligning. My nasion electrode is on the nasion, and Cz is on Cz, everything is where it should be. The EGI 128 electrode net really has these low electrodes, which are there specifically to make source analysis better by capturing more of the electric field. So I would have the best solution if I'd leave them there. However, in the model as derived from the MNI template, the skin part does not go down low enough.

I looked at the picture after ft_prepare_vol_sens (see attachement, black is before, red is after), and indeed, this is not good. The low electrodes are squeezed up, and this will make source analysis worse. So I should indeed remove these electrodes (which is a pity), or find a better MNI template.

So my question is:
Does anyone know of a template in MNI space that extends more down? This template comes from SPM8, is there a version that extends lower? Or could I extend the skin roughly downwards with some triangular magic?

I'm also a bit confused about the statement on this wiki page: http://fieldtrip.fcdonders.nl/template/headmodel?s[]=standard&s[]=bem<http://fieldtrip.fcdonders.nl/template/headmodel?s%5b%5d=standard&s%5b%5d=bem>
under "revision information" header "skin" is says: "This skin surface is not used in the BEM model itself for computational reasons, but can be used for visualization."
But this does not seem to be the case, since my electrode positions are modified based on till where the skin goes. So the skin surface does significantly influence the source analysis.

Anyway, thanks for all the help, and worse case, I just get rid of the low fellows.

Cheers,
Ingrid



--

Ingrid Nieuwenhuis PhD

Postdoctoral Fellow

Sleep and Neuroimaging Laboratory

Department of Psychology

University of California, Berkeley

California 94720-1650

Tolman Hall, room 5305
On 4/10/2013 9:05 AM, Magyari, Lilla wrote:
hi Ingrid and Imali,


I think it is a really good question what to do in Ingrid's case. I do not know the "right" answer, but I would like to share my thoughts about it.

The ft_prepare_vol_sens is indeed projects the electrode positions closer to the headsurface as Imali wrote. But this function called automatically when you create your leadfield, so you do not have to do it separately (unless you want to visualize the corrected electrode positions).

However, I have been advised to rely on this projection carefully if electrode positions are far from the skin and specially, if the inaccuracies (distance from the skin) are not equally distributed across the electrodes, because that can cause a spatial bias.

Therefore, my question would be: why are those electrodes so low? Are those positions reflect the actual positions of the electrodes during the measurement? If yes, I would not change their positions, I would rather try to extend my headmodel e.g. by using another template. (or another (but quite suboptimal) possibility is maybe to exclude those electrodes (and the data) from the analysis if they are anyway far from the brain.)

If the position of the electrodes should be higher up on the head, then instead of relying on projection, I would try first to scale the electrodes to fit them into the headsurface with the ft_electroderealign function.

I looked to the standard_bem file in the template directory, and I also load in the standard_1020.elc, and those electrodes perfectly fit the vol. So, it seems that the extension of the standard bem headsurface is suitable for the area which is covered by the those template electrodes. And I do not know if the electrode set you use should cover a larger surface of the head, or if it should be just adjusted to the given headsurface.

Lilla




IMALI THANUJA HETTIARACHCHI wrote:

Hi Ingrid,

I had a similar issue a few weeks ago, where my lower most electrodes
started floating after electrode realign using the ft_electroderealign
function.

I used the ft_prepare_vol_sens as,
[vol, elecR]=ft_prepare_vol_sens (col,elecR) and this did the trick and
brought the electrodes on to the skin.

Hope this helps...!

Regards
Imali


*From:* fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>
[fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>] on behalf of Ingrid Nieuwenhuis
[inieuwenhuis at berkeley.edu<mailto:inieuwenhuis at berkeley.edu>]
*Sent:* Wednesday, 10 April 2013 9:29 AM
*To:* fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
*Subject:* Re: [FieldTrip] source analysis EEG data without MRI

Hi all,

A follow up on this and some new issues:

1) I first tried Jörn's approach by creating my own BEM, always fun to
make it yourself ;) However, I did not succeed since:
a) the dipoli method does not work on Windows
b) I downloaded the openmeeg toolbox, but got an error "om_minverser.exe
has stopped working" I've emailed their buglist
c) bemcp did run, but the result was not ok (see attachement). I also
got the warning "% Warning: Matrix is singular, close to singular or
badly scaled. Results may be inaccurate." several times, so that might
be the problem.
d) and asa gave the following error: % Error using ft_prepare_headmodel
(line 201) % You must supply a valid cfg.hdmfile for use with ASA headmodel

And away went my determination to do it myself, so I continued using
thestandard_bem.mat
<http://fieldtrip.fcdonders.nl/template/headmodel?s[]=standard&s[]=bem><http://fieldtrip.fcdonders.nl/template/headmodel?s%5b%5d=standard&s%5b%5d=bem>.
(I did not know this existed, I've added this link to note in the
headmodel tutorial
<http://fieldtrip.fcdonders.nl/tutorial/headmodel_eeg?&#background><http://fieldtrip.fcdonders.nl/tutorial/headmodel_eeg?&#background> to
make it easier to find, thanks Tzvetan for pointing this out!).

2) This worked and after some fiddling to get the electrodes aligned it
looks okay (see attached).
However, as you can see in the figures, I have several very low
electrodes, that are lower than the skin mesh. So I was wondering if
this is a problem? Since for accurate calculation of how the currents
flow from these low electrodes, I assume one needs the skin to go till
there? What happens when I have electrodes floating in thin air?
*So my question is:*
a) will this cause great inaccuracies?
b) if so, how can I extend the skin to go lower? The template MRI only
goes that far to the bottom... Trick anyone?

Thanks again,
Ingrid


On 4/9/2013 9:39 AM, Ingrid Nieuwenhuis wrote:

Thanks Jörn and Tzvetan for the scripts! I'll try it out and put it on
the wiki.
Have a great day,
Ingrid

On 4/9/2013 12:32 AM, Tzvetan Popov wrote:

Dear Ingrid,

in addition to Jorn's approach since you don't have MR and digitized
elec position's you can load and realign the electrodes to the
standard bem. Subsequently you can calculate the lead field and
continue with your analysis pipeline.
Good luck
tzvetan
%% read electrodes
elec = ft_read_sens('/your
path/fieldtrip-20130324/template/electrode/GSN-HydroCel-128.sfp');
%% read headmodel
templateheadmodel = '/your
path/fieldtrip-20130324/template/headmodel/standard_bem.mat';
load(templateheadmodel);
%% electrode realign as good as possible
% i.e. translate 0 -2 1.5
cfg=[];
cfg.method = 'interactive';
cfg.elec = elec;
cfg.headshape = vol.bnd(1).pnt;
elecR = ft_electroderealign(cfg);
%% verify how the electrodes fit toghether with the brain volume
cfg=[];
cfg.method = 'interactive';
cfg.elec = elecR;
cfg.headshape = vol.bnd(3).pnt;
elecR = ft_electroderealign(cfg);



Hi Ingrid,

I just happen to done this a few weeks back, I changed things in the
meanwhile, but I hope that the below steps are complete:
/% read in the template MRI
if isunix
mri =
ft_read_mri('/home/common/matlab/fieldtrip/external/spm8/templates/T1.nii');
elseif ispc
mri = ft_read_mri(fullfile('M:', 'FieldTrip', 'trunk', 'external',
'spm8', 'templates', 'T1.nii'));
end


% segment the MRI
cfg = [];
cfg.output = {'brain' 'skull' 'scalp'};
segmentedmri = ft_volumesegment(cfg, mris);


% create the headmodel (BEM)
cfg = [];
%cfg.method ='openmeeg'; % TODO FIXME download openmeeg
if isunix
cfg.method ='dipoli'; % dipoli only works under linux
else
disp('TODO FIXME stick to dipoli for now or download openmeeg\n');
keyboard;
end
hdm = ft_prepare_headmodel(cfg, segmentedmri);

elec = ft_read_sens('standard_1020.elc');
hdm = ft_convert_units(hdm, elec.unit);

cfg = [];
cfg.grid.xgrid = -125:8:125;
cfg.grid.ygrid = -125:8:125;
cfg.grid.zgrid = -125:8:125;
cfg.grid.tight = 'yes';
cfg.grid.unit = hdm.unit;
cfg.inwardshift = -1.5;
cfg.vol = hdm;
grid = ft_prepare_sourcemodel(cfg)
grid = ft_convert_units(grid, elec.unit);

figure;
hold on;
ft_plot_mesh(hdm.bnd(1), 'facecolor',[0.2 0.2 0.2], 'facealpha',
0.3, 'edgecolor', [1 1 1], 'edgealpha', 0.05);
ft_plot_mesh(grid.pos(grid.inside, :));

% this step is not necessary, cause you will see that everything is
already aligned
cfg = [];
cfg.method = 'interactive';
cfg.elec = elec;
cfg.headshape = hdm.bnd(1);
tmp = ft_electroderealign(cfg);
elec = tmp; % I had a bug here that I couldn't assign elec directly

%% verify location of occipital electrodes

occ_elec = elec;
occ_chan = ft_channelselection({'O*', 'PO*', 'Cz*', 'Fz*'}, elec.label);
occ_idx = match_str(elec.label, occ_chan);
occ_elec.chanpos = occ_elec.chanpos(occ_idx, :);
occ_elec.elecpos = occ_elec.elecpos(occ_idx, :);
occ_elec.label = occ_elec.label(occ_idx, :);
figure;
ft_plot_sens(occ_elec)
hold on;
ft_plot_vol(ft_convert_units(hdm, elec.unit))/


Afair, that's all that is needed. Of course you need to adjust
folder and file names.

Greetings
Jörn

On 4/9/2013 2:04 AM, Ingrid Nieuwenhuis wrote:

Hi all,

I'd like to do source analysis (loreta and or DICS) on my EEG data.
I don't have anatomical MRIs and I don't have a measurement of the
scalp surface. So I'd like to use a template MRI or a template head
model that is located in the FieldTrip template directory. I have
EGI (128 channels) data and electrode positions (not subject
specific, just the standard file also available in FieldTrip
electrode template, GSN-HydroCel-128.sfp), but I'm kind of stuck
how to start. I don't see any examples on the FieldTrip page of how
to make a headmodel and volume conduction model giving only this
limited data. I'd be happy to make it into a example Matlab script
on the FieldTrip page after I got it to work. Would someone be able
to give me some pointers, or example code?

Thanks a lot!
Ingrid


--
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail:jm.horschig at donders.ru.nl<mailto:E-Mail:jm.horschig at donders.ru.nl>
Tel:+31-(0)24-36-68493
Web:http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl> <mailto:fieldtrip at donders.ru.nl><mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

*******************************************
Tzvetan Popov
Clinical Psychology
University of Konstanz
Box 23
78457 Konstanz, GERMANY
Phone: 0049-7531-883086
Fax: 0049-7531-884601
Email: tzvetan.popov at uni-konstanz.de<mailto:tzvetan.popov at uni-konstanz.de>
<mailto:tzvetan.popov at uni-konstanz.de><mailto:tzvetan.popov at uni-konstanz.de>
*******************************************








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

--
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305


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

--
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305



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





_______________________________________________

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/20130411/824aaa9e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: curry_vol.jpg
Type: image/jpeg
Size: 15832 bytes
Desc: curry_vol.jpg
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130411/824aaa9e/attachment.jpg>


More information about the fieldtrip mailing list