Digitize EEG sensor locations and head shape using 3D scanners

Authors: Chinmay Chinara, Wayne Mead, Yash Shashanka Vakilna, Anand Joshi, Takfarinas Medani, Raymundo Cassani, John Mosher, Richard Leahy

This page describes the 3D scanner Digitize GUI for the legacy version

For the 2024 (updated) version, visit:
https://neuroimage.usc.edu/brainstorm/Tutorials/TutDigitize3dScanner

Background

This tutorial shows a fast, accurate and automated way of localizing and labeling EEG electrodes from a 3D model that was acquired using Revopoint Range 2, an affordable and advanced 3D scanner that uses structured light approach for mapping the scalp surface (with the EEG cap on).

The first part of the tutorial covers how to digitize the EEG electrodes from an available 3D model. The second part shows how to use the Revopoint Range 2 3D scanner to capture data.

Digitize using 3D scanner

Jump to Acquiring using 3D scanner section to generate your own data.

Example dataset

Description

This data consists of 3D model of a subject wearing a custom EEG cap ANT Waveguard 65 that was captured using the Revopoint Range 2 3D scanner by the steps mentioned in Acquiring using 3D scanner at The University of Texas Health Science Center at Houston, USA.

License

This tutorial dataset was obtained at the University of Texas Health Science Center at Houston, USA. It is made available under the Creative Commons Attribution-NonCommercial 4.0 International Public License. Any questions regarding the data, please contact: wayne.f.mead@uth.tmc.edu or yash.shashank.vakilna@uth.tmc.edu

Files

The example dataset can be downloaded from here. The files that will be imported in this tutorial are the following:

sub1_Waveguard_ANT_65/

Loading the 3D model

If running from source code, we recommend having MATLAB R2018b or higher for best performance.

  1. Create a new protocol called Tutorial_Digitizer.

  2. Go to File>Digitize>3D scanner.

    revogui1.png

  3. Enter the Subject ID in the pop-up window that opens up. Make sure that it is unique and does not match to any other subject in the same protocol. Name it sub1.

    revogui2.png

  4. The subject gets created with the Default Anatomy.

  5. From the Import surfaces... window, do the following:

    • File type: Wavefront OBJ (*.obj)

    • Choose sub1_mesh_tex.obj

    • Click Open.

      revogui3_1.png

    • Adjust the scale factor based on the prompt. This would bring the units of the vertices of the 3D model to the Brainstorm units m. For this example data, Brainstorm detected that the units were in mm so choosing 0.001 as the scaling factor would fix the units of the vertices.

      revogui3.png

  6. The 3D model gets loaded into the protocol for the subject and the Digitize GUI opens up along with the model loaded. The Brainstorm GUI will be hidden during the use of the application and will reappear after exiting the Digitize GUI.

    revogui4.png

  7. This application allows you to collect:
    • Three head localization coils (HPI) for computing the head coordinate system (optional)
    • Three anatomical landmarks for Sensor-MRI co-registration
    • EEG sensor locations
    • Scalp points for head shape
  8. When complete the coordinates can be saved in a variety of formats including CTF (*.pos), megDraw (*.eeg) or tab-delimited ASCII text.

Configure EEG cap point collection

  1. Go to File>Edit Settings.... This opens up the 3DScanner configuration window.

    revogui5.png

    • 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. For this example, we set it to 0 as we are just collecting anatomical fiducials.

    • 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. For this example, we set it to 1.

    • Beep: This will generate a beep sound with each point collection (this is often helpful to realize a click while collecting a point from the mesh). For this example, we set it to 1.

Configure EEG montage

  1. The next step is to configure EEG montage to select the cap layout we want to select. Brainstorm by default has a bunch of cap layouts already predefined. For this example, we use the ANT Waveguard 65 cap.

  2. Go to EEG montage>Add EEG Montage...>Use default EEG cap>ICBM152>ANT>ANT Waveguard 65 to add load the layout to the Coordinates section where the collected points will also be updated.

    revogui6.png

Collect the required number of anatomical fiducials

  1. Click on the mesh, and press Ctrl+P to activate collection mode (you will see the mouse cursor change to a crosshair). Click on the desired location on the mesh and press key 'C' to collect the Nasion, LPA and RPA fiducials in order. Check Coordinate Systems tutorial for selecting the correct locations. The change can be seen in the Coordinates panel under each label.

  2. When collecting more than one set of fiducials, an error message is displayed if the difference between the sets is > 5mm

  3. If the MEG HPI coils are not used, then the head coordinate system is computed with the anatomical fiducials and the points are plotted on the 3D point display. Unless the user changes the anatomy for the brainstorm Digitize subject, the default anatomy is used. It may not match exactly the subject being digitized, but should be a good quality control image to ensure the points are positioned where expected.
  4. Note that the 3D figure is a standard Brainstorm window, where you can use all the mouse operations (rotation, zoom, popup menu) and the keyboard shortcuts (predefined view, screen capture...) introduced in the previous tutorials.

  5. The coordinates are displayed in the coordinate list in cm

  6. Once the fiducials are collected, the collection automatically moves to EEG positions

    revogui7.png

