Diff for "AnalyzingData/MNE_ComputeEstimates" - Meg Wiki
location: Diff for "AnalyzingData/MNE_ComputeEstimates"
Differences between revisions 10 and 21 (spanning 11 versions)
Revision 10 as of 2010-06-10 13:05:05
Size: 3043
Editor: YaaraErez
Comment:
Revision 21 as of 2010-11-30 14:10:24
Size: 4169
Editor: YaaraErez
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Applying the Inverse Operator (mne_make_movie) = = Compute the Source Estimates (mne_make_movie) =
'''Applying the Inverse Operator'''
Line 3: Line 4:
This script applies the inverse operator to MEG data and outputs the current estimates. The current estimates are morphed to the average brain (see below), for grand-averaging (see further below). The results (*.stc-files) can be viewed in mne_analyze, and read into Matlab using mne_read_stc_file. This script applies the inverse operator to MEG data and outputs the current estimates. The current estimates are morphed to the [#averagebrain average brain] (see below), for [#grandaverage grand-averaging] (see further below). The results (*.stc-files) can be viewed 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_process_stc.
Line 9: Line 10:
* the MEG data (fiff-files) * the averaged MEG data (fiff-files)
Line 13: Line 14:
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. The parameters below are reasonable choices for standard analyses. However, these Wiki pages are not supposed to substitute the [http://www.nmr.mgh.harvard.edu/meg/manuals/MNE-manual-2.6.pdf MNE manual], [http://imaging.mrc-cbu.cam.ac.uk/meg/MEGpapers reading papers], and [http://imaging.mrc-cbu.cam.ac.uk/imaging/ImagersInterestGroup discussions] with more experienced researchers.
Line 35: Line 36:
        'Subject1' \
        'Subject1' \
        'Subject2' \
        'Subject3' \
Line 74: Line 75:
  --inv ${datapath}/${subj_pre[m]}_0${subjects[m]}/${subj_dir[m]}/YourName_1L-MEG-loose0.2-inv.fif \   --inv ${datapath}/${subj_pre[m]}/${subj_dir[m]}/YourName_1L-MEG-loose0.2-inv.fif \
Line 80: Line 81:
  --stc ${outpath}/STC/${subj_pre[m]}_${conds[c]}   --stc ${outpath}/${subj_pre[m]}_${conds[c]}
Line 87: Line 88:
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.


[[Anchor(averagebrain)]]
Line 96: Line 105:
"Subject1, Subject2..." etc. are the sub-directories in the subjects' MRI directories (created by Freesurfer). The paths to these subdirectories have to be specified in the environment variables, e.g. "setenv SUBJECTS_DIR /mymridirectory/".
Line 97: Line 107:

[[Anchor(grandaverage)]]
Line 109: Line 121:

deststc <youroutputfile>

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 [#averagebrain average brain] (see below), for [#grandaverage grand-averaging] (see further below). The results (*.stc-files) can be viewed 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_process_stc.

The main ingredients are

* the inverse operator

* the averaged MEG data (fiff-files)

* the average cortical surface (see below)

The parameters below are reasonable choices for standard analyses. However, these Wiki pages are not supposed to substitute the [http://www.nmr.mgh.harvard.edu/meg/manuals/MNE-manual-2.6.pdf MNE manual], [http://imaging.mrc-cbu.cam.ac.uk/meg/MEGpapers reading papers], and [http://imaging.mrc-cbu.cam.ac.uk/imaging/ImagersInterestGroup 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.

Anchor(averagebrain)

Computing the Average Cortical Surface

#

make_average_subject --subjects   Subject1 Subject2 Subject3

"Subject1, Subject2..." etc. are the sub-directories in the subjects' MRI directories (created by Freesurfer). The paths to these subdirectories have to be specified in the environment variables, e.g. "setenv SUBJECTS_DIR /mymridirectory/".

Anchor(grandaverage)

Grand-averaging STC-files

For grand-averaging, STC-files should have been created using the --morph option in mne_make_movie (see above). You can then average them using the command

mne_average_estimates --desc <descriptionfile.txt>

where descriptionfile.txt is of the form

stc /yourpath/filetoaverage1.stc
stc /yourpath/filetoaverage2.stc
stc /yourpath/filetoaverage3.stc

deststc <youroutputfile>

You can create description files for every average you want to compute, and execute them in one script

#

mne_average_estimates --desc <descriptionfile1.txt>
mne_average_estimates --desc <descriptionfile2.txt>
mne_average_estimates --desc <descriptionfile3.txt>

CbuMeg: AnalyzingData/MNE_ComputeEstimates (last edited 2013-03-08 10:02:25 by localhost)