Digitize EEG sensor locations and head shape

Authors: Elizabeth Bock

Getting Started

The Brainstorm Digitize application allows for a connection to a Polhemus device and collection of digitized head points and/or EEG sensor locations.

The application is designed for two receivers (i.e. the stylus and reference) and one transmitter.

The connection to the device is made via a serial port connection. This can be accomplished using a direct serial connection or with a USB-to-Serial cable connection with the USB side connecting to the host computer.

Configuration of the Polhemus

Fastrak or Isotrak

Patriot

polhemus.png

Figure 1. Polhemus system with two receivers and one transmitter

typical_polhemus_setup.png

Figure 2. Typical Polhemus setup

The application is designed for two receivers (i.e. the stylus and reference) and one transmitter.

The stylus is used by the operator to point to the desired position for collection

The reference is fixed to the subject’s head, typically with glasses or headband. While the subject’s head can move during the collection, the reference sensor should not move from the starting position relative to the head. Take special care in how the receiver is attached as any slight movement with respect to the head will be amplified in the point coordinates and may lead to bad coregistration. It is best to ask the subject not to move during the entire procedure, and to restart if you accidentally hit the receiver.

The transmitter is fixed behind the subject, typically to a non-metal chair or table. The orientation is shown here, with X+ pointing up and Y+ point to the right.

transmitter.png

Figure 3. Transmitter orientation

****Care should be taken when setting up this system to ensure accurate collection. Thorough testing should be performed using known head coordinates (phantom) to determine accuracy.

The head coordinate system used in the Digitize application is based on the CTF head coordinate system, see CoordinateSystems.

The Digitize GUI

Before starting the GUI, turn on the Polhemus unit and wait until the indicator light is green.

To start the Digitize application, start Brainstorm. Then select ‘Digitize’ from the File Menu.

bst_menu_digitize.png

Figure 4. Starting Digitize

The Brainstorm GUI will be hidden during the use of the Digitize application and will reappear after exiting Digitize.

panel_digitize.png

Figure 5. Digitize GUI

This application allows you to collect:

The collection can performed by:

If an error is made during collection:

When complete the coordinates can be save in a variety of formats including CTF (*.pos), megDraw (*.eeg) or tab-delimited ASCII text.

Edit Settings

Settings for the serial connection and point collection can be adjusted using the ‘Edit settings’ menu option from the Digitize File Menu and may vary for each user.

gui_editsettings_digitize.png

Figure 6. Edit Settings

edit_settings_unittype.png

Figure 7. Edit settings dialog

Serial port name – this is the name of the serial port that is connected to the Polhemus, for example COM1 (Windows), ttyS1 (Linux).

Unit Name – this will select the settings for the specific device. Fastrak and Isotrak will both use the name fastrak.

Digitize MEG HPI coils - this will allow for collection of the positions of the HPI coils. This is important for CTF users since the data collected from the MEG system is saved in HPI coil coordinate system. Users collecting only EEG sensors or just head shape will not collect these points.

Number of times to collect the three fiducials – these collections will occur at the beginning of the session and will be averaged together to compute the transformation to the HPI or head coordinate system.

Beep – this will generate a beep sound with each point collection (this is often helpful to realize a button press on the stylus when there is one operator).

EEG Montages

eeg_settings_digitize.png

Figure 8. Edit EEG settings

There are three options for EEG sensors:

eegmontage_example_digitize.png

EEG settings should be adjusted for each session. Custom montages that are imported are stored in the brainstorm preferences and are available on subsequent sessions.

The Coordinates list on the left panel of the GUI displays the labels of the points which have been selected for collection. This is vary depending on the number of times the fiducials are collected and the number of EEG sensors to be defined. The head shape points are not listed since this will vary depending on the individual need.

example_eeg_digitize.png

Figure 10. Example EEG setups

Collection

Collect the required number of HPI coils

HPI_quality_check.png

Figure 11. Collect coils

Collect the required number of Anatomical Fiducials

HPI_FIDS_quality_check.png

Figure 12. Collect fiducials

Collect the required number of EEG points

Collect the desired number of head shape points

final_shape.png

Figure 13. Collect head shape

Save

Export points to text file

All points are automatically saved in a brainstorm channel file

bst_saveas_digitize.PNG

Figure 14. Export points to text file

How to use this file with CTF systems

The procedure we recommend is the following:

