EEG
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
General Description
Storage, Charging, Maintenance
Setting up NetStation with the Scanner
Cabling NetStation: Inside the Control Room for set-up
The main purpose of this is to verify the impedances of the electrodes before recording. You would need to connect the Control Room Data I/O Fiber Optic Cable (orange cable with white connectors) to both the amplifier and the FireWire/OptConverter. The FireWire/OptConverter then connects through FireWire to the NetStation Computer. After this you can check the Impedance using the NetStation GUI.
Cabling NetStation: Inside the Scanner Room for recording
Using CNI PhysMon Device to record heartbeat for BCG correction

The physmon a small hardware device that detects subject cardiac pulses based on the real-time physio data stream from the GE PPG cabinet. See the CNI_widgets page for details on the hardware.
Cabling the PPG
Put the detector on the subject's finger.
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:
USB
HHSC - 2 x 4 - C
HID NAR 12345
PsychToolBox Display System
Overview
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
or
>> 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. 10.0.0.42) and SubnetMask 255.255.255.0. Also, turn On the Acquisition bar on NetStation (yellow bar on top).
To verify the connection type in the Matlab command window: >> NetStation('Connect', '10.0.0.42')
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.

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 = ser.read(n*12)
ser.close()
# 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]
pylab.plot(tic,resp)
pylab.plot(tic,ppg)
pylab.show()