<div dir="ltr">Hi again, <div><br></div><div>Just my last question regarding this issue: you mentioned that "<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">The wisdom behind not assembling inverse operator in the inverse file, is </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">to make it general, so that same inverse operator can be applied to raw or</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">ave file.". Could you expand a bit on this? How can I control how to assemble the inv operator as "general"?</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Thanks, </span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Ade</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 26 January 2018 at 23:27, Adela Glez. <span dir="ltr"><<a href="mailto:adelaglezcom@gmail.com" target="_blank">adelaglezcom@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you! This is great. I will have a look soon.<div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 25 January 2018 at 03:07, Sheraz Khan, PhD <span dir="ltr"><<a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Please find gist at<br>
<br>
<a href="https://gist.github.com/SherazKhan/866dd62722b46a39ec6f8ce3f1806a68" rel="noreferrer" target="_blank">https://gist.github.com/Sheraz<wbr>Khan/866dd62722b46a39ec6f8ce3f<wbr>1806a68</a><br>
<br>
<br>
fname_inv = 'sample_audvis-meg-oct-6-meg-f<wbr>ixed-inv.fif'<br>
fname_raw = 'sample_audvis_tsss.fif'<br>
sol = apply_inverse_raw(fname_raw,fn<wbr>ame_inv)<br>
<br>
<br>
As you can see, it is done using mne-matlab function.<br>
<br>
The wisdom behind not assembling inverse operator in the inverse file, is<br>
to make it general, so that same inverse operator can be applied to raw or<br>
ave file.<br>
<br>
HTH<br>
<br>
Best<br>
<span class="m_-2471068786382602386HOEnZb"><font color="#888888"><br>
Sheraz<br>
</font></span><div class="m_-2471068786382602386HOEnZb"><div class="m_-2471068786382602386h5"><br>
<br>
<br>
<br>
> Thank you very much, Sheraz, you are very kind to do so.<br>
> So is there at the moment no way to do this in Matlab as per the Matlab<br>
> set<br>
> of functions provided by MNE?<br>
> Ade<br>
><br>
> On 24 January 2018 at 05:35, Sheraz Khan, PhD <<a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a>><br>
> wrote:<br>
><br>
>> Hi Adela,<br>
>><br>
>> You can do the same in Matlab, Tomorrow, I will create a small matlab<br>
>> 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>
>><br>
>> Sheraz<br>
>><br>
>> > Thanks again, Sheraz.<br>
>> ><br>
>> > I am confused because my original question was how to compute the<br>
>> source<br>
>> > data (in Matlab) if I already have the inverse solution. You mentioned<br>
>> I<br>
>> > could use mne_read_inverse_operator.m but I should assemble it and<br>
>> > referred<br>
>> > me to the function mne_ex_compute_inverse.m. But this function asks<br>
>> for<br>
>> > the<br>
>> > _ave-fif file, which I don't have, and seems to me that it is rather<br>
>> to<br>
>> > compute the inverse solution, which I already have ("% An example on<br>
>> how<br>
>> > to<br>
>> > compute a L2-norm inverse solution, and not to create the source<br>
>> > estimates.<br>
>> ><br>
>> > I had a look at how the source data is computed in Python and it just<br>
>> uses<br>
>> > "read_inverse_operator" to read the inv solution, and<br>
>> "apply_inverse_raw"<br>
>> > for the source estimation (which is what I aim to do in Matlab), which<br>
>> > doesn't need the _ave.fif file.<br>
>> ><br>
>> > Maybe I am misunderstanding something?<br>
>> > Thank you,<br>
>> > Ade<br>
>> ><br>
>> ><br>
>> > On 18 January 2018 at 17:05, Sheraz Khan, PhD <<br>
>> <a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a>><br>
>> > wrote:<br>
>> ><br>
>> >> On the mne-python side you need to convert your data into Evoked<br>
>> object,<br>
>> >> using mne python class<br>
>> >> <a href="https://martinos.org/mne/dev/generated/mne.Evoked.html" rel="noreferrer" target="_blank">https://martinos.org/mne/dev/g<wbr>enerated/mne.Evoked.html</a><br>
>> >> And then you can use .save function exposed by Evoked object to save<br>
>> it<br>
>> >> into -ave.fif file.<br>
>> >><br>
>> >> Please open issue on GitHub and share your pipeline with some sample<br>
>> >> data<br>
>> >><br>
>> >> Sheraz<br>
>> >> > Thank you. I still got the error that the number of arguments was<br>
>> >> wrong.<br>
>> >> > It<br>
>> >> > seem to run adding just '1' for the argument "dSPM"). However, I<br>
>> get<br>
>> >> the<br>
>> >> > following error:<br>
>> >> ><br>
>> >> > Error using fiff_read_evoked (line 83)<br>
>> >> ><br>
>> >> > Could not find processed data<br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> > Error in mne_ex_compute_inverse (line 53)<br>
>> >> ><br>
>> >> > data = fiff_read_evoked(fname_data,se<wbr>tno);<br>
>> >> ><br>
>> >> ><br>
>> >> > I noticed I have no -ave.fif file in the set of files computed with<br>
>> >> MNE<br>
>> >> > python.<br>
>> >> ><br>
>> >> > Maybe that is the source of the issue?<br>
>> >> ><br>
>> >> ><br>
>> >> > Ade<br>
>> >> ><br>
>> >> > On 18 January 2018 at 15:23, Sheraz Khan, PhD <<br>
>> >> <a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a>><br>
>> >> > wrote:<br>
>> >> ><br>
>> >> >> Some default values<br>
>> >> >><br>
>> >> >> setno = 1; %(Event code that you put in your stimulus program)<br>
>> >> >> nave = -1; %(Number of averages, -1 will read it from -ave.fif<br>
>> file)<br>
>> >> >> dSPM = true; % (Convert the inverse map to Statistical score wrt<br>
>> to<br>
>> >> >> baseline noise covirance)<br>
>> >> >> lambda2 = 1/9 %(Default regularization parameter)<br>
>> >> >><br>
>> >> >> HTH<br>
>> >> >><br>
>> >> >> Sheraz<br>
>> >> >><br>
>> >> >><br>
>> >> >> > Thank you, Sheraz.<br>
>> >> >> ><br>
>> >> >> > To assemble the inv operator I had a look at<br>
>> mne_ex_compute_inverse<br>
>> >> >> and<br>
>> >> >> > there are a number of arguments (e.g., setno [data set number],<br>
>> >> >> lambda2,<br>
>> >> >> > sDPM, sLORETA), that complicate things since I don't know where<br>
>> to<br>
>> >> get<br>
>> >> >> > these values from or how to find them.<br>
>> >> >> ><br>
>> >> >> > Ade<br>
>> >> >> ><br>
>> >> >> > On 18 January 2018 at 14:20, Sheraz Khan, PhD <<br>
>> >> >> <a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a>><br>
>> >> >> > wrote:<br>
>> >> >> ><br>
>> >> >> >> Hi Ade,<br>
>> >> >> >><br>
>> >> >> >> > 1- Is the MNE Matlab toolbox a limited version of the python<br>
>> >> one? I<br>
>> >> >> >> wonder<br>
>> >> >> >> > if I can perform the whole pipeline (compute fwd and inv<br>
>> >> solutions)<br>
>> >> >> >> with<br>
>> >> >> >> > the Matlab version.<br>
>> >> >> >><br>
>> >> >> >> MNE Matlab toolbox is mostly for IO, and was designed to<br>
>> >> complement<br>
>> >> >> >> MNE-C<br>
>> >> >> >> toolbox. It can not compute fwd and inv solutions.<br>
>> >> >> >><br>
>> >> >> >><br>
>> >> >> >> > 2- If this is not possible, how to import in Matlab an<br>
>> already<br>
>> >> >> >> computed<br>
>> >> >> >> > inverse solution (oct-6-meg-inv.fif) into Matlab so I have<br>
>> the<br>
>> >> data<br>
>> >> >> >> ready<br>
>> >> >> >> > for further analysis in Matlab?<br>
>> >> >> >><br>
>> >> >> >> You can use mne_read_inverse_operator.m function to read inv<br>
>> >> operator<br>
>> >> >> >> into<br>
>> >> >> >> Matlab, but you need to assemble it. Please see<br>
>> >> >> mne_ex_compute_inverse.m<br>
>> >> >> >> for example.<br>
>> >> >> >><br>
>> >> >> >> HTH<br>
>> >> >> >><br>
>> >> >> >> Best<br>
>> >> >> >><br>
>> >> >> >> Sheraz<br>
>> >> >> >><br>
>> >> >> >><br>
>> >> >> >> > Hi everyone,<br>
>> >> >> >> ><br>
>> >> >> >> > Two questions:<br>
>> >> >> >> ><br>
>> >> >> >> > 1- Is the MNE Matlab toolbox a limited version of the python<br>
>> >> one? I<br>
>> >> >> >> wonder<br>
>> >> >> >> > if I can perform the whole pipeline (compute fwd and inv<br>
>> >> solutions)<br>
>> >> >> >> with<br>
>> >> >> >> > the Matlab version.<br>
>> >> >> >> > 2- If this is not possible, how to import in Matlab an<br>
>> already<br>
>> >> >> >> computed<br>
>> >> >> >> > inverse solution (oct-6-meg-inv.fif) into Matlab so I have<br>
>> the<br>
>> >> data<br>
>> >> >> >> ready<br>
>> >> >> >> > for further analysis in Matlab?<br>
>> >> >> >> ><br>
>> >> >> >> > Thank you,<br>
>> >> >> >> > Ade<br>
>> >> >> >> > ______________________________<wbr>_________________<br>
>> >> >> >> > Mne_analysis mailing list<br>
>> >> >> >> > <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.e<wbr>du</a><br>
>> >> >> >> > <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.e<wbr>du/mailman/listinfo/mne_analys<wbr>is</a><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" target="_blank">+1 617-643-5634</a><br>
>> >> >> >> Fax: <a href="tel:%2B1%20617-948-5966" value="+16179485966" target="_blank">+1 617-948-5966</a><br>
>> >> >> >> Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a><br>
>> >> >> >> <a href="mailto:sheraz@mit.edu" target="_blank">sheraz@mit.edu</a><br>
>> >> >> >> Web: <a href="http://sheraz.mit.edu" rel="noreferrer" target="_blank">http://sheraz.mit.edu</a><br>
>> >> >> >> ______________________________<wbr>_________________<br>
>> >> >> >> Mne_analysis mailing list<br>
>> >> >> >> <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.e<wbr>du</a><br>
>> >> >> >> <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.e<wbr>du/mailman/listinfo/mne_analys<wbr>is</a><br>
>> >> >> >><br>
>> >> >> >><br>
>> >> >> >> The information in this e-mail is intended only for the person<br>
>> to<br>
>> >> >> whom<br>
>> >> >> >> it<br>
>> >> >> >> is<br>
>> >> >> >> addressed. If you believe this e-mail was sent to you in error<br>
>> and<br>
>> >> >> the<br>
>> >> >> >> e-mail<br>
>> >> >> >> contains patient information, please contact the Partners<br>
>> >> Compliance<br>
>> >> >> >> HelpLine at<br>
>> >> >> >> <a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/compli<wbr>anceline</a> . If the e-mail was sent<br>
>> to<br>
>> >> >> you<br>
>> >> >> >> in<br>
>> >> >> >> error<br>
>> >> >> >> but does not contain patient information, please contact the<br>
>> >> sender<br>
>> >> >> and<br>
>> >> >> >> properly<br>
>> >> >> >> dispose of the e-mail.<br>
>> >> >> >><br>
>> >> >> >><br>
>> >> >> ><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" target="_blank">+1 617-643-5634</a><br>
>> >> >> Fax: <a href="tel:%2B1%20617-948-5966" value="+16179485966" target="_blank">+1 617-948-5966</a><br>
>> >> >> Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a><br>
>> >> >> <a href="mailto:sheraz@mit.edu" target="_blank">sheraz@mit.edu</a><br>
>> >> >> Web: <a href="http://sheraz.mit.edu" rel="noreferrer" target="_blank">http://sheraz.mit.edu</a><br>
>> >> >><br>
>> >> ><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" target="_blank">+1 617-643-5634</a><br>
>> >> Fax: <a href="tel:%2B1%20617-948-5966" value="+16179485966" target="_blank">+1 617-948-5966</a><br>
>> >> Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a><br>
>> >> <a href="mailto:sheraz@mit.edu" target="_blank">sheraz@mit.edu</a><br>
>> >> Web: <a href="http://sheraz.mit.edu" rel="noreferrer" target="_blank">http://sheraz.mit.edu</a><br>
>> >><br>
>> ><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" target="_blank">+1 617-643-5634</a><br>
>> Fax: <a href="tel:%2B1%20617-948-5966" value="+16179485966" target="_blank">+1 617-948-5966</a><br>
>> Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a><br>
>> <a href="mailto:sheraz@mit.edu" target="_blank">sheraz@mit.edu</a><br>
>> Web: <a href="http://sheraz.mit.edu" rel="noreferrer" target="_blank">http://sheraz.mit.edu</a><br>
>><br>
><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" target="_blank">+1 617-643-5634</a><br>
Fax: <a href="tel:%2B1%20617-948-5966" value="+16179485966" target="_blank">+1 617-948-5966</a><br>
Email: <a href="mailto:sheraz@nmr.mgh.harvard.edu" target="_blank">sheraz@nmr.mgh.harvard.edu</a><br>
<a href="mailto:sheraz@mit.edu" target="_blank">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>
</div></div></blockquote></div><br></div>