Collect EEG points

  1. Make sure collection mode is active (crosshair visible as per Step-1 in the previous section Collect Anatomical Fiducials).

  2. The coordinate list on the left shows the order in which the points should be collected. For this example data, we are going to collect points in the order Fpz, T7, T8, Oz,... all the way to AFz. Click on the desired location on the 3D model and press key 'C' to collect the point. Once collected, the EEG elctrodes coordinates counter updates in the GUI indicating the next point to be collected. The figures below (top to bottom) show the manual collection of few points Fpz, T7, T8, Oz.

    revogui8.png

    revogui9.png

    revogui10.png

    revogui11.png

  3. While this is all good, manually marking all the electrodes can be pretty time consuming when done for dense caps like these. You can see that there is this button Auto which is a feature that enables users to automatically detect and label these electrodes. Currently, this is an experimental feature that only supports a few caps so make sure that you verify the results carefully.

  4. The way it works is we need a minimal set of manual points as initialization that will help detect the rest of the electrodes. If your cap is supported then hovering on the Auto button should tell you the set of points that you need to manually collect. For this example, since this cap is supported, on hovering you see that you need to collect a minimum of Fpz, T7, T8, Oz for the button to be active.

    auto_yes.png

    If it is not supported you will see a tooltip as under.

    auto_no.png

  5. Click on Auto to automatically detect the positions and labels for the sensors on the EEG cap. Click Yes on the disclaimer that pops up.

    revogui_disclaimer.png

    revogui12.png

If the electrode detection does not work as expected with those initial marking of electrodes, try to manually set few more electrodes before pressing the Auto button.

Edit EEG points

If there are any bad detections or misalignments, you can manually select and press Delete key to delete these points from the Coordinates list and the figure (one at a time). Then in the point selection mode (press Ctrl+P while on the figure) click on the correct location on the 3D model and press key C to remark them manually which also updates in the Coordinates panel. Below you can see that FCz is misaligned and how it can be rectified.

edit_eeg.gif

Collect the desired number of head shape points

  1. In order to take full advantage of the Sensor-MRI co-registration algorithms in Brainstorm, it is recommended to collect approximately 100-150 points from the head: 5-10 points from the boney part of the nose, 10-15 points across the eyebrows, then an even coverage of the scalp from the eyebrows to the inion. It is NOT recommended to collect points below the inion on the neck, since the shape of the neck can change between lying in the MRI scanner and sitting during point collection. Even coverage is more important that dense coverage.
  2. To automatically choose 150 random points, click on Random. These can be seen as the green points in the figure and the numbered 001-150 in the Coordinates list on the GUI.

    revogui13.png

  3. If user wants to add head shape points manually, it can be done by clicking on the figure, and press Ctrl+P to activate collection mode. Click on the desired location on the 3D model and press key 'C' to collect. The points 151-155 in the figure below were collected manually.

    revogui13_1.png

  4. Each point is displayed on the 3D points display.
  5. The counter is incremented each time a point is collected and therefore indicates which point will to be collected next.

Save

  1. The user can save the points to a text file in a variety of formats.
  2. The points can be saved as a *.pos file for import into CTF datasets or your Brainstorm database. Select Save as... and confirm the file name and location.

  3. When exiting the program, select File > Save and exit to ensure the points are saved in the Brainstorm database.

View on scalp surface

  1. Once saved, go to the functional tab, you can see the channel created under the subject name with all the electrodes assigned. Double click on it to see the electrodes on the default scalp (top row image below). Right click on the channel file, MRI Registration>Check to see how well the alignment is (bottom row image below). There will be some errors due to the scalp not matching the head shape of the subject.

    revogui14.png

  2. To align it, right click on the channel file, MRI Registration>Refine using head points to align it to the default head shape. Refer to Automatic Registration for more details.

    revogui15.png

Acquiring using 3D scanner

The Hardware

Revopoint hardware package comes with the 3D scanner with tripod and a USB to USB-C cable. More details on the hardware can be found in their website.
revopoint_range2_scanner.png

System requirements

  1. Windows: Windows 10/11 (64-bit)
  2. RAM: 8 GB or better
  3. Processor: Intel Core i5 10th Generation or better
  4. Mac OS X: 10.7+

Prepare the EEG cap

The EEG cap can be made of shiny materials and these can lead to bad scanning. To reduce the effect of shine make sure to spray it with any commercially available dry shampoo before each subject scan.

