<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" bgcolor="#FFFFFF">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Ingrid,<br>
<br>
I had a similar issue a few weeks ago, where my lower most electrodes started floating after electrode realign using the ft_electroderealign function.<br>
<br>
I used the ft_prepare_vol_sens as,<br>
[vol, elecR]=ft_prepare_vol_sens (col,elecR) and this did the trick and brought the electrodes on to the skin.
<br>
<br>
Hope this helps...!<br>
<br>
Regards<br>
Imali<br>
 <br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<div style="direction: ltr;" id="divRpF358749"><font color="#000000" face="Tahoma" size="2"><b>From:</b> fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl] on behalf of Ingrid Nieuwenhuis [inieuwenhuis@berkeley.edu]<br>
<b>Sent:</b> Wednesday, 10 April 2013 9:29 AM<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Subject:</b> Re: [FieldTrip] source analysis EEG data without MRI<br>
</font><br>
</div>
<div></div>
<div>Hi all,<br>
<br>
A follow up on this and some new issues:<br>
<br>
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:<br>
a) the dipoli method does not work on Windows<br>
b) I downloaded the openmeeg toolbox, but got an error "om_minverser.exe has stopped working" I've emailed their buglist<br>
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.<br>
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<br>
<br>
And away went my determination to do it myself, so I continued using the<a href="http://fieldtrip.fcdonders.nl/template/headmodel?s[]=standard&s[]=bem" target="_blank"> standard_bem.mat</a>. (I did not know this existed, I've added this link to note in the
<a href="http://fieldtrip.fcdonders.nl/tutorial/headmodel_eeg?&#background" target="_blank">
headmodel tutorial</a> to make it easier to find, thanks Tzvetan for pointing this out!).<br>
<br>
2) This worked and after some fiddling to get the electrodes aligned it looks okay (see attached).
<br>
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?
<br>
<b>So my question is:</b><br>
a) will this cause great inaccuracies?<br>
b) if so, how can I extend the skin to go lower? The template MRI only goes that far to the bottom... Trick anyone?<br>
<br>
Thanks again,<br>
Ingrid<br>
<br>
<br>
<div class="moz-cite-prefix">On 4/9/2013 9:39 AM, Ingrid Nieuwenhuis wrote:<br>
</div>
<blockquote type="cite">Thanks Jörn and Tzvetan for the scripts! I'll try it out and put it on the wiki.<br>
Have a great day,<br>
Ingrid<br>
<br>
<div class="moz-cite-prefix">On 4/9/2013 12:32 AM, Tzvetan Popov wrote:<br>
</div>
<blockquote type="cite">Dear Ingrid,
<div><br>
</div>
<div>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.</div>
<div>Good luck</div>
<div>tzvetan</div>
<div>
<div style="margin:0px; font-size:9px; font-family:Courier; color:rgb(37,153,45)">
%% read electrodes</div>
<div style="margin:0px; font-size:9px; font-family:Courier; color:rgb(178,69,243)">
<span style="color:#000000">elec = ft_read_sens(</span>'/your path/fieldtrip-20130324/template/electrode/GSN-HydroCel-128.sfp'<span style="color:#000000">);</span></div>
<div style="margin:0px; font-size:9px; font-family:Courier; color:rgb(37,153,45)">
%% read  headmodel</div>
<div style="margin:0px; font-size:9px; font-family:Courier; color:rgb(178,69,243)">
<span style="color:#000000">templateheadmodel = </span>'/your path/fieldtrip-20130324/template/headmodel/standard_bem.mat'<span style="color:#000000">;</span></div>
<div style="margin:0px; font-size:9px; font-family:Courier">load(templateheadmodel);</div>
<div style="margin:0px; font-size:9px; font-family:Courier; color:rgb(37,153,45)">
%% electrode realign as good as possible</div>
<div style="margin:0px; font-size:9px; font-family:Courier; color:rgb(37,153,45)">
% i.e. translate 0 -2 1.5</div>
<div style="margin:0px; font-size:9px; font-family:Courier">cfg=[];</div>
<div style="margin:0px; font-size:9px; font-family:Courier">cfg.method = <span style="color:#b245f3">
'interactive'</span>;</div>
<div style="margin:0px; font-size:9px; font-family:Courier">cfg.elec = elec;</div>
<div style="margin:0px; font-size:9px; font-family:Courier">cfg.headshape = vol.bnd(1).pnt;</div>
<div style="margin:0px; font-size:9px; font-family:Courier">elecR = ft_electroderealign(cfg);</div>
<div style="margin:0px; font-size:9px; font-family:Courier; color:rgb(37,153,45)">
%% verify how the electrodes fit toghether with the brain volume</div>
<div style="margin:0px; font-size:9px; font-family:Courier">cfg=[];</div>
<div style="margin:0px; font-size:9px; font-family:Courier">cfg.method = <span style="color:#b245f3">
'interactive'</span>;</div>
<div style="margin:0px; font-size:9px; font-family:Courier">cfg.elec = elecR;</div>
<div style="margin:0px; font-size:9px; font-family:Courier">cfg.headshape = vol.bnd(3).pnt;</div>
<div style="margin:0px; font-size:9px; font-family:Courier">elecR = ft_electroderealign(cfg);</div>
</div>
<div><br>
</div>
<div>
<div><br class="Apple-interchange-newline">
<blockquote type="cite">
<div bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Ingrid,<br>
<br>
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:<br>
<i><small>% read in the template MRI<br>
    if isunix<br>
      mri = ft_read_mri('/home/common/matlab/fieldtrip/external/spm8/templates/T1.nii');<br>
    elseif ispc<br>
      mri = ft_read_mri(fullfile('M:', 'FieldTrip', 'trunk', 'external', 'spm8', 'templates', 'T1.nii'));<br>
    end<br>
