<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear Jan-Mathijs,<div class=""><br class=""></div><div class="">Thank you for those pointers because indeed now I have obtained a nice brain instead of my contemporary piece of art (see Figure attached!) (I write below the full code, if others would find it relevant as well).</div><div class=""><br class=""></div><div class="">I am however struggled to find out how to extract the coordinates of the source reconstruction in order to use them as a ROI on MRI data. If I use the ft_sourcemovie, I can obtain the indications of the coordinates when I click on a specific location. But I guess it’s not the most proper method?</div><div class=""><br class=""></div><div class="">I have used the ft_sourceplot function based on an atlas that I uploaded in the templates. However, it does not plot the data, only a template brain with unknown as X Y and Z coordinates. </div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">atlas = ft_read_atlas(<span style="color: rgb(178, 69, 243);" class="">'ROI_MNI_V4.nii'</span>);            </div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">statint.coordsys = <span style="color: rgb(178, 69, 243);" class="">'mni'</span>;</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: rgb(178, 69, 243);" class="">'ortho'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.funparameter  = <span style="color: rgb(178, 69, 243);" class="">'stat'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.maskparameter = <span style="color: rgb(178, 69, 243);" class="">'mask'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.locationcoordinates = <span style="color: rgb(178, 69, 243);" class="">'head'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.atlas         = atlas;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.location = <span style="color: rgb(178, 69, 243);" class="">'max'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.funcolorlim   = [-5 5];</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.funcolormap = <span style="color: rgb(178, 69, 243);" class="">'jet'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">ft_sourceplot(cfg,sdDIFFC);</div><p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class=""> </p></div><div class="">I also used the ft_volumelookup function as follow</div><div class=""><br class=""></div><div class=""><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.atlas = atlas;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.inputcoord = <span style="color: #b245f3" class="">'mni'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.maskparameter = <span style="color: #b245f3" class="">'inside'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">labels = ft_volumelookup(cfg,sdDIFFC);</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">But it fails to recognize the atlas</div><div class=""><br class=""></div><div class="">Do you want to change the anatomical labels for the axes [Y, n]? Y<br class="">What is the anatomical label for the positive X-axis [r, l, a, p, s, i]? r<br class="">What is the anatomical label for the positive Y-axis [r, l, a, p, s, i]? a<br class="">What is the anatomical label for the positive Z-axis [r, l, a, p, s, i]? s<br class="">Is the origin of the coordinate system at the a(nterior commissure), i(nterauricular), n(ot a landmark)? n<br class=""><font color="#ff4013" class="">Warning: The field cfg.inputcoord is forbidden, it will be removed from your configuration<br class=""> <br class=""> In ft_checkconfig at line 224<br class=""> In ft_volumelookup at line 119<br class=""><br class="">Error using atlas_lookup (line 89)<br class="">the mismatch between the coordinate system in the atlas and the coordinate system in the data cannot be<br class="">resolved</font></div><div class=""><font color="#ff4013" class=""><br class=""></font></div><div class="">Therefore, I was wondering what the most reliable option is to exact coordinates from the EEG source reconstruction than I can later implement as ROI in MRI data. Any suggestions is welcome!</div><div class=""><br class=""></div><div class="">Thanks a lot for the help, </div><div class=""><br class=""></div><div class="">Emilie</div><div class=""><img height="583" width="970" apple-width="yes" apple-height="yes" apple-inline="yes" id="276AB5A0-4BC6-42FE-B3E8-926821B80A87" src="cid:34A3CEE4-F946-442F-A8C4-8A84B4450BE0@home" class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">—— Code used:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class=""><span style="color: #000000" class="">load </span>Subject01_sourcemodel_15684<span style="color: #000000" class="">;</span></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><p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class="">electr_pos=ft_read_sens(<span style="color: rgb(178, 69, 243);" class="">'Biosemi-Cap64.sfp'</span>);</p><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class=""><span style="color: #000000" class="">load(</span>'GA_C_Shock.mat'<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class=""><span style="color: #000000" class="">load(</span>'GA_C_NOShock.mat'<span style="color: #000000" class="">)</span></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="">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 = electr_pos;</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, electr_pos);</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class=""><br class=""></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="color: #000000" class="">cfg.elec = elec;   </span>% sensor information</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.channel = elec.label;<span style="color: #25992d" class="">%;  % the used channels</span></div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.sourcemodel    = sourcemodel;   <span style="color: #25992d" class="">% source points</span></div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.headmodel = headmodel;   <span style="color: #25992d" class="">% volume conduction model</span></div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.singleshell.batchsize = 5000; <span style="color: #25992d" class="">% speeds up the computation</span></div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">leadfield   = ft_prepare_leadfield(cfg);</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class=""><br class=""></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="">'mne'</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.grid          = leadfield;</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.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;" 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;" 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="">sd_C_SHOCK  = ft_sourcedescriptives(cfg,source_C_Shock);</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;" 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="">sd_C_NOshock = ft_sourcedescriptives(cfg, source_C_Noshock);</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;" class=""><br class=""></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;" class="">sdDIFFC         = sd_C_SHOCK;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">sdDIFFC.avg.pow = sd_C_SHOCK.avg.pow - sd_C_NOshock.avg.pow;</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;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">figure</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class=""><span style="color: rgb(0, 0, 0);" class="">m=</span><span style="color: rgb(0, 0, 0);" class="">sdDIFFC</span><span style="color: rgb(0, 0, 0);" class="">.avg.pow(:,500); </span>% plotting the result at the 450th time-point that is</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class=""><span style="color: #000000" class="">                         </span>% 500 ms after the zero time-point       </div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">ft_plot_mesh(source_FR_Shock, <span style="color: #b245f3" class="">'vertexcolor'</span>, m);</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">view([180 0]); </div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">h = light; </div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">set(h, <span style="color: #b245f3" class="">'position'</span>, [0 1 0.2]); </div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">lighting <span style="color: #b245f3" class="">gouraud</span>; </div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">material <span style="color: #b245f3" class="">dull</span></div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class=""><br class=""></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div apple-content-edited="true" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; 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=""><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><blockquote type="cite" class=""><div class="">Le 3 avr. 2020 à 19:02, Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl" class="">jan.schoffelen@donders.ru.nl</a>> a écrit :</div><br class="Apple-interchange-newline"><div class="">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">

