Diff for "AnalyzingData/MNE_MRI_processing" - Meg Wiki
location: Diff for "AnalyzingData/MNE_MRI_processing"
Differences between revisions 25 and 27 (spanning 2 versions)
Revision 25 as of 2010-06-10 17:05:56
Size: 3250
Editor: YaaraErez
Comment:
Revision 27 as of 2010-06-10 17:12:20
Size: 3345
Editor: YaaraErez
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Make sure you've typed
Line 3: Line 4:
Make sure you've typed
  
'''mne_setup_2.6.0'''

  
'''freesurfer_4.3.0'''

  
'''setenv SUBJECTS_DIR </myMRIdirectory/>'''
 . '''mne_setup_2.6.0''' '''freesurfer_4.3.0''' '''setenv SUBJECTS_DIR </myMRIdirectory/>'''
Line 17: Line 13:
Line 20: Line 15:
Line 22: Line 16:

Line 25: Line 17:
do   do
Line 28: Line 19:
 mne_watershed_bem --overwrite --subject $SUBJECT

 ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_inner_skull_surface' $SUBJECTS_DIR/$SUBJECT/bem/inner_skull.surf
 ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_outer_skull_surface' $SUBJECTS_DIR/$SUBJECT/bem/outer_skull.surf
 ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_outer_skin_surface' $SUBJECTS_DIR/$SUBJECT/bem/outer_skin.surf
 ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_brain_surface' $SUBJECTS_DIR/$SUBJECT/bem/brain_surface.surf
        mne_watershed_bem --overwrite --subject $SUBJECT
        ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_inner_skull_surface' $SUBJECTS_DIR/$SUBJECT/bem/inner_skull.surf
        ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_outer_skull_surface' $SUBJECTS_DIR/$SUBJECT/bem/outer_skull.surf
        ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_outer_skin_surface'  $SUBJECTS_DIR/$SUBJECT/bem/outer_skin.surf
        ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_brain_surface'      $SUBJECTS_DIR/$SUBJECT/bem/brain_surface.surf
Line 36: Line 25:
 mne_setup_mri --overwrite --subject $SUBJECT
        mne_setup_mri --overwrite --subject $SUBJECT
Line 39: Line 27:
 mne_setup_source_space --spacing 5 --overwrite --subject $SUBJECT
        mne_setup_source_space --spacing 5 --overwrite --subject $SUBJECT
Line 43: Line 30:

Line 46: Line 31:
Line 50: Line 34:
   mne_setup_2.6.0
   setenv SUBJECTS_DIR </myMRIdirectory/>

mne_setup_2.6.0

setenv SUBJECTS_DIR </myMRIdirectory/>
Line 54: Line 41:
1) Start mne_analyze.  
2) Load a surface file (File -> Load Surface, choose inflated).  
{{{
1) Start mne_analyze.
2) Load a surface file (File -> Load Surface, choose inflated).
Line 59: Line 45:

4) Open the view (View -> Show Viewer).

5) Click on Options. Hide the cortex, make the skin transparent, show the digitiser data.

6) Choose Adjust -> Coordinate Alignment. Define approximate landmarks (LAP, RAP, Nasion) by clicking at their labels, then at their approximate locations in the viewer. The click Align Using Fiducials.

7) The use the "ICP Align" option multiple times until the transformation matrix doesn't change significantly any more. You can remove outliers using the "Discard" option (e.g. choose 10 or 5 mm, then ICP align again).  
4) Open the viewer (View -> Show Viewer).
5) Click on "Options". Hide the cortex, make the skin transparent, show the digitiser data.
6) Choose Adjust -> Coordinate Alignment. Define approximate landmarks (LAP, RAP, Nasion) by clicking at their labels, then at their approximate locations in the viewer. The click "Align Using Fiducials".
7) Use the "ICP Align" option multiple times until the transformation matrix doesn't change significantly any more. You can remove outliers using the "Discard" option (e.g. choose 10 or 5 mm, then ICP align again).
Line 69: Line 50:
The coordinate transform will automatically be invoked in future operation within MNE.
}}}

Head Model and Source Space Creation in MNE

Make sure you've typed

  • mne_setup_2.6.0 freesurfer_4.3.0 setenv SUBJECTS_DIR </myMRIdirectory/>

in your Linux command window.

The following script will produce the source space (downsampled version of the cortical surface in Freesurfer), which will be saved in a file ending in *-src.fif, which can be read into Matlab using mne_read_source_spaces.

After this step, you should realign the MRI and MEG coordinate systems, otherwise the following analyses (forward solution, inverse operator etc.) won't make sense. The procedure is described in the MNE manual, e.g. chapter 12.11. (sample data set). It is briefly described 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.

SUBJECTS_DIR='</myMRIdirectory/>'    # root directory for MRI data
for SUBJECT in Subject1 Subject2 Subject3  # use your list of subject names here
do
        # creates surfaces necessary for BEM head models
        mne_watershed_bem --overwrite --subject $SUBJECT
        ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_inner_skull_surface' $SUBJECTS_DIR/$SUBJECT/bem/inner_skull.surf
        ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_outer_skull_surface' $SUBJECTS_DIR/$SUBJECT/bem/outer_skull.surf
        ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_outer_skin_surface'  $SUBJECTS_DIR/$SUBJECT/bem/outer_skin.surf
        ln -s $SUBJECTS_DIR/$SUBJECT/bem/watershed/$SUBJECT'_brain_surface'       $SUBJECTS_DIR/$SUBJECT/bem/brain_surface.surf
        # creates fiff-files for MNE describing MRI data
        mne_setup_mri --overwrite --subject $SUBJECT
        # create a source space from the cortical surface created in Freesurfer
        mne_setup_source_space --spacing 5 --overwrite --subject $SUBJECT
done

Aligning MEG and MRI coordinate systems

This is a brief summary of how to align MEG and MRI coordinate systems. For more information see the MNE manual (chapter 12.11).

Make sure you've typed

mne_setup_2.6.0

setenv SUBJECTS_DIR </myMRIdirectory/>

before proceeding.

1) Start mne_analyze.
2) Load a surface file (File -> Load Surface, choose inflated).
3) Load a fiff-file containing digitiser data (raw or averaged file; File -> Load digitizer data).
4) Open the viewer (View -> Show Viewer).
5) Click on "Options". Hide the cortex, make the skin transparent, show the digitiser data.
6) Choose Adjust -> Coordinate Alignment. Define approximate landmarks (LAP, RAP, Nasion) by clicking at their labels, then at their approximate locations in the viewer. The click "Align Using Fiducials".
7) Use the "ICP Align" option multiple times until the transformation matrix doesn't change significantly any more. You can remove outliers using the "Discard" option (e.g. choose 10 or 5 mm, then ICP align again).
8) When you are happy, click "Save MRI".
The coordinate transform will automatically be invoked in future operation within MNE.

CbuMeg: AnalyzingData/MNE_MRI_processing (last edited 2024-04-10 14:27:41 by OlafHauk)