<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Dear Julian,<br>
</p>
<p><br>
</p>
<p>thanks for your quick response!<br>
</p>
<p>You are absolutely right, my problem was that I was not creating the elec file correctly as a struct with the fields chanpos, elecpos and label.<br>
</p>
<p><br>
</p>
<p>I'm now facing another problem, though. I'm trying to use ft_electroderealign, but I can't seem to achieve a satisfying result. Here is what I am doing:<br>
</p>
<p><br>
</p>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>cfg = [];</div>
<div>cfg.method    = 'headshape';<br>
</div>
<div>%     cfg.warp        = <br>
</div>
<div><span style="font-size: 12pt;">cfg.elec      = elec;</span></div>
<div>cfg.headshape = vol.bnd(1);</div>
<div>elec_new = ft_electroderealign(cfg);</div>
</blockquote>
<p><br>
</p>
<p>I then try to plot overlaid the skin surface as loaded from 'standard_skin_14038.vol' and the new electrode location but I get inconsistent results, the electrodes are always inside the head. I tried different warping methods without success. This is the
 closest I managed to get: <br>
</p>
<p><br>
</p>
<p><img name="null" title="pastedImage.png" originalwidth="540" originalheight="411" rszimgcmd="100" src="cid:809f04f6-d9d9-4e7d-b722-79f7a535c0fd"><br>
</p>
<p><br>
</p>
<p>Do you have any recommendation on how to better align the electrodes to the template?<br>
</p>
<p><br>
</p>
<p>Thanks!<br>
</p>
<p>Silvia<br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> fieldtrip <fieldtrip-bounces@science.ru.nl> on behalf of Julian Keil <julian.keil@gmail.com><br>
<b>Sent:</b> 10 January 2019 11:58<br>
<b>To:</b> FieldTrip discussion list<br>
<b>Subject:</b> Re: [FieldTrip] EEG source reconstruction with template - elec file</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>Dear Silvia,</div>
<div><br>
</div>
<div>how is the electrode location information from the BioSemi website not enough?</div>
<div>Basically, you can create your own electrode definition by giving the labels and locations to a structure, e.g.
<br>
</div>
elec.label{1} = 'Fp1';<br>
elec.chanpos(1,:) = [-27.0333934563814, 83.2002299946862, -3.05493522574547];</div>
<div dir="ltr"><br>
</div>
<div>or for all your electrodes in one go:</div>
<div>elec.label = {'Fp1','AF7','AF3','F1','F5'};<br>
elec.chanpos = [-27.0333934563814, 83.2002299946862, -3.05493522574547;...<br>
-51.4205700085246, 70.7743429000555, -3.05493522574547;...<br>
-35.5608995849164, 76.2605952593987, 24.1279774030766;...<br>
-25.1195714566887, 62.1731210759014, 56.2665567427342;...<br>
-47.7073482911603, 58.9136687505812, 43.7676114900325];</div>
<div><br>
</div>
<div>plot3(elec.chanpos(:,1),elec.chanpos(:,2),elec.chanpos(:,3),'*')</div>
<div><br>
</div>
<div>or of course read them more elegantly from a text file ;-)<br>
</div>
<div><br>
</div>
<div>It might be a good idea to double check the alignment with the template headmodel afterwards using ft_electroderealign<br>
</div>
<div>You can then use this elec structure in all subsequent analyses.</div>
<div><br>
</div>
<div>I hope that helps,</div>
<div><br>
</div>
<div>Julian<br>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Thu, Jan 10, 2019 at 10:59 AM Silvia Formica <<a href="mailto:Silvia.Formica@ugent.be" target="_blank">Silvia.Formica@ugent.be</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Dear all,<br>
</p>
<p><br>
</p>
<p>I have a EEG dataset, collected with a Biosemi system with 64 channels. I don't have the individual anatomical data for each participant, but I want to perform source reconstruction to have at least a rough localization of the activation I find.<br>
</p>
<p><br>
</p>
<p>Therefore, I intend to use the templates provided by fieldtrip. If I understand correctly, independently of the source modelling technique that I will choose to use, I need the following information:<br>
</p>
<p><br>
</p>
<p></p>
<div>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">1) the <strong>head model</strong> : this would be the template '<em>standard_bem'</em><br>
</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><br>
</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">2) the <strong>source model</strong> : the template '<em>cortex_5124.surf.gii</em>'<br>
</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><br>
</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">3) the <strong>elec information</strong> :​ this file should describe the spatial configuration of the electrodes, but I can't retrieve it. I don't think any of the templates available
 fits my data (they all have more than 64 channels and different configurations). </p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><br>
</p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">I tried to use the function ft_read_sens on my data but I get the following error<br>
</p>
</div>
<p><span style="font-size:12pt"><br>
</span></p>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<p><span style="font-size:12pt">elec    = ft_read_sens([</span><span style="font-size:12pt">data_filt5.mat'],'senstype','eeg');</span></p>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<p><br>
</p>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">Undefined function or variable 'lab'.</span></div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><br style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">Error in channelposition (line 316)</span></div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">n   = size(lab,2);</span></div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><br style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">Error in ft_datatype_sens (line 349)</span></div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">        [chanpos, chanori, lab] = channelposition(sens);</span></div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><br style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">Error in ft_datatype_sens (line 158)</span></div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">    sens = ft_datatype_sens(sens, 'version', '2011v2');</span></div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><br style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">Error in ft_read_sens (line 380)</span></div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px; border:medium none; padding:0px">
<div><span style="color:rgb(255,0,0); text-decoration:none rgb(255,0,0)">sens = ft_datatype_sens(sens);</span><br>
</div>
</blockquote>
</blockquote>
<p><br>
</p>
<p><br>
</p>
<p>I found the cartesian coordinates of the electrodes on the Biosemi website, with the x y z coordinates for each electrodes (as the little example I'm giving below, but that's not enough. <br>
</p>
<p><br>
</p>
<span style="font-size:12pt">Channel             x</span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">y</span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt">    </span><span style="font-size:12pt"> 
   z</span><br>
<span style="font-size:12pt">Fp1                 -27.0333934563814</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">83.2002299946862</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">-3.05493522574547</span><br>
<span style="font-size:12pt">AF7                 -51.4205700085246</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">70.7743429000555</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">-3.05493522574547</span><br>
<span style="font-size:12pt">AF3                 -35.5608995849164</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">76.2605952593987</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">24.1279774030766</span><br>
<span style="font-size:12pt">F1                     -25.1195714566887</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">62.1731210759014</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">56.2665567427342</span><br>
<span style="font-size:12pt">F5                     -47.7073482911603</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">58.9136687505812</span><span style="font-size:12pt; white-space:pre-wrap">
</span><span style="font-size:12pt">43.7676114900325</span><br>
<p>...                   ​    ...                                        ...                                    ...</p>
<p><br>
</p>
<p><br>
</p>
<p><strong>Do you have any suggestions on how to create a correct elec file fitting my data?</strong><br>
</p>
<p>Any help would be highly appreciated!<br>
</p>
<p><br>
</p>
<p>Silvia<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote>
</div>
</div>
</div>
</body>
</html>