<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Emilie,
<div class=""><br class="">
</div>
<div class="">Hmmm, a few pointers:</div>
<div class=""><br class="">
</div>
<div class="">Yes, it seems that you are expecting something from ft_sourceinterpolate that the function cannot deliver. In the pasted code you specify that you want to interpolate the parameter ‘elec.chanpos’. This is incorrect. If anything, you can only meaningfully
 interpolate parameters that are defined with a scalar per source dipole position, and in addition only using fields in a structure that are available in the input data structure. since source_C_Shock by construction should not contain an elec field, this is
 never going to work. In addition, the elec.chanpos field does not map onto the source dipole positions, so this is the second reason why this is never going to work.</div>
<div class="">Also, if I am not mistaken ft_sourceinterpoalte cannot deal with data that are vectors (e.g. source activity time courses) for each source position, so even if you would specify cfg.parameter to be ‘pow’, or ‘avg.pow’ this will probably not work.</div>
<div class=""><br class="">
</div>
<div class="">Once again, indeed the tutorial mentions the ’tri’ field as a prerequisite to be able to visualize data in ft_sourcemovie. Since you created your sourcemodel to be a 3D grid, which is volumetric in nature, and not the expected surface description
 (that is based on a combination of vertex positions (in fieldtrip speak: pos) and faces (in fieldtrip speak: tri)) the visualization you wish for does not work. Hence Eelke’s suggestion to use ft_sourceinterpolate first, which I question as per my comment
 above.</div>
<div class=""><br class="">
</div>
<div class="">Besides, in general I would recommend against using a 3D grid as a sourcemodel when using a distributed inverse modelling approach. The reason for this is that activity is going to be ‘mapped’ onto locations that does not make sense a priori (white
 matter). </div>
<div class=""><br class="">
</div>
<div class="">Finally, your current results containing a lot of NaNs is perfectly fine, since this corresponds to source dipole locations that lie outside the volume of interest, i.e. outside the head.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 2 Apr 2020, at 17:33, 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 Elke and Jan-Mathijs,
<div class=""><br class="">
</div>
<div class="">Thank you for your answers. So indeed I now understand the problem, but I still have issues to solve that problem. It’s probably something simple to solve but I do not find it. Basically, I have now tried to use the ft_sourceinterpolate, as suggested.
 As far as I understand, this has to be done after the ft_sourceanalysis. However, I constantly have an issue with cfg_parameters, which should be the positions of the electrodes. I run the following code (full code below):</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px;" class="">
