Compute the Source Estimates (mne_make_movie)

Applying the Inverse Operator

This script applies the inverse operator to MEG data and outputs the current estimates. The current estimates are morphed to the average brain, for grand-averaging. The results (*.stc-files) can be visualised in mne_analyze, and read into Matlab using mne_read_stc_file. You can get infos on your stc-files (e.g. maximum value, relevant for scaling your display) using mne_analyze.

The main ingredients are

* the inverse operator

* the averaged MEG data (fiff-files)

* the average cortical surface (see below)

There are some examples of current estimates at the bottom.

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
outpath='/myoutpath'  # path for output files
#condition names as used in file names to which inverse operator shall be applied
conds=('cond1' 'cond2' 'cond3')
# 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`
nconds=${#conds[*]}
lastcond=`expr $nconds - 1`
for m in `seq 0 ${lastsubj}`
do
  echo " "
  echo " Computing movies  for SUBJECT  ${subjects[m]}"
  echo " "

        for c in `seq 0 ${lastcond}`
        do

                # Current Estimates
                mne_make_movie \
                --subject ${subjects[m]} \
                --inv ${datapath}/${subj_pre[m]}/${subj_dir[m]}/YourName_1L-MEG-loose0.2-inv.fif \
                --meas ${datapath}/${subj_pre[m]}/${subj_dir[m]}/${conds[c]}.fif \
                --morph average \
                --smooth 5 \
                --bmin -100 \
                --bmax 0 \
                --stc ${outpath}/${subj_pre[m]}_${conds[c]}

        done # conditions
done # subjects

The --morph option produces source estimates morphed to the average brain (necessary for grand-averaging). If you don't use it, source estimates will be computed on individual cortical surfaces.

Some degree of smoothing (--smooth) is necessary for display.

The baseline definition (--bmin/bmax) can be omitted if input data are already appropriately baseline-corrected. Note that this option will not baseline-correct the source estimates.

A few CBSU users have experienced an issue with mne_make_movie. It sometimes misses some output that it is supposed to produce. It is important for you to check whether the number of output stc files matches what you expect. Re-running the script again usually solves the problem.