Troubleshooting

There are several things that can affect the quality and reproducibility of the measurements from the Polhemus Fastrak:

Hardware problems

The hardware is fragile. Dropping the stylus, receiver or emitter once can break them in a way that gives bad localization but seems to work otherwise. Reading the error codes from the built in tests (BIT), e.g. with Polhemus' PiMgr software, is a quick way to verify the hardware. Polhemus support can help you with this, and give you the password to download and install PiMgr. Note that PiMgr will not work over a 9800 baud serial connection. It's easier to use the USB connection instead for this, but remember to disconnect the USB cable from the Polhemus and restart it before trying again with Brainstorm over a serial cable.

Device communication

Problem appears to be with the communication between the device and Brainstorm:

  1. Power on the device
  2. Restart Matlab
  3. Start brainstorm
  4. Start Digitize
  5. At the Matlab command prompt, type this: s = instrfind()

If you do not have Matlab, you can open a command prompt from the Brainstorm File menu BEFORE starting Digitize. The command, s = instrfind() should be typed into the window, click execute and see the output in the terminal window.:

start_command_window.jpg

Figure 15: Start command window from Brainstorm

serial_start_digitize.jpg

Figure 16: Serial connection settings (Fastrak)

  1. From the Digitize->File->Edit settings (Figure 7), confirm the information in 's' matches your settings

  2. Confirm the information in 's' matches your COM port settings of your computer (this info is in the Device Manager)
  3. Press the button of the stylus, then execute s = instrfind() again. You should see that there are bytes available (94 bytes for Fastrak, 120 bytes for Patriot).

serial_collectpoint_digitize.jpg

Figure 17: Serial connection after one point collected (Fastrak)

Accuracy

Example configuration commands:

  % Open connection
    fopen(SerialConnection);
    if strcmp(DigitizeOptions.UnitType,'fastrak')
      %'c' - Disable Continuous Printing
      % Required for some configuration options.
      fprintf(SerialConnection,'c');
      %'u' - Metric Conversion Units (set units to cm)
      fprintf(SerialConnection,'u');
      %'F' - Enable ASCII Output Format
      fprintf(SerialConnection,'F');
      %'R' - Reset Alignment Reference Frame
      fprintf(SerialConnection,'R1');
      fprintf(SerialConnection,'R2');
      %'A' - Alignment Reference Frame
      %'H' - Hemisphere of Operation
      fprintf(SerialConnection,'H1,0,0,-1'); % -Z hemisphere
      fprintf(SerialConnection,'H2,0,0,-1'); % -Z hemisphere
      %'l' - Active Station State
      % Could check here if 1 and 2 are active.
      %'N' - Define Tip Offsets % Always factory default on power-up.
      %    fprintf(SerialConnection,'N1'); data = fscanf(SerialConnection)
      %    data = '21N  6.344  0.013  0.059
      %'O' - Output Data List
      fprintf(SerialConnection,'O1,2,4,1'); % default precision: position, Euler angles, CRL
      fprintf(SerialConnection,'O2,2,4,1'); % default precision: position, Euler angles, CRLF
      %fprintf(SerialConnection,'O1,52,54,51'); % extended precision: position, Euler angles, CRLF
      %fprintf(SerialConnection,'O2,52,54,51'); % extended precision: position, Euler angles, CRLF
      %'Q' - Angular Operational Envelope
      fprintf(SerialConnection,'Q1,180,90,180,-180,-90,-180');
      fprintf(SerialConnection,'Q2,180,90,180,-180,-90,-180');
      %'V' - Position Operational Envelope
      % Could use to warn if too far.
      fprintf(SerialConnection,'V1,100,100,100,-100,-100,-100');
      fprintf(SerialConnection,'V2,100,100,100,-100,-100,-100');
      %'x' - Position Filter Parameters
      % The macro setting used here also applies to attitude filtering.
      % 1=none, 2=low, 3=medium (default), 4=high
      fprintf(SerialConnection,'x3');

      %'e' - Define Stylus Button Function
      fprintf(SerialConnection,'e1,1'); % Point mode

      %'^K' - *Save Operational Configuration
      % 'ctrl+K' = char(11)
      %'^Y' - *Reinitialize System
      % 'ctrl+Y' = char(25)

Additional documentation





Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):


Tutorials/TutDigitize (last edited 2023-04-06 13:27:24 by ?MarcLalancette)