<div style="font-size: 10px; font-family: Courier; margin: 0px;" class="">cfg = [];</div>
<div style="font-size: 10px; font-family: Courier; margin: 0px;" class="">cfg.parameter =
<span style="color: #b245f3" class="">'elec.chanpos'</span>;</div>
<div style="font-size: 10px; font-family: Courier; margin: 0px;" class="">cfg.interpmethod  =
<span style="color: #b245f3" class="">'nearest'</span>;</div>
<div style="font-size: 10px; font-family: Courier; margin: 0px;" class="">interp = ft_sourceinterpolate(cfg, source_C_Shock, sourcemodel)</div>
<div style="font-size: 10px; margin: 0px; min-height: 12px;" class=""> <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; min-height: 14px;" class=""><span style="font-size: 12px;" class="">I get the following error message: "</span><font color="#e32400" style="font-size: 12px;" class="">Reference to non-existent field 'elec’.</font><span style="font-size: 12px;" class=""> », which
 I do not get since I do have my ‘elec’ file which is indeed opened, with a .chanpos that contains the positions of the electrodes. </span></div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">Perhaps I am doing something wrong with ft_sourceinterpolate. But in fact I am also worried about the fact that the file which results from the ft_sourceanalysis has lots of NaN (see screenshot in attachement) and I am not sure it should be the
 case or if I should have obtained full data in each case. From the tutorials, the source model have a .tri but I don’t have one in the source model I have created. Perhaps it may also be the source of the issue?</div>
<div class=""><br class="">
</div>
<div class="">Thank you in advance for your time!</div>
<div class=""><br class="">
</div>
<div class="">Emilie</div>
<div class=""><br class="">
</div>
<div class=""><span id="cid:61A2ED64-D59B-4C41-838F-3BAB5278C828@home" class=""><NaN.png></span></div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
<br class="">
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class="">
<span style="" class="">load </span>biosemi64.mat</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">q=angles;</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="">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);" class="">
%electr_pos=ft_read_sens('Biosemi-Cap64.sfp');</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; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
%ERPsAll.elec = ft_read_sens('Biosemi-Cap64.sfp');</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="">
% 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            = elec;</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.reducerank      = 3;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">
<span style="" class="">cfg.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.sourcemodel.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><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="">
%% 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         = 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; color: rgb(37, 153, 45);" class="">
<br class="">
</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.parameter =
<span style="color: #b245f3" class="">'elec.chanpos'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.interpmethod  =
<span style="color: #b245f3" class="">'nearest'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">interp = ft_sourceinterpolate(cfg, source_C_Shock, sourcemodel)</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="">
<br class="">
</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; color: rgb(37, 153, 45);" class="">
 </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;" class="">ft_sourcemovie(cfg,sdDIFF);</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br 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 class="">
