[Mne_analysis] MNE in Matlab

Sheraz Khan, PhD sheraz at nmr.mgh.harvard.edu
Tue Jan 23 22:35:58 EST 2018
Search archives:

Hi Adela,

You can do the same in Matlab, Tomorrow, I will create a small matlab gist
for you, in which, you input raw and inv file, and it outputs source
estimates, like apply_inverse_raw in mne-python.

Best

Sheraz

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


-------------------------
Sheraz Khan, M.Eng, Ph.D.
Instructor in Neurology

Athinoula A. Martinos Center for Biomedical Imaging
Massachusetts General Hospital
Harvard Medical School

McGovern Institute for Brain Research
Massachusetts Institute of Technology

Tel:   +1 617-643-5634
Fax:   +1 617-948-5966
Email: sheraz at nmr.mgh.harvard.edu
       sheraz at mit.edu
Web:   http://sheraz.mit.edu


More information about the Mne_analysis mailing list