<div dir="ltr">Thank you very much, Sheraz, you are very kind to do so.<div>So is there at the moment no way to do this in Matlab as per the Matlab set of functions provided by MNE?</div><div>Ade</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 24 January 2018 at 05:35, Sheraz Khan, PhD <span dir="ltr">&lt;<a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Adela,<br>
<br>
You can do the same in Matlab, Tomorrow, I will create a small matlab gist<br>
for you, in which, you input raw and inv file, and it outputs source<br>
estimates, like apply_inverse_raw in mne-python.<br>
<br>
Best<br>
<span class="HOEnZb"><font color="#888888"><br>
Sheraz<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
&gt; Thanks again, Sheraz.<br>
&gt;<br>
&gt; I am confused because my original question was how to compute the source<br>
&gt; data (in Matlab) if I already have the inverse solution. You mentioned I<br>
&gt; could use mne_read_inverse_operator.m but I should assemble it and<br>
&gt; referred<br>
&gt; me to the function mne_ex_compute_inverse.m. But this function asks for<br>
&gt; the<br>
&gt; _ave-fif file, which I don&#39;t have, and seems to me that it is rather to<br>
&gt; compute the inverse solution, which I already have (&quot;% An example on how<br>
&gt; to<br>
&gt; compute a L2-norm inverse solution, and not to create the source<br>
&gt; estimates.<br>
&gt;<br>
&gt; I had a look at how the source data is computed in Python and it just uses<br>
&gt; &quot;read_inverse_operator&quot; to read the inv solution, and &quot;apply_inverse_raw&quot;<br>
&gt; for the source estimation (which is what I aim to do in Matlab), which<br>
&gt; doesn&#39;t need the _ave.fif file.<br>
&gt;<br>
&gt; Maybe I am misunderstanding something?<br>
&gt; Thank you,<br>
&gt; Ade<br>
&gt;<br>
&gt;<br>
&gt; On 18 January 2018 at 17:05, Sheraz Khan, PhD &lt;<a href="mailto:sheraz@nmr.mgh.harvard.edu">sheraz@nmr.mgh.harvard.edu</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;&gt; On the mne-python side you need to convert your data into Evoked object,<br>
&gt;&gt; using mne python class<br>
&gt;&gt; <a href="https://martinos.org/mne/dev/generated/mne.Evoked.html" rel="noreferrer" target="_blank">https://martinos.org/mne/dev/<wbr>generated/mne.Evoked.html</a><br>
&gt;&gt; And then you can use .save function exposed by Evoked object to save it<br>
&gt;&gt; into -ave.fif file.<br>
&gt;&gt;<br>
&gt;&gt; Please open issue on GitHub and share your pipeline with some sample<br>
&gt;&gt; data<br>
&gt;&gt;<br>
&gt;&gt; Sheraz<br>
&gt;&gt; &gt; Thank you. I still got the error that the number of arguments was<br>
&gt;&gt; wrong.<br>
&gt;&gt; &gt; It<br>
&gt;&gt; &gt; seem to run adding just &#39;1&#39; for the argument &quot;dSPM&quot;). However, I get<br>
&gt;&gt; the<br>
&gt;&gt; &gt; following error:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Error using fiff_read_evoked (line 83)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Could not find processed data<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Error in mne_ex_compute_inverse (line 53)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; data = fiff_read_evoked(fname_data,<wbr>setno);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I noticed I have no -ave.fif file in the set of files computed with<br>
&gt;&gt; MNE<br>
&gt;&gt; &gt; python.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Maybe that is the source of the issue?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Ade<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On 18 January 2018 at 15:23, Sheraz Khan, PhD &lt;<br>
&gt;&gt; <a href="mailto:sheraz@nmr.mgh.harvard.edu">sheraz@nmr.mgh.harvard.edu</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; Some default values<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; setno = 1; %(Event code that you put in your stimulus program)<br>
&gt;&gt; &gt;&gt; nave = -1; %(Number of averages, -1 will read it from -ave.fif file)<br>
&gt;&gt; &gt;&gt; dSPM = true; % (Convert the inverse map to Statistical score wrt to<br>
&gt;&gt; &gt;&gt; baseline noise covirance)<br>
&gt;&gt; &gt;&gt; lambda2 = 1/9 %(Default regularization parameter)<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; HTH<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Sheraz<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; Thank you, Sheraz.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; To assemble the inv operator I had a look at mne_ex_compute_inverse<br>
&gt;&gt; &gt;&gt; and<br>
&gt;&gt; &gt;&gt; &gt; there are a number of arguments (e.g., setno [data set number],<br>
&gt;&gt; &gt;&gt; lambda2,<br>
&gt;&gt; &gt;&gt; &gt; sDPM, sLORETA), that complicate things since I don&#39;t know where to<br>
&gt;&gt; get<br>
&gt;&gt; &gt;&gt; &gt; these values from or how to find them.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Ade<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; On 18 January 2018 at 14:20, Sheraz Khan, PhD &lt;<br>
&gt;&gt; &gt;&gt; <a href="mailto:sheraz@nmr.mgh.harvard.edu">sheraz@nmr.mgh.harvard.edu</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Hi Ade,<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; 1- Is the MNE Matlab toolbox a limited version of the python<br>
&gt;&gt; one? I<br>
&gt;&gt; &gt;&gt; &gt;&gt; wonder<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; if I can perform the whole pipeline (compute fwd and inv<br>
&gt;&gt; solutions)<br>
&gt;&gt; &gt;&gt; &gt;&gt; with<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; the Matlab version.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; MNE Matlab toolbox is mostly for IO, and was designed to<br>
&gt;&gt; complement<br>
&gt;&gt; &gt;&gt; &gt;&gt; MNE-C<br>
&gt;&gt; &gt;&gt; &gt;&gt; toolbox. It can not compute fwd and inv solutions.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; 2- If this is not possible, how to import in Matlab an already<br>
&gt;&gt; &gt;&gt; &gt;&gt; computed<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; inverse solution (oct-6-meg-inv.fif) into Matlab so I have the<br>
&gt;&gt; data<br>
&gt;&gt; &gt;&gt; &gt;&gt; ready<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; for further analysis in Matlab?<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; You can use mne_read_inverse_operator.m function to read inv<br>
&gt;&gt; operator<br>
&gt;&gt; &gt;&gt; &gt;&gt; into<br>
&gt;&gt; &gt;&gt; &gt;&gt; Matlab, but you need to assemble it. Please see<br>
&gt;&gt; &gt;&gt; mne_ex_compute_inverse.m<br>
&gt;&gt; &gt;&gt; &gt;&gt; for example.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; HTH<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Best<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Sheraz<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Hi everyone,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Two questions:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; 1- Is the MNE Matlab toolbox a limited version of the python<br>
&gt;&gt; one? I<br>
&gt;&gt; &gt;&gt; &gt;&gt; wonder<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; if I can perform the whole pipeline (compute fwd and inv<br>
&gt;&gt; solutions)<br>
&gt;&gt; &gt;&gt; &gt;&gt; with<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; the Matlab version.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; 2- If this is not possible, how to import in Matlab an already<br>
&gt;&gt; &gt;&gt; &gt;&gt; computed<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; inverse solution (oct-6-meg-inv.fif) into Matlab so I have the<br>
&gt;&gt; data<br>
&gt;&gt; &gt;&gt; &gt;&gt; ready<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; for further analysis in Matlab?<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Thank you,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Ade<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Mne_analysis mailing list<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.<wbr>edu</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.<wbr>edu/mailman/listinfo/mne_<wbr>analysis</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; -------------------------<br>
&gt;&gt; &gt;&gt; &gt;&gt; Sheraz Khan, M.Eng, Ph.D.<br>
&gt;&gt; &gt;&gt; &gt;&gt; Instructor in Neurology<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Athinoula A. Martinos Center for Biomedical Imaging<br>
&gt;&gt; &gt;&gt; &gt;&gt; Massachusetts General Hospital<br>
&gt;&gt; &gt;&gt; &gt;&gt; Harvard Medical School<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; McGovern Institute for Brain Research<br>
&gt;&gt; &gt;&gt; &gt;&gt; Massachusetts Institute of Technology<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Tel:   <a href="tel:%2B1%20617-643-5634" value="+16176435634">+1 617-643-5634</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; Fax:   <a href="tel:%2B1%20617-948-5966" value="+16179485966">+1 617-948-5966</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu">sheraz@nmr.mgh.harvard.edu</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;        <a href="mailto:sheraz@mit.edu">sheraz@mit.edu</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; Web:   <a href="http://sheraz.mit.edu" rel="noreferrer" target="_blank">http://sheraz.mit.edu</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; &gt;&gt; &gt;&gt; Mne_analysis mailing list<br>
&gt;&gt; &gt;&gt; &gt;&gt; <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.<wbr>edu</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.<wbr>edu/mailman/listinfo/mne_<wbr>analysis</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; The information in this e-mail is intended only for the person to<br>
&gt;&gt; &gt;&gt; whom<br>
&gt;&gt; &gt;&gt; &gt;&gt; it<br>
&gt;&gt; &gt;&gt; &gt;&gt; is<br>
&gt;&gt; &gt;&gt; &gt;&gt; addressed. If you believe this e-mail was sent to you in error and<br>
&gt;&gt; &gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt;&gt; e-mail<br>
&gt;&gt; &gt;&gt; &gt;&gt; contains patient information, please contact the Partners<br>
&gt;&gt; Compliance<br>
&gt;&gt; &gt;&gt; &gt;&gt; HelpLine at<br>
&gt;&gt; &gt;&gt; &gt;&gt; <a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/<wbr>complianceline</a> . If the e-mail was sent to<br>
&gt;&gt; &gt;&gt; you<br>
&gt;&gt; &gt;&gt; &gt;&gt; in<br>
&gt;&gt; &gt;&gt; &gt;&gt; error<br>
&gt;&gt; &gt;&gt; &gt;&gt; but does not contain patient information, please contact the<br>
&gt;&gt; sender<br>
&gt;&gt; &gt;&gt; and<br>
&gt;&gt; &gt;&gt; &gt;&gt; properly<br>
&gt;&gt; &gt;&gt; &gt;&gt; dispose of the e-mail.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; -------------------------<br>
&gt;&gt; &gt;&gt; Sheraz Khan, M.Eng, Ph.D.<br>
&gt;&gt; &gt;&gt; Instructor in Neurology<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Athinoula A. Martinos Center for Biomedical Imaging<br>
&gt;&gt; &gt;&gt; Massachusetts General Hospital<br>
&gt;&gt; &gt;&gt; Harvard Medical School<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; McGovern Institute for Brain Research<br>
&gt;&gt; &gt;&gt; Massachusetts Institute of Technology<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Tel:   <a href="tel:%2B1%20617-643-5634" value="+16176435634">+1 617-643-5634</a><br>
&gt;&gt; &gt;&gt; Fax:   <a href="tel:%2B1%20617-948-5966" value="+16179485966">+1 617-948-5966</a><br>
&gt;&gt; &gt;&gt; Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu">sheraz@nmr.mgh.harvard.edu</a><br>
&gt;&gt; &gt;&gt;        <a href="mailto:sheraz@mit.edu">sheraz@mit.edu</a><br>
&gt;&gt; &gt;&gt; Web:   <a href="http://sheraz.mit.edu" rel="noreferrer" target="_blank">http://sheraz.mit.edu</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; -------------------------<br>
&gt;&gt; Sheraz Khan, M.Eng, Ph.D.<br>
&gt;&gt; Instructor in Neurology<br>
&gt;&gt;<br>
&gt;&gt; Athinoula A. Martinos Center for Biomedical Imaging<br>
&gt;&gt; Massachusetts General Hospital<br>
&gt;&gt; Harvard Medical School<br>
&gt;&gt;<br>
&gt;&gt; McGovern Institute for Brain Research<br>
&gt;&gt; Massachusetts Institute of Technology<br>
&gt;&gt;<br>
&gt;&gt; Tel:   <a href="tel:%2B1%20617-643-5634" value="+16176435634">+1 617-643-5634</a><br>
&gt;&gt; Fax:   <a href="tel:%2B1%20617-948-5966" value="+16179485966">+1 617-948-5966</a><br>
&gt;&gt; Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu">sheraz@nmr.mgh.harvard.edu</a><br>
&gt;&gt;        <a href="mailto:sheraz@mit.edu">sheraz@mit.edu</a><br>
&gt;&gt; Web:   <a href="http://sheraz.mit.edu" rel="noreferrer" target="_blank">http://sheraz.mit.edu</a><br>
&gt;&gt;<br>
&gt;<br>
<br>
<br>
-------------------------<br>
Sheraz Khan, M.Eng, Ph.D.<br>
Instructor in Neurology<br>
<br>
Athinoula A. Martinos Center for Biomedical Imaging<br>
Massachusetts General Hospital<br>
Harvard Medical School<br>
<br>
McGovern Institute for Brain Research<br>
Massachusetts Institute of Technology<br>
<br>
Tel:   <a href="tel:%2B1%20617-643-5634" value="+16176435634">+1 617-643-5634</a><br>
Fax:   <a href="tel:%2B1%20617-948-5966" value="+16179485966">+1 617-948-5966</a><br>
Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu">sheraz@nmr.mgh.harvard.edu</a><br>
       <a href="mailto:sheraz@mit.edu">sheraz@mit.edu</a><br>
Web:   <a href="http://sheraz.mit.edu" rel="noreferrer" target="_blank">http://sheraz.mit.edu</a><br>
</div></div></blockquote></div><br></div>