<blockquote type="cite" class="">
<div class="">Le 31 mars 2020 à 12:02, Eelke Spaak <<a href="mailto:e.spaak@donders.ru.nl" class="">e.spaak@donders.ru.nl</a>> a écrit :</div>
<br class="Apple-interchange-newline">
<div class="">Hi Emilie,<br class="">
<br class="">
To add to Jan-Mathijs' explanation of why this does not work: you can<br class="">
use ft_sourceinterpolate to interpolate your volumetric source data<br class="">
onto a surface, which you can then plot using ft_sourcemovie (or the<br class="">
newer, though still somewhat experimental, ft_sourceplot_interactive).<br class="">
<br class="">
Best,<br class="">
Eelke<br class="">
<br class="">
On Tue, 31 Mar 2020 at 11:07, Schoffelen, J.M. (Jan Mathijs)<br class="">
<<a href="mailto:jan.schoffelen@donders.ru.nl" class="">jan.schoffelen@donders.ru.nl</a>> wrote:<br class="">
<blockquote type="cite" class=""><br class="">
Hi Emilie,<br class="">
<br class="">
ft_sourcemovie has been designed to operate on source level data that is defined on a cortical surface based source model.<br class="">
The code you pasted in suggests that you used a 3-dimensional grid as a sourcemodel. So this is never going to work.<br 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.<br 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.<br class="">
<br class="">
Best wishes,<br class="">
Jan-Mathijs<br class="">
<br class="">
<br class="">
On 31 Mar 2020, at 10:42, Emilie Caspar <<a href="mailto:ecaspar@ulb.ac.be" class="">ecaspar@ulb.ac.be</a>> wrote:<br class="">
<br class="">
Dear all,<br class="">
<br 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).<br class="">
<br 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? ;-)<br 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?<br class="">
<br class="">
Thank you,<br class="">
<br class="">
Emilie<br class="">
<br class="">
<ft_sourcemovie.png><leadfield.png><ft_plot_mesh.png><br class="">
<br class="">
CODE<br class="">
<br class="">
q=biosim64;<br class="">
ph = cell2mat(q(:,2));<br class="">
th = cell2mat(q(:,3));<br class="">
x = sin(ph*pi/180) .* cos(th*pi/180);<br class="">
y = sin(ph*pi/180) .* sin(th*pi/180);<br class="">
z = cos(ph*pi/180);<br class="">
<br class="">
plot3(x, y, z, '.');<br class="">
elec.label = q(:,1);<br class="">
elec.pnt = [x y z];<br class="">
<br class="">
cfg.sourcemodel.pos = elec.pnt;<br class="">
sourcemodel = ft_prepare_sourcemodel(cfg);<br class="">
<br class="">
headmodel = ft_read_headmodel('headmodel/standard_bem.mat');<br class="">
<br class="">
% realign electrodes to headmodel<br class="">
cfg = [];<br class="">
cfg.method = 'interactive';<br class="">
cfg.elec = elec;<br class="">
cfg.headshape = headmodel.bnd(1); %1 = skin<br class="">
elec = ft_electroderealign(cfg);<br class="">
<br class="">
%save new electrodes<br class="">
save elec64.mat elec<br class="">
<br class="">
ERPsAll.elec = ft_read_sens('elec64.mat’);<br class="">
<br class="">
% Prepare leadfield<br class="">
cfg                 = [];<br class="">
cfg.elec            = ERPsAll.elec;<br class="">
cfg.vol             = headmodel;<br class="">
cfg.reducerank      = 3;<br class="">
cfg.grid.resolution = 1;   % use a 3-D grid with a 1 cm resolution<br class="">
cfg.grid.unit       = 'cm';<br class="">
cfg.channel ={'all'};<br class="">
leadfield = ft_prepare_leadfield(cfg);<br class="">
<br class="">
<br class="">
<br class="">
%%mne<br class="">
cfg              = [];<br class="">
cfg.method       = 'mne'; %pcc: partial cannonical correlation/coherence<br class="">
cfg.elec         = ERPsAll.elec; %grid.cfg.elec;%<br class="">
cfg.headmodel          = headmodel;<br class="">
cfg.grid = leadfield;<br class="">
%cfg.sourcemodel = sourcemodel;<br class="">
% cfg.channel ={'all'};%, '-spmnas', '-spmlpa', '-spmrpa'};<br class="">
cfg.mne.prewhiten = 'yes';<br class="">
cfg.mne.lambda    = 3;<br class="">
cfg.mne.scalesourcecov = 'yes';<br class="">
%cfg.reducerank          = 2;<br class="">
<br class="">
source_C_Shock = ft_sourceanalysis(cfg, GA_C_Shock);<br class="">
source_C_Noshock = ft_sourceanalysis(cfg, GA_C_NOshock);<br class="">
<br class="">
save source_C_Shock.mat source_C_Shock<br class="">
save source_C_Noshock.mat source_C_Noshock<br class="">
<br class="">
bnd.pos = headmodel.bnd.pos;<br class="">
bnd.tri = headmodel.bnd.tri;<br class="">
<br class="">
m=source_C_Shock.avg.pow(:,450);<br class="">
%timeN1 = [1232:1301];timeP3 = [1722:1927];timeeLPP = [1928:2356];timelLPP = [2357:2868];<br class="">
ft_plot_mesh(bnd, 'vertexcolor', m);<br class="">
view([180 0]); h = light; set(h, 'position', [0 1 0.2]); lighting gouraud; material dull<br class="">
<br class="">
cfg = [];<br class="">
cfg.projectmom = 'yes';<br class="">
sdShock  = ft_sourcedescriptives(cfg,source_C_Shock);<br class="">
sdNoShock = ft_sourcedescriptives(cfg,source_C_Noshock);<br class="">
<br class="">
sdDIFF         = sdNoShock;<br class="">
sdDIFF.avg.pow = sdNoShock.avg.pow - sdShock.avg.pow;<br class="">
sdDIFF.tri = headmodel.bnd.tri;<br class="">
<br class="">
save sd sdDIFF;<br class="">
<br class="">
cfg = [];<br class="">
cfg.funparameter = 'pow';<br class="">
%cfg.method       = 'surface';<br class="">
ft_sourcemovie(cfg,sdDIFF);<br class="">
<br class="">
<br class="">
---------------------------------------------<br class="">
Emilie Caspar, Ph.D<br class="">
<br class="">
CO3, Centre de Recherche Cognition et Neurosciences (CRCN), ULB<br 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<br class="">
<br 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="">
<br class="">
_______________________________________________<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="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
<br class="">
<br class="">
_______________________________________________<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="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</blockquote>
<br class="">
_______________________________________________<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="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</div>
</blockquote>
</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="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</div>
</blockquote>
</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>