From CNI Wiki

Jump to: navigation, search

EEG-fMRI Group Meeting Presentions

The EEG-fMRI group has held meetings every other week during the months of April, May, and June. Each week's presentation is available as a pdf file.

Running EEG/fMRI sessions at CNI

Prep before your study

You will need to charge the amplifier the night BEFORE you are running your study. The amplifier and charger can be found in the mock scanner room. Note that only the amplifier and the plastic cart are MR safe. The charger is MR UNSAFE, so do NOT take it into the scanner room.

You will need to provide towels for your participants. Your towels can be stored in the large cabinets of the mock scanner room.

It is a good idea to ask your participant to shampoo their hair before coming in for the study and to come in with wet hair.


Materials that you will need can be found in the mock scanner room cabinets labelled "MRI Compatible EEG Storage'. For example:

  • net soaking bucket
  • disinfecting bucket & disinfectant
  • electrolyte powder
  • baby shampoo
  • measuring spoons
  • spandage TM (for electrode covering
  • towels
  • ear plugs
  • socks
  • scissors

You will want to bring a stimulus presentation computer (or use the CNI’s) as well as the laptop that runs NetStation. The EGI NetStation laptop should be kept on top of the amplifier in the mock scanner room. You will also need to use the peripheral gating monitor (please refer to the physio section on this wiki), which is permanently installed in the scanner suite on the desk next to the Linux computer. The EEG nets can be found either in the bathroom or in the mock scanner cabinet. There is a medium net (56-58 cm) and a large net (58-61 cm). For most people you will be using the medium net. There is also a small net in mock scanner cabinet.

Preparing for EEG electrode placement

First thing when the subject arrives, measure their head size to select the correct EEG net. At this point, it's good if one person start setting up the EEG net and another person consents and screens the subject. Have the subject de-metal and remove their shoes now. Put on CNI socks.

Check that the subject has washed their hair. If not, they should wash it in the bathroom with baby shampoo. If they did, they should still get their hair wet.

You will need to soak the net that you are going to use in conductive fluid for at least ten minutes before putting it on your participant. You can do this in the mock scanner room. Here is how you make the conductive fluid:

  1. Take the empty container out of the cabinet.
  2. Fill the container with about two liters of water.
  3. Use the appropriately labeled scoop, and add two scoops of electrolytes (Potassium Chloride). This will keep the sponges of the electrodes moist throughout your study. If they dry out you will get a poor signal. Stir so the electrolytes dissolve in the water.
  4. Use the appropriately labeled scoop and add one scoop of shampoo. Stir so the shampoo dissolves in the water.
  5. Completely submerge the inverted EEG net of the correct size and let it soak for 10 minutes.

Preparing to check electrode contact

Plug the NetStation laptop into the Amplifier in the following way:

  • Firewire cable -> Firewire/Opt Converter -> short optical cable -> Amp Data I/O port

These cables should be kept in the scanner suite desk on the far right next to the Linux machine.

Setting up the participant with the EEG

  1. Have participant put in earplugs.
  2. Have your participant sit down on a chair near the EEG net and the laptop & Amplifier.
  3. Stretch the net with both hands and place it over the participant’s head. The red electrodes should be lined up in the middle sagitally and coronally. If you need to adjust/move the net be careful because it can break easily. For example, if you need to move it more to the right, start moving it from the left, rather than pulling on the right side.
  4. Once the net is in the correct position fasten the chin strap and make sure that all the electrodes are touching the participant’s head.

Check electrode contact

  1. Plug the big plug at the end of the EEG net’s cord into the amplifier and make sure it is tight.
  2. Connect the amplifier to the Netstation laptop. Turn on the amplifier before launching Netstation.
  3. Open NetStation on your computer (you will have had to specify your own set up of how devices are connected for your study in NetStation).
  4. Go to Panels – Impedence. Set your cut-off for impedence level at 70 kilo-Ohms. Click ‘Measure Impedence.’ This should show you a screen with the grid of 256 electrodes. If the electrodes are recording properly and have good contact they should be showing up in green. Electrodes with poor contact will show up in red. Here is how you troubleshoot the red electrodes:
    1. Make sure that the electrodes are in the correct orientation.
    2. “Wiggle” the electrodes to make sure that they are actually touching the participant’s head.
    3. Use a pipette from the EEG supplies to squirt more conductive fluid into the sponges of the electrodes.
    4. If none of the above helps, it is possible that some of the electrodes have stopped working. We suggest that you proceed with your study, but notify the CNI staff.
  5. Once you have determined that the electrodes have good contact for the most part disconnect the amplifier from the optical wiring. You are ready to set up your participant in the scanner.
  6. Place a ‘sock’ over the net. You can make this sock out of the white medical material from the EEG supplies cabinet. Cut off a piece about 12 inches long. Tie the top part. Cut a small face hole into your ‘sock.’ Place the ‘sock’ over the EEG net on the participant’s head by stretching it with both of your hands. Cut off any excess material from your knot, so it doesn’t take up unnecessary space in the head coil.

Preparing Scanner Suite for fMRI

  1. Use the 8-channel head coil (the EEG equipment won’t fit into the 32-channel coil).

Preparing for EEG recording in Control Room

  1. Plug the NetStation laptop back into the FireWire cable and converter. The converter should now plug into the longer optical cable that is coming in from the scanner room, labelled "Data I/O."
  2. Connect the computer running NetStation to your stimulus computer (e.g., using Ethernet, but it depends on what software you are using; Ethernet is not the best because of the delay in timing; it is better to use a digital pulse).

Setting up the participant in the scanner

  1. Walk your participant into the scanner room and bring along the plastic cart with the amplifier. DO NOT bring the charger into the scanner room!
  2. Connect the amplifier to the labelled optical cables in the scanner room. They are in the bottom cabinet closest to the wall to the scanner console room.
  • Connect one of the optical cables to the ‘Data I/O’ port on the amplifier.
  • Connect one to the ‘Clock Sync’ port.

Be careful with the optical wiring! Do NOT step on it. Handle it carefully when putting it away.

  1. Make sure to really pad the participant’s head. Otherwise, it can be really painful for them to lie on the electrodes. We recommend that you put extra padding under the participant’s neck, so that most of their head weight rests on their neck, rather than on the electrodes on their head. Also place padding near the top of the participant’s head and by the sides of their head (as usual).
  2. When the subject lays down, it is important that the EEG wires do not form any loops. Hold the wires down firmly against their back with your hands as they lay down.
  3. Set up your participant with pulse/peripheral gating monitoring. Please refer to the physio section on this wiki for instructions on how to do this and see the CNI_widgets page for details on the hardware.
  4. Advance the participant into the scanner.

Recording the EEG

Before recording, quit and restart Netstation in with laptop in the scanner control room (this must be done once all cables are reconnected). To start recording, you can just click ‘record’ in NetStation, but generally it is a better idea to sync the start of recording with your stimulus computer. You can do so by creating a script (e.g., in Matlab) that triggers the scanner and the EEG recording. The stimulus computer will record all the events. You will also need a script that sends the timing information from the stimulus computer to the NetStation computer. It is a good idea to sync the internal clocks of these two computers (you can do this with a script on every single trial). Finally, it is a good idea to match the monitor refresh rate and the two computers’ internal clocks (again, using a script).

Clean up

When you are done with your session you will need to clean the EEG equipment. Rinse the EEG net under clear water. Make sure you keep the cord as dry as possible to prevent it from molding. Soak the EEG net in the disinfectant solution for ten minutes. The disinfectant is good for two weeks, so check the ‘expiration’ date on the lid to see if you need to make new disinfectant. Rinse the EEG net after you have soaked it in the disinfectant. Hang it up in the bathroom to dry.

PowerDiva Display System

Cabling PowerDiva

PowerDiva laptop cables:

National Instruments Cable (flat black one) connects DIO card to adapter box Video Output Cabling:

LCD monitor: use direct DVI connection to laptop

Goggle system: use DVI to VGA adapter, connect VGA cable to video splitter box (IN). Connect Googles L box output to Goggles L display input and vice versa

Connecting to the FORP buttons

Connect actual button devices inside scanner room: two response-pad set-up

On the FORP console in scanner room press button

Select change mode,

Choose auto configure, press button

Select USB, press button

Scroll to HID NAR 12345, press button

You should see:


HHSC - 2 x 4 - C

HID NAR 12345

PsychToolBox Display System


An available option is to use Matlab's Psychtoolbox. This has two purposes: serve as a stim computer, and send events into the Netstation recording stream. Triggering events into the scanner using Matlab has been documented extensively, and hence not discussed here. However, when trying to use Matlab to send events to Netstation the are more things to consider.

Recording events into NetStation using Psychtoolbox uses the NetStation command available when you download Psychtoolbox for Matlab. For more details on how this commands work type in the Matlab command window:

>> help NetStation


>> doc NetStation

Cabling PsychToolbox

Connecting to NetStation

Simple TCP connection using an ethernet cable from the stim computer (computer running Psychtoolbox) and the NetStation computer. Make sure that only connection is through the TCP port (i.e. turn off Airport in a Mac). On the Netstation computer, use a static IP (i.e. and SubnetMask Also, turn On the Acquisition bar on NetStation (yellow bar on top).

To verify the connection type in the Matlab command window: >> NetStation('Connect', '')

If a 0 is returned, then the connection was successful. Verify the TCP log on Netstation to verify the connection on the Netstation computer.

MATLAB Commands

Other Considerations

EEG post-processing

Gradient Cleaning

BCG Cleaning

OLD EEG Equipment Wiring Diagram

To connect the pulse oximeter detector computer and the E-prime computer to the NetStation, we use a custom cable provided by Gary Glover.

Diagram of Gary Glover's DIN cable.

There is a DB-9 port in the back of the GE PRG cabinet that streams the physiological monitor data out over an RS232 serial port. We think it sends the data in real time at a rate of 200Hz (one complete 12-byte data frame every 5ms). Here's some Python code to read the serial data format:

   import serial
   from numpy import *
   import pylab
   # The serial data stream seems to get reset when the port is opened.
   # So, as long as you don't miss any frames due to a buffer overflow,
   # you should get complete frames by simply reading 12-byte chunks.
   ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1)
   # Read n frames of data
   n = 10;
   s =*12)
   # tick counter (unsigned short), increments by 1. This is not reset
   # when the port is opened. We assume that it will wrap around.
   tics = fromstring(s,dtype('<H'))[0::6]
   # Assuming the rest are signed shorts.
   ekg1 = fromstring(s,dtype('<h'))[1::6]
   ekg2 = fromstring(s,dtype('<h'))[2::6]
   resp = fromstring(s,dtype('<h'))[3::6]
   ppg  = fromstring(s,dtype('<h'))[4::6]
   # Not sure what this one is:
   misc = fromstring(s,dtype('<h'))[5::6]
Personal tools