<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Emilie,
<div class=""><br class="">
</div>
<div class="">ft_sourcemovie has been designed to operate on source level data that is defined on a cortical surface based source model.</div>
<div class="">The code you pasted in suggests that you used a 3-dimensional grid as a sourcemodel. So this is never going to work.</div>
<div class="">Apparently, you managed to fool the function by post-hoc including a so-called ’tri’ field, which is the hallmark that fieldtrip uses to determine whether the sourcemodel geometry was a mesh or not.</div>
<div class="">However, there is no relation whatsoever between the specified triangulation (which you took from the headmodel) and the dipole positions at which your source activity has been estimated.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 31 Mar 2020, at 10:42, Emilie Caspar <<a href="mailto:ecaspar@ulb.ac.be" class="">ecaspar@ulb.ac.be</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Dear all, 
<div class=""><br class="">
</div>
<div class="">I am trying to compute a source reconstruction of different ERPs between two experimental conditions. Well, good news is that the script ‘works’, but the issue is that I am producing contemporary art instead of a brain with ft_sourcemovie (see
 figure in attachement). The headmodel I used is the standard one available for download. The leadfield I built seems to look like a brain with a correct positions of the electrodes (see also figure in attachement). </div>
<div class=""><br class="">
</div>
<div class="">I really have no cue about how I produced such output with ft_sourcemovie and what could possibly be the issue (code is below). If someone can help transforming this to a brain? ;-)</div>
<div class="">The only thing that differs (I think) from the tutorial is that I don’t have a headmodel.tri but rather a headmodel.bnd.tri. Don’t know if it makes any difference. Perhaps the sourcespace defined in the tutorial is something different?</div>
<div class=""><br class="">
</div>
<div class="">Thank you, </div>
<div class=""><br class="">
</div>
<div class="">Emilie</div>
<div class=""><br class="">
</div>
<div class=""><span id="cid:266B65A9-BE7C-4BE6-9E20-C7ABE9CC315E@pool.ulb.ac.be"><ft_sourcemovie.png></span><span id="cid:B4040A41-2B79-4957-95B2-3A49D12B6E15@pool.ulb.ac.be"><leadfield.png></span><span id="cid:5AA9AF20-25AE-4082-9E1B-4FD38A4FC417@pool.ulb.ac.be"><ft_plot_mesh.png></span></div>
<div class=""><br class="">
</div>
<div class=""><b class="">CODE</b></div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">q=biosim64;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">ph = cell2mat(q(:,2));</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">th = cell2mat(q(:,3));</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">x = sin(ph*pi/180) .* cos(th*pi/180);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">y = sin(ph*pi/180) .* sin(th*pi/180);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">z = cos(ph*pi/180);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">plot3(x, y, z,
<span style="color: #b245f3" class="">'.'</span>);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">elec.label = q(:,1);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">elec.pnt = [x y z];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.sourcemodel.pos = elec.pnt;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">sourcemodel = ft_prepare_sourcemodel(cfg);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">headmodel = ft_read_headmodel(<span style="color: #b245f3" class="">'headmodel/standard_bem.mat'</span>);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
% realign electrodes to headmodel</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.method =
<span style="color: #b245f3" class="">'interactive'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.elec = elec;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.headshape = headmodel.bnd(1);
<span style="color: #25992d" class="">%1 = skin</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">elec = ft_electroderealign(cfg);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
%save new electrodes</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class="">
<span style="" class="">save </span>elec64.mat<span style="" class=""> </span>elec</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243); min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px;" class=""><font face="Courier" size="1" class="">ERPsAll.elec = ft_read_sens(</font><span style="font-family: Courier; font-size: 10px; color: rgb(178, 69, 243);" class="">'elec64.mat</span><font color="#b245f3" face="Courier" size="1" class="">’</font><font face="Courier" size="1" class="">);</font></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class=""><br class="">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
% Prepare leadfield</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg                 = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.elec            = ERPsAll.elec;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.vol             = headmodel;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.reducerank      = 3;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
<span style="" class="">cfg.grid.resolution = 1;   </span>% use a 3-D grid with a 1 cm resolution</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.grid.unit       =
<span style="color: #b245f3" class="">'cm'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.channel ={<span style="color: #b245f3" class="">'all'</span>};</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">leadfield = ft_prepare_leadfield(cfg);</div>
<p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
%%mne</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg              = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
<span style="" class="">cfg.method       = </span><span style="color: #b245f3" class="">'mne'</span><span style="" class="">;
</span>%pcc: partial cannonical correlation/coherence</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.elec         = ERPsAll.elec;
<span style="color: #25992d" class="">%grid.cfg.elec;%</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.headmodel          = headmodel;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.grid = leadfield;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
%cfg.sourcemodel = sourcemodel;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
% cfg.channel ={'all'};%, '-spmnas', '-spmlpa', '-spmrpa'};</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.mne.prewhiten =
<span style="color: #b245f3" class="">'yes'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.mne.lambda    = 3;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.mne.scalesourcecov =
<span style="color: #b245f3" class="">'yes'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
%cfg.reducerank          = 2;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">source_C_Shock = ft_sourceanalysis(cfg, GA_C_Shock);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">source_C_Noshock = ft_sourceanalysis(cfg, GA_C_NOshock);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class=""><br class="">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class="">
<span style="" class="">save </span>source_C_Shock.mat<span style="" class=""> </span>
source_C_Shock</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class="">
<span style="" class="">save </span>source_C_Noshock.mat<span style="" class=""> </span>
source_C_Noshock</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class="">
<br class="">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">bnd.pos = headmodel.bnd.pos;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">bnd.tri = headmodel.bnd.tri;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">m=source_C_Shock.avg.pow(:,450); </div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
%timeN1 = [1232:1301];timeP3 = [1722:1927];timeeLPP = [1928:2356];timelLPP = [2357:2868];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">ft_plot_mesh(bnd,
<span style="color: #b245f3" class="">'vertexcolor'</span>, m);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">view([180 0]); h = light; set(h,
<span style="color: #b245f3" class="">'position'</span>, [0 1 0.2]); lighting <span style="color: #b245f3" class="">
gouraud</span>; material <span style="color: #b245f3" class="">dull</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243); min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.projectmom =
<span style="color: #b245f3" class="">'yes'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">sdShock  = ft_sourcedescriptives(cfg,source_C_Shock);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">sdNoShock = ft_sourcedescriptives(cfg,source_C_Noshock);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">sdDIFF         = sdNoShock;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">sdDIFF.avg.pow = sdNoShock.avg.pow - sdShock.avg.pow;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">sdDIFF.tri = headmodel.bnd.tri;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class="">
<span style="" class="">save </span>sd<span style="" class=""> </span>sdDIFF<span style="" class="">;</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.funparameter =
<span style="color: #b245f3" class="">'pow'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
%cfg.method       = 'surface';</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">ft_sourcemovie(cfg,sdDIFF);</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div apple-content-edited="true" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
---------------------------------------------<br class="">
Emilie Caspar, Ph.D<br class="">
 <br class="">
CO3, Centre de Recherche Cognition et Neurosciences (CRCN), ULB </div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Voice : +32 2 650 32 95 <br class="">
mail : <a href="mailto:ecaspar@ulb.ac.be" class="">ecaspar@ulb.ac.be</a><br class="">
office: DB10-138 </div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Social Brain Lab, Netherlands Institute for Neuroscience (NIN), KNAW<br class="">
mail : <a href="mailto:e.caspar@nin.knaw.nl" class="">e.caspar@nin.knaw.nl</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br class="">
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://doi.org/10.1371/journal.pcbi.1002202<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>