Prepare the subject

  1. Make sure the subject has no glasses on. Since the scanning involves use of flashing white light, the reflections from the glasses could lead to bad scanning.
  2. Minimize structures floating over the cap such as additional wires or hair. If the cap has removable electrodes with exposed wires, scan the cap without electrodes attached. A stocking over the cap can be used if exposed wires cannot be removed.
  3. While the scanning is on, make sure the subject sits as steady as possible and has the eyes closed.

Revo Scan software

Revopoint uses the Revo Scan software to do the scanning of a subject wearing EEG cap and generate a 3D model. This model can then be imported into Brainstorm to detect and label the electrodes in it.

Installation

  1. Download the software from their webpage based on your Operating System (OS).

    revoscan1.png

  2. Install it by keeping the defaults. After it has finished installing click on Complete.

Start new project

  1. Connect the 3D scanner to your PC and launch the Revo Scan software. It will take few seconds to initialize and show Scanner Connected as under.

    revoscan3.png

  2. If you are connecting it for the first time, it might ask for calibration of the device which is a very essential step. Calibrating a Revopoint 3D scanner resets its internal parameters to ensure accurate scanning data and alignment. Follow the onscreen steps and prompts to complete the calibration.
  3. Click on New Project and give it a File Name and Location. Click New. Make sure to start a new project per subject.

    revoscan4.png

  4. This should now take you to the scanning window.

    revoscan5.png

Pre-scanning setup (Scan Mode)

  1. Depth Camera exposure (top left section): Use the plus/minus buttons behind the scanner to increase/decrease the exposure. Blue/Red artefacts in this window indicate under/over exposed camera. Use the buttons to adjust the exposure so that there are minimal/no artefacts. For e.g. in the scan below, the exposure of 1 was gave underexposed artefacts and increasing it to 2 gave good results. This exposure depends largely on the environment your scanning is done in and can vary from case to case.

    revoscan8.png

  2. Scan Settings (right section):

    • Accuracy: High Accuracy

    • Tracking Mode: Feature Tracking

    • Object Type: Body

    • Color Scanning: On

    • Base Removal: Default (90%)

    • Scanning Distance: ~ 400 mm to 900 mm

      revoscan9.png

  3. Get a good scanning distance: Pointing the camera to the subject, move close and away from them. You can see the range meter on the right just to the left of the Scan Settings going from Too Near to Too Far. You want to be in the Excellent range to get the best results. Note/mark this distance to help maintain a scanning range.

    revoscan7.png

Scanning

From the marked position above, click on the Play button on the back of the Revopoint to start the scanning. Move the camera continuously with a steady hand, balance speed and stability to improve the quality of your scans. Most scans for the entire head can be accomplished in 30 seconds. The green color on the scanning mesh being generated indicate that the scan is going correctly and in Excellent range. If otherwise, then pause the scanning at that instant by pressing the Play button again. There are 2 things that can be done from here:

Processing

The different buttons available for processing the scanned mesh is shown below.

revoscan_buttons.png

This section does not cover each and every button in details rather the ones that are a minimum requirement for cleaning and processing the scanned 3D model before it can be exported. More details for each of them can be found in the software's User Manual.

  1. button_fusion.png Fusion: This merges the raw point cloud mesh to a more unified and accurate point cloud model.

    • Fusion Method: Advanced

    • Point distance(mm): 1

    • Click on Apply

      revoscan10.png

    • Clean the mesh using the clipping tool on the right to remove unwanted mesh area. We do not need any area other than the cap and face.

      revoscan11.png

  2. button_isolation.png Isolation: This identifies and removes and floating or noisy points that are isolated from the main point cloud data to make it more clean.

    • Isolation Rate: 50%

    • Click on Apply

  3. button_overlap.png Overlap Detection: This is to remove any misalignments or overlapping data in the point cloud for a more accurate and consistent model.

    • Overlap distance(mm): 3

    • Click on Detect

  4. button_mesh.png Mesh: It converts the point cloud data to a solid 3D model.

    • Turn off the color by pressing the color icon iconColor.png on the top for better visualization of the meshing process

    • Quality: 5.8

    • Hole Filling(Auto): Turned off

    • Click on Apply

      revoscan12.png

  5. button_simplify.png Simplify: This makes the 3D model more manageable for storage and processing. We do not require a very dense mesh for working with in Brainstorm so anything around 100000-200000 vertices would be sufficient.

    • Ratio: 50%

    • Click on Apply

  6. button_texture.png Texture Mapping: Maps the texture to the 3D model

    • Turn on the color back by pressing the grayed out icon iconGray.png on the top

    • Texture: Color image

    • Click on Apply

      revoscan13.png

Saving and exporting

Click on button_export.png Export>Texture Model and save as .obj. This will save 3 files to the disk:

Walkthrough Video

Digitize using 3D scanner

Additional documentation

Forum discussions

Articles

Tutorials/TutDigitize3dScannerLegacy (last edited 2024-11-08 21:29:29 by ChinmayChinara)