<br>
<br>
% segment the MRI<br>
cfg           = [];<br>
cfg.output    = {'brain'  'skull'  'scalp'};<br>
segmentedmri  = ft_volumesegment(cfg, mris);<br>
<br>
<br>
% create the headmodel (BEM)<br>
cfg        = [];<br>
%cfg.method ='openmeeg'; % TODO FIXME download openmeeg<br>
if isunix<br>
  cfg.method ='dipoli'; % dipoli only works under linux<br>
else<br>
  disp('TODO FIXME stick to dipoli for now or download openmeeg\n');<br>
  keyboard;<br>
end<br>
hdm        = ft_prepare_headmodel(cfg, segmentedmri);<br>
<br>
elec       = ft_read_sens('standard_1020.elc');<br>
hdm        = ft_convert_units(hdm, elec.unit);<br>
<br>
  cfg = [];<br>
  cfg.grid.xgrid  = -125:8:125; <br>
  cfg.grid.ygrid  = -125:8:125; <br>
  cfg.grid.zgrid  = -125:8:125;<br>
  cfg.grid.tight  = 'yes'; <br>
  cfg.grid.unit   = hdm.unit;<br>
  cfg.inwardshift = -1.5;<br>
  cfg.vol        = hdm;<br>
  grid  = ft_prepare_sourcemodel(cfg)<br>
  grid        = ft_convert_units(grid, elec.unit);<br>
<br>
figure;<br>
hold on;<br>
ft_plot_mesh(hdm.bnd(1), 'facecolor',[0.2 0.2 0.2], 'facealpha', 0.3, 'edgecolor', [1 1 1], 'edgealpha', 0.05);<br>
ft_plot_mesh(grid.pos(grid.inside, :));<br>
<br>
% this step is not necessary, cause you will see that everything is already aligned<br>
  cfg           = [];<br>
  cfg.method    = 'interactive';<br>
  cfg.elec      = elec;<br>
  cfg.headshape = hdm.bnd(1);<br>
  tmp  = ft_electroderealign(cfg);<br>
  elec = tmp; % I had a bug here that I couldn't assign elec directly<br>
<br>
%% verify location of occipital electrodes<br>
<br>
occ_elec = elec;<br>
occ_chan = ft_channelselection({'O*', 'PO*', 'Cz*', 'Fz*'}, elec.label);<br>
occ_idx = match_str(elec.label, occ_chan);<br>
occ_elec.chanpos = occ_elec.chanpos(occ_idx, :);<br>
occ_elec.elecpos = occ_elec.elecpos(occ_idx, :);<br>
occ_elec.label = occ_elec.label(occ_idx, :);<br>
figure;<br>
ft_plot_sens(occ_elec)<br>
hold on;<br>
ft_plot_vol(ft_convert_units(hdm, elec.unit))</small></i><br>
<br>
<br>
Afair, that's all that is needed. Of course you need to adjust folder and file names.<br>
<br>
Greetings<br>
Jörn<br>
<br>
On 4/9/2013 2:04 AM, Ingrid Nieuwenhuis wrote:<br>
</div>
<blockquote type="cite">Hi all, <br>
<br>
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?
<br>
<br>
Thanks a lot! <br>
Ingrid <br>
<br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
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: <a class="moz-txt-link-abbreviated" href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a>
Tel:    +31-(0)24-36-68493
Web: <a class="moz-txt-link-freetext" href="http://www.ru.nl/donders" target="_blank">http://www.ru.nl/donders</a>

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands</pre>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
</div>
<br>
<div><span class="Apple-style-span" style="border-collapse:separate; border-spacing:0px"><span class="Apple-style-span" style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<div style="word-wrap:break-word"><span class="Apple-style-span" style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<div style="word-wrap:break-word"><span class="Apple-style-span" style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<div style="word-wrap:break-word"><span class="Apple-style-span" style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<div style="word-wrap:break-word"><span class="Apple-style-span" style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-indent:0px; text-transform:none; orphans:2; white-space:normal; widows:2; word-spacing:0px">
<div style="word-wrap:break-word">
<div>*******************************************</div>
<div>Tzvetan Popov  </div>
<div>Clinical Psychology       </div>
<div>University of Konstanz</div>
<div>Box 23</div>
<div>78457 Konstanz, GERMANY</div>
<div>Phone: 0049-7531-883086</div>
<div>Fax:      0049-7531-884601</div>
<div>Email:  <a href="mailto:tzvetan.popov@uni-konstanz.de" target="_blank">tzvetan.popov@uni-konstanz.de</a></div>
</div>
*******************************************</span></div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</span><br class="Apple-interchange-newline">
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader" target="_blank"></fieldset> <br>
<pre>_______________________________________________
fieldtrip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305 </pre>
<br>
<fieldset class="mimeAttachmentHeader" target="_blank"></fieldset> <br>
<pre>_______________________________________________
fieldtrip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305 </pre>
</div>
</div>
</div>
</body>
</html>