<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
Hi Maurice,
<div>The way in which you visualize the leadfield vectors it is hard to see in which locations the arrows are big. My suspicion is (unless otherwise proven) that you are suffering from numerical problems at dipole positions close to the inner boundary.</div>
<div>Best,</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<div>
<div>On Mar 19, 2015, at 12:34 PM, <a href="mailto:m.goeldi@psychologie.uzh.ch">m.goeldi@psychologie.uzh.ch</a> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><span><br>
Hi all<br>
<br>
I am trying to do beamforming with my EEG data. I am using the template headmodel etc provided in fieldtrip to compute the leadfield.<br>
Since my data looks strange I have visualized the leadfield expecting grid points close to the electrode to have a larger leadfield.<br>
Unfortunately this is not the case. The vectors are all over the place. See figure.<br>
<br>
</span><br>
<img><span><br>
The red circle is the electrode location (Cz).<br>
The field looks (qualitatively) just as wrong for any other electrode.<br>
<br>
Below is the code I used to generate & visualize the lead field.<br>
<br>
I have used the same code to visualize the leadfield from a example MEG file from the fieldtrip page.<br>
There the result is as expected, so I think the problem lies not in the visualization.<br>
<br>
I am using fieldtrip-20150118<br>
<br>
I have tried all the standard_sourcemodel3d*mm files. Qualitatively the error remains the same.<br>
<br>
My question is, am I doing anything wrong in generating the lead field?<br>
Am I expecting something wrong (i.e. is this a realistidc lead field?)<br>
Does anyones lead field look the same/different when using the template files?<br>
<br>
I would appreciate any help with this problem.<br>
<br>
<br>
Thanks for your thoughts<br>
<br>
Cheers<br>
Maurice<br>
<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<br>
% load mri<br>
load('C:\Program Files\MATLAB\fieldtrip-20150118\template\headmodel\standard_mri.mat')<br>
<br>
% load template sourcemodel<br>
template = load('C:\Program Files\MATLAB\fieldtrip-20150118\template\sourcemodel\standard_sourcemodel3d8mm');<br>
<br>
% compute source model<br>
cfg = [];<br>
cfg.grid.warpmni = 'yes';<br>
cfg.grid.template = template.sourcemodel;<br>
cfg.grid.nonlinear = 'yes'; % use non-linear normalization<br>
cfg.grid.resolution = 6;<br>
cfg.mri = mri;<br>
sourcemodel = ft_prepare_sourcemodel(cfg);<br>
sourcemodel = ft_convert_units(sourcemodel, 'cm');<br>
<br>
% make head model<br>
load('C:\Program Files\MATLAB\fieldtrip-20150118\template\headmodel\standard_bem.mat');<br>
vol = ft_convert_units(vol, 'cm');<br>
<br>
%% electrode layout<br>
elec = ft_read_sens('C:\Program Files\MATLAB\spm12\EEGtemplates\egi128_GSN_HydroCel.sfp');
<br>
[elec] = removeelectrodes(elec,data.label); % remove the electrodes that are not in my data<br>
elec = ft_convert_units(elec,'cm');<br>
<br>
% lead field<br>
cfg = [];<br>
cfg.grid = sourcemodel;<br>
cfg.elec = elec;<br>
cfg.vol = vol;<br>
cfg.channel = 'all';<br>
[grid] = ft_prepare_leadfield(cfg,freqC1);<br>
grid = ft_convert_units(grid, 'cm');<br>
<br>
<br>
<br>
%%%% visualize leadfield %%%%<br>
channel = 'Cz';<br>
<br>
%% electrode position<br>
elecpos = grid.cfg.elec.elecpos(strcmp(grid.cfg.elec.label,channel),:);<br>
<br>
%% leadfield positions<br>
leadfieldpos = grid.pos(grid.inside,:);<br>
<br>
%% extract leadfield<br>
npts = numel(grid.leadfield);<br>
lead = grid.leadfield(grid.inside);<br>
<br>
nchan = find(strcmp(grid.cfg.channel,channel));<br>
for i = 1:numel(lead)<br>
leadVect(i,:) = lead{i}(nchan,:);<br>
end<br>
<br>
figure; hold on % plot all objects in one figure<br>
ft_plot_mesh(vol.bnd(3), 'edgecolor','none','facealpha',0.8,'facecolor',[0.6 0.6 0.8]);<br>
ft_plot_mesh(vol.bnd(2), 'edgecolor','none','facealpha',0.8,'facecolor','y');<br>
alpha 0.3<br>
scale = 30;<br>
quiver3(leadfieldpos(:,1),leadfieldpos(:,2),leadfieldpos(:,3),leadVect(:,1),leadVect(:,2),leadVect(:,3),scale)<br>
plot3(elecpos(1),elecpos(2),elecpos(3),'ro')<br>
<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<br>
<br>
<br>
---<br>
University of Zürich<br>
Maurice Göldi<br>
Department of Psychology<br>
Biopsychology<br>
Binzmühlestr. 14 / Box 5<br>
CH - 8050 Zürich<br>
<br>
Tel. +41 (0)44 635 74 55<br>
<a href="http://www.psychologie.uzh.ch/">www.psychologie.uzh.ch</a><br>
<a href="mailto:maurice.goeldi@uzh.ch">maurice.goeldi@uzh.ch</a></span>
<div></div>
</font>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</blockquote>
</div>
<br>
</div>
</body>
</html>