<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is there here someone solve the forward model with OPM-MEG sensors with 3 axis measurement in fieldtrip?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best regards</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Saeed ZAHRAN<br>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> fieldtrip <fieldtrip-bounces@science.ru.nl> on behalf of fieldtrip-request@science.ru.nl <fieldtrip-request@science.ru.nl><br>
<b>Sent:</b> Saturday, April 4, 2020 1:00 PM<br>
<b>To:</b> fieldtrip@science.ru.nl <fieldtrip@science.ru.nl><br>
<b>Subject:</b> fieldtrip Digest, Vol 113, Issue 4</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Send fieldtrip mailing list submissions to<br>
fieldtrip@science.ru.nl<br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
or, via email, send a message with subject or body 'help' to<br>
fieldtrip-request@science.ru.nl<br>
<br>
You can reach the person managing the list at<br>
fieldtrip-owner@science.ru.nl<br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of fieldtrip digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: ft_sourcemovie - producing 'contemporary art' instead of<br>
a brain (Schoffelen, J.M. (Jan Mathijs))<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 3 Apr 2020 17:02:26 +0000<br>
From: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen@donders.ru.nl><br>
To: FieldTrip discussion list <fieldtrip@science.ru.nl><br>
Subject: Re: [FieldTrip] ft_sourcemovie - producing 'contemporary art'<br>
instead of a brain<br>
Message-ID: <0C841ED8-4315-4F71-B12F-1D4DAFE01F5A@donders.ru.nl><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi Emilie,<br>
<br>
Hmmm, a few pointers:<br>
<br>
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.<br>
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.<br>
<br>
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.<br>
<br>
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).<br>
<br>
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.<br>
<br>
Best wishes,<br>
Jan-Mathijs<br>
<br>
<br>
On 2 Apr 2020, at 17:33, Emilie Caspar <ecaspar@ulb.ac.be<mailto:ecaspar@ulb.ac.be>> wrote:<br>
<br>
Dear Elke and Jan-Mathijs,<br>
<br>
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):<br>
<br>
cfg = [];<br>
cfg.parameter = 'elec.chanpos';<br>
cfg.interpmethod = 'nearest';<br>
interp = ft_sourceinterpolate(cfg, source_C_Shock, sourcemodel)<br>
<br>
I get the following error message: "Reference to non-existent field 'elec’. », 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.<br>
<br>
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?<br>
<br>
Thank you in advance for your time!<br>
<br>
Emilie<br>
<br>
<NaN.png><br>
<br>
<br>
load biosemi64.mat<br>
q=angles;<br>
<br>
ph = cell2mat(q(:,2));<br>
th = cell2mat(q(:,3));<br>
x = sin(ph*pi/180) .* cos(th*pi/180);<br>
y = sin(ph*pi/180) .* sin(th*pi/180);<br>
z = cos(ph*pi/180);<br>
<br>
plot3(x, y, z, '.');<br>
elec.label = q(:,1);<br>
elec.pnt = [x y z];<br>
<br>
cfg.sourcemodel.pos = elec.pnt;<br>
sourcemodel = ft_prepare_sourcemodel(cfg);<br>
<br>
headmodel = ft_read_headmodel('headmodel/standard_bem.mat');<br>
%electr_pos=ft_read_sens('Biosemi-Cap64.sfp');<br>
<br>
%% realign electrodes to headmodel<br>
cfg = [];<br>
cfg.method = 'interactive';<br>
cfg.elec = elec;<br>
cfg.headshape = headmodel.bnd(1); %1 = skin<br>
elec = ft_electroderealign(cfg);<br>
<br>
%save new electrodes<br>
save elec64.mat elec<br>
<br>
%ERPsAll.elec = ft_read_sens('Biosemi-Cap64.sfp');<br>
<br>
% Prepare leadfield<br>
cfg = [];<br>
cfg.elec = elec;<br>
cfg.headmodel = headmodel;<br>
cfg.reducerank = 3;<br>
cfg.resolution = 1; % use a 3-D grid with a 1 cm resolution<br>
cfg.sourcemodel.unit = 'cm';<br>
cfg.channel ={'all'};<br>
leadfield = ft_prepare_leadfield(cfg);<br>
<br>
<br>
<br>
%% mne<br>
cfg = [];<br>
cfg.method = 'mne'; %pcc: partial cannonical correlation/coherence<br>
cfg.elec = elec; %grid.cfg.elec;%<br>
cfg.headmodel = headmodel;<br>
cfg.grid = leadfield;<br>
%cfg.sourcemodel = sourcemodel;<br>
% cfg.channel ={'all'};%, '-spmnas', '-spmlpa', '-spmrpa'};<br>
cfg.mne.prewhiten = 'yes';<br>
cfg.mne.lambda = 3;<br>
cfg.mne.scalesourcecov = 'yes';<br>
%cfg.reducerank = 2;<br>
<br>
source_C_Shock = ft_sourceanalysis(cfg, GA_C_Shock);<br>
source_C_Noshock = ft_sourceanalysis(cfg, GA_C_NOshock);<br>
<br>
cfg = [];<br>
cfg.parameter = 'elec.chanpos';<br>
cfg.interpmethod = 'nearest';<br>
interp = ft_sourceinterpolate(cfg, source_C_Shock, sourcemodel)<br>
<br>
<br>
cfg = [];<br>
cfg.projectmom = 'yes';<br>
sdShock = ft_sourcedescriptives(cfg,source_C_Shock);<br>
sdNoShock = ft_sourcedescriptives(cfg,source_C_Noshock);<br>
<br>
sdDIFF = sdNoShock;<br>
sdDIFF.avg.pow = sdNoShock.avg.pow - sdShock.avg.pow;<br>
<br>
save sd sdDIFF;<br>
<br>
cfg = [];<br>
cfg.funparameter = 'pow';<br>
ft_sourcemovie(cfg,sdDIFF);<br>
<br>
<br>
<br>
---------------------------------------------<br>
Emilie Caspar, Ph.D<br>
<br>
CO3, Centre de Recherche Cognition et Neurosciences (CRCN), ULB<br>
Voice : +32 2 650 32 95<br>
mail : ecaspar@ulb.ac.be<<a href="mailto:ecaspar@ulb.ac.be">mailto:ecaspar@ulb.ac.be</a>><br>
office: DB10-138<br>
<br>
Social Brain Lab, Netherlands Institute for Neuroscience (NIN), KNAW<br>
mail : e.caspar@nin.knaw.nl<mailto:e.caspar@nin.knaw.nl><br>
<br>
Le 31 mars 2020 à 12:02, Eelke Spaak <e.spaak@donders.ru.nl<mailto:e.spaak@donders.ru.nl>> a écrit :<br>
<br>
Hi Emilie,<br>
<br>
To add to Jan-Mathijs' explanation of why this does not work: you can<br>
use ft_sourceinterpolate to interpolate your volumetric source data<br>
onto a surface, which you can then plot using ft_sourcemovie (or the<br>
newer, though still somewhat experimental, ft_sourceplot_interactive).<br>
<br>
Best,<br>
Eelke<br>
<br>
On Tue, 31 Mar 2020 at 11:07, Schoffelen, J.M. (Jan Mathijs)<br>
<jan.schoffelen@donders.ru.nl<mailto:jan.schoffelen@donders.ru.nl>> wrote:<br>
<br>
Hi Emilie,<br>
<br>
ft_sourcemovie has been designed to operate on source level data that is defined on a cortical surface based source model.<br>
The code you pasted in suggests that you used a 3-dimensional grid as a sourcemodel. So this is never going to work.<br>
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>
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>
<br>
Best wishes,<br>
Jan-Mathijs<br>
<br>
<br>
On 31 Mar 2020, at 10:42, Emilie Caspar <ecaspar@ulb.ac.be<mailto:ecaspar@ulb.ac.be>> wrote:<br>
<br>
Dear all,<br>
<br>
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>
<br>
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>
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>
<br>
Thank you,<br>
<br>
Emilie<br>
<br>
<ft_sourcemovie.png><leadfield.png><ft_plot_mesh.png><br>
<br>
CODE<br>
<br>
q=biosim64;<br>
ph = cell2mat(q(:,2));<br>
th = cell2mat(q(:,3));<br>
x = sin(ph*pi/180) .* cos(th*pi/180);<br>
y = sin(ph*pi/180) .* sin(th*pi/180);<br>
z = cos(ph*pi/180);<br>
<br>
plot3(x, y, z, '.');<br>
elec.label = q(:,1);<br>
elec.pnt = [x y z];<br>
<br>
cfg.sourcemodel.pos = elec.pnt;<br>
sourcemodel = ft_prepare_sourcemodel(cfg);<br>
<br>
headmodel = ft_read_headmodel('headmodel/standard_bem.mat');<br>
<br>
% realign electrodes to headmodel<br>
cfg = [];<br>
cfg.method = 'interactive';<br>
cfg.elec = elec;<br>
cfg.headshape = headmodel.bnd(1); %1 = skin<br>
elec = ft_electroderealign(cfg);<br>
<br>
%save new electrodes<br>
save elec64.mat elec<br>
<br>
ERPsAll.elec = ft_read_sens('elec64.mat’);<br>
<br>
% Prepare leadfield<br>
cfg = [];<br>
cfg.elec = ERPsAll.elec;<br>
cfg.vol = headmodel;<br>
cfg.reducerank = 3;<br>
cfg.grid.resolution = 1; % use a 3-D grid with a 1 cm resolution<br>
cfg.grid.unit = 'cm';<br>
cfg.channel ={'all'};<br>
leadfield = ft_prepare_leadfield(cfg);<br>
<br>
<br>
<br>
%%mne<br>
cfg = [];<br>
cfg.method = 'mne'; %pcc: partial cannonical correlation/coherence<br>
cfg.elec = ERPsAll.elec; %grid.cfg.elec;%<br>
cfg.headmodel = headmodel;<br>
cfg.grid = leadfield;<br>
%cfg.sourcemodel = sourcemodel;<br>
% cfg.channel ={'all'};%, '-spmnas', '-spmlpa', '-spmrpa'};<br>
cfg.mne.prewhiten = 'yes';<br>
cfg.mne.lambda = 3;<br>
cfg.mne.scalesourcecov = 'yes';<br>
%cfg.reducerank = 2;<br>
<br>
source_C_Shock = ft_sourceanalysis(cfg, GA_C_Shock);<br>
source_C_Noshock = ft_sourceanalysis(cfg, GA_C_NOshock);<br>
<br>
save source_C_Shock.mat source_C_Shock<br>
save source_C_Noshock.mat source_C_Noshock<br>
<br>
bnd.pos = headmodel.bnd.pos;<br>
bnd.tri = headmodel.bnd.tri;<br>
<br>
m=source_C_Shock.avg.pow(:,450);<br>
%timeN1 = [1232:1301];timeP3 = [1722:1927];timeeLPP = [1928:2356];timelLPP = [2357:2868];<br>
ft_plot_mesh(bnd, 'vertexcolor', m);<br>
view([180 0]); h = light; set(h, 'position', [0 1 0.2]); lighting gouraud; material dull<br>
<br>
cfg = [];<br>
cfg.projectmom = 'yes';<br>
sdShock = ft_sourcedescriptives(cfg,source_C_Shock);<br>
sdNoShock = ft_sourcedescriptives(cfg,source_C_Noshock);<br>
<br>
sdDIFF = sdNoShock;<br>
sdDIFF.avg.pow = sdNoShock.avg.pow - sdShock.avg.pow;<br>
sdDIFF.tri = headmodel.bnd.tri;<br>
<br>
save sd sdDIFF;<br>
<br>
cfg = [];<br>
cfg.funparameter = 'pow';<br>
%cfg.method = 'surface';<br>
ft_sourcemovie(cfg,sdDIFF);<br>
<br>
<br>
---------------------------------------------<br>
Emilie Caspar, Ph.D<br>
<br>
CO3, Centre de Recherche Cognition et Neurosciences (CRCN), ULB<br>
Voice : +32 2 650 32 95<br>
mail : ecaspar@ulb.ac.be<<a href="mailto:ecaspar@ulb.ac.be">mailto:ecaspar@ulb.ac.be</a>><br>
office: DB10-138<br>
<br>
Social Brain Lab, Netherlands Institute for Neuroscience (NIN), KNAW<br>
mail : e.caspar@nin.knaw.nl<mailto:e.caspar@nin.knaw.nl><br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
<br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200403/15fdec57/attachment-0001.htm">http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200403/15fdec57/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
<br>
<br>
------------------------------<br>
<br>
End of fieldtrip Digest, Vol 113, Issue 4<br>
*****************************************<br>
</div>
</span></font></div>
</div>
</body>
</html>