Skip to content

37. EEG MRI analysis

Fa-Hsuan Lin edited this page Aug 1, 2023 · 27 revisions

Structural MRI

Reconstruct brain structure using FreeSurfer and T1-weighted MRI (MPRAGE sequence) data. Details are here.

fMRI

Follow the instruction here for fMRI data pre-processing, including the following

  • convert meas.dat into Matlab mat files
  • register between fMRI and structural MRI
  • prepare fMRI data on brain surfaces

The fMRI analysis using Genearal Linear Model can be found here.

Register between anatomical MRI and fMRI

  1. Using only SMS-InI data

-1.a. Prepare an initial registration matrix

First, you need to have an initial registration matrix file, such as this one. If not, please create one as the following:

s002
5
5
0.250000
    0.0421    0.9796    0.1969    1.8653
    0.0262   -0.1982    0.9798  -31.0046
   -0.9988    0.0362    0.0341   -2.7172
         0         0         0    1.0000
round

Note that the first line indicates the subject (in your $SUBJECTS_DIR) to be used as the anatomical template. In this case, it is subject s002. Save this text file as, for example, bb_register_init.dat.

Then, use this script to show the registration between fMRI and anatomical MRI. Remember to check if the subject indicated at the 2nd line of the code matches the subject in bb_register_init.dat.

-1.b. Manually coregister between fMRI and anatomical MRI (FreeSurfer recon) Run [this script] to show fMRI overlaid on structural MRI

1.b.1 Click anywhere of the 3D brain surface model. This will bring up another window showing axial, saggital, and coronal brain slices with fMRI overlays.

1.b.2 Click 'g' and "Display" control windows will show. You many change the threshold min. and max. there to allow you visualize the relative positions of fMRI and structural MRI volumes.

1.b.3 Checking and unchecking "Show surface overlay" and "Show vol.overlay" allow you to show fMRI overlay or not in brain surface model and slices.

1.b.4 Click 'k' and "register" control window will show. You many rotate and translate fMRI. Note that here the rotation and translation are made with respect to the 3D brain surface model view. So you may first determine the best view by enabling and rotating the 3D rotation in the brain surface. Then apply the appropriate translation and rotation. Repeat until you feel ok about the overlap between fMRI and structural MRI.

1.b.5 Export the registration now by click "export" button at the "register" control window. Now a new variable overlay_xfm exists in your Matlab workspace. As you have a variable r describing the initial transformation after running the registration script, you can calculate the new transformation as r * overlay_xfm.

1.b.6 Update the transformation matrix by open an editor and update the content of bb_register_init.dat by the 4x4 16 numbers in the file.

-1.c. Run bb_register to get more accurate registration Run this script to register between fMRi and structural MRI. THe command below specifies register subject s002 the converted EPI run 005 (epi_005_f.mgh) based on an initial transformation (bb_register_init.dat) with the structural MRI. The registration matrix is generated as bb_register_epi_005.dat.

bbregister --s s002 --mov epi_005_f.mgh --init-reg bb_register_init.dat --reg bb_register_epi_005.dat --bold

-1.d Confirm the registration is ok

Using freeview confirms the registration (between EPI epi_063_f.mgh) with the output registration file (bb_register_epi_063.dat) as follow.

tkregisterfv --mov epi_063_f.mgh --reg bb_register_epi_063.dat --surfs  --sd /Users/fhlin/workspace/eegmri_music/subjects

  1. Using EPI data with sliced matched with SMS-InI reference scans

-2.a. Prepare EPI data [This script file] prepares slices of EPI data matched with SMS-InI reference data.

-2.b. Prepare an initial registration matrix Please refer to step 1.a above for this step.

-2.c. Manually coregister between fMRI and anatomical MRI (FreeSurfer recon) Please refer to step 1.b above for this step.

-2.d. Run bb_register to get more accurate registration

EEG

EEG pre-processing includes

  • suppress gradient and pulse artifacts.
  • calculate event-related potentials (for event-related design).

To do EEG source anaylysis, follow the procedure here.

Clone this wiki locally