Diff for "AnalyzingData/MNE_ComputeEstimates" - Meg Wiki
location: Diff for "AnalyzingData/MNE_ComputeEstimates"
Differences between revisions 5 and 6
Revision 5 as of 2010-06-09 16:11:55
Size: 2105
Editor: YaaraErez
Comment:
Revision 6 as of 2010-06-09 16:23:11
Size: 2831
Editor: YaaraErez
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
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. The results (*.stc-files) can be viewed in mne_analyze. 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.
Line 94: Line 94:


= 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
}}}

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

{{{
#!/bin/sh
#

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

Applying the Inverse Operator (mne_make_movie)

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.

The main ingredients are

* the inverse operator

* the MEG data (fiff-files)

* the average cortical surface (see below)

For more details and further options see the MNE manual.

#

## Your variables

path='<myMEGdatapath>'    # where your MEG fiff-files are
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' \
        'Subject1' \
        'Subject1' \
)

# 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 ${path}/${subj_pre[m]}_0${subjects[m]}/${subj_dir[m]}/YourName_1L-MEG-loose0.2-inv.fif \
                --meas ${path}/${subj_pre[m]}/${subj_dir[m]}/${conds[c]}.fif \
                --morph average \
                --smooth 5 \
                --bmin -100 \
                --bmax 0 \
                --stc ${outpath}/STC/${subj_pre[m]}_${conds[c]}
                        
        done # conditions

done # subjects

Computing the Average Cortical Surface

#

make_average_subject --subjects   Subject1 Subject2 Subject3

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

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)