AnalyzingData/MNE_InverseOperator - Meg Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
Type the missing letters from: He's no ded, he's jus resing hs eys

location: AnalyzingData / MNE_InverseOperator

The following script computes the inverse operator, which will later be applied to your MEG data to compute the source estimates. You must have created a forward solution already. Just as for the forward solution, two inverse operators will be created: One for MEG only, and one for combined EEG and MEG. If you only have MEG data, you can skip the latter.

The main ingredients for this script are

* the forward solution

* the noise covariance matrix

The end product will be the inverse operator (something ending in *-inv.fif), which can be read into Matlab using mne_read_inverse_operator.

The inverse operators will be computed using the loose orientation constraint and without depth weighting (see MNE manual for details and more options).

The parameters below are reasonable choices for standard analyses. However, these Wiki pages are not supposed to substitute the MNE manual, reading papers, and discussions with more experienced researchers.

#

## Your variables:

datapath='<myMEGdatapath>'    # root directory for your MEG data

MRIpath='/myMRIdirectory/'    # where your MRI subdirectories are

# subjects names used for MRI data
subjects=(\
        'Subject1' \
        'Subject2' \
        'Subject3' \
)

# MEG IDs (your directory structure may differ)
subj_pre=(\
        'meg10_0001' \
        'meg10_0002' \
        'meg10_0003' \
        )

# MEG subdirectories (your directory structure may differ)      
subj_dir=(\
         '100001' \
         '100002' \
         '100003' \
        )



## Processing:

nsubjects=${#subjects[*]}
lastsubj=`expr $nsubjects - 1`


for m in `seq 0 ${lastsubj}`
do
  echo " "
  echo " Computing inverse operator for SUBJECT  ${subjects[m]}"
  echo " "

# MEG only (forward solution based on 1-layer BEM required)

mne_do_inverse_operator \
                  --fwd ${datapath}/${subj_pre[m]}/${subj_dir[m]}/${subjects[m]}_5-1L-MEG-fwd.fif \
                  --meg \
                  --loose 0.2 \
                  --senscov ${datapath}/${subj_pre[m]}/${subj_dir[m]}/YourCovName-cov.fif \
                  --megreg 0.1 \
                  --inv ${datapath}/${subj_pre[m]}/${subj_dir[m]}/YourName_1L-MEG-loose0.2-inv.fif


# MEG and EEG (forward solution based on 3-layer BEM required)

mne_do_inverse_operator \
                  --fwd ${datapath}/${subj_pre[m]}/${subj_dir[m]}/${subjects[m]}_5-3L-EMEG-fwd.fif \
                  --meg \
                  --eeg \
                  --loose 0.2 \
                  --senscov ${datapath}/${subj_pre[m]}/${subj_dir[m]}/YourCovName-cov.fif \
                  --megreg 0.1 \
                  --eegreg 0.1 \
                  --inv ${datapath}/${subj_pre[m]}/${subj_dir[m]}/YourName_3L-EMEG-loose0.2-inv.fif     

done # subjects

The --loose option requires dipoles to be almost perpendicular to the cortical surface, with some variation in the tangential plane (0.2 means that variation in the tangential dimension is one-fifth of the radial dimension).

The --megreg/eegreg option are "regularization parameters" for the covariance matrices.