Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2022 Apr 24.
Published in final edited form as: Annu Int Conf IEEE Eng Med Biol Soc. 2021 Nov;2021:6175–6178. doi: 10.1109/EMBC46164.2021.9630724

A canonical visualization tool for SEEG electrodes*

Harvey Huang 1, Gabriela Ojeda Valencia 2, Dora Hermes 3, Kai J Miller 4
PMCID: PMC9035306  NIHMSID: NIHMS1796592  PMID: 34892526

Abstract

Stereoencephalographic (SEEG) electrodes are clinically implanted into the brains of patients with refractory epilepsy to locate foci of seizure onset. They are increasingly used in neurophysiology research to determine focal human brain activity in response to tasks or stimuli. Clear visualization of SEEG electrode location with respect to patient anatomy on magnetic resonance image (MRI) scan is vital to neuroscientific understanding. An intuitive way to accomplish this is to plot brain activity and labels at electrode locations on closest MRI slices along the canonical axial, coronal, and sagittal planes. Therefore, we’ve developed an open-source software tool in Matlab for visualizing SEEG electrode positions, determined from computed tomography (CT), onto canonical planes of resliced brain MRI. The code and graphical user interface are available at:https://github.com/MultimodalNeuroimagingLab/mnl_seegview

I. INTRODUCTION

Research on large scale human brain dynamics with intracranial electroencephalographic (iEEG) has mostly employed signals from subdural electrodes implanted on the brain surface [1]. However, clinical iEEG measurement has partially transitioned to stereotactically-implanted leads of depth electrodes. These stereoencephalographic (SEEG) electrodes have allowed clinicians and neurophysiology researchers to ask new questions and to assess electrophysiology throughout the entire brain volume.

Precise measurement of electrode location relative to brain anatomy is essential for clinical planning and research. Neurosurgeons must be able to confidently localize the source of abnormal recordings before resection of epileptogenic cortex in order to ensure efficacy and avoid damage to eloquent cortex. The positions of electrodes can be obtained from the post-operative computed tomography (CT) image after co-registration to the pre-operative T1 magnetic resonance image (MRI). These positions may then be visualized directly relative to the MRI.

Electrode visualization is relatively straightforward for a 2-D grid of electrodes on the cortical surface. But it is significantly more challenging for SEEG electrodes due to the inherent difficulty associated with projecting multiple, distinct 3-D trajectories into the same brain volume. Most intuitively, the structural MRI should be transformed and resliced along the canonical axial, coronal, and sagittal planes, with the SEEG electrodes closest to each slice plotted correspondingly. The goal of our research is to create a software tool, SEEG View, available to the community that solves this problem by visualizing SEEG electrode activity with canonical slices.

II. Methods

Our implementation in Matlab begins with a graphical user interface (GUI) to calculate the necessary transformation and reslice the MRI. Via cursor interaction, the user defines the anterior commissure (AC) point and the posterior commissure (PC) point, as well as 3 more points lying on the mid-sagittal plane. From these user inputs, a series of rotations are calculated and applied to the brain volume. Subsequently, a script applies the same transformation to a set of SEEG electrode positions and a set of brain rendering vertex positions. The transformed electrodes are visualized first on the 3-D brain rendering for user review, and finally they are visualized on 2-D slices along axial, coronal, and sagittal planes of the MRI. The user can include a set of numerical weights, such as those representing underlying brain activity, with which to scale the diameter and color of electrodes.

A. Preprocessing & CT, MRI co-registration

A set of SEEG electrode positions must be obtained relative to the coordinate system of the pre-op T1 MRI. This is done by co-registering the post-op CT image, which contains the electrodes, to the pre-op T1 MRI. We employ a series of intermediate co-registration steps, which leverage the T2 MRI and pre-op CT image, for maximum fidelity of alignment (Fig. 1). This is done for two reasons: the T2 MRI has more favorable skull contour than the T1 MRI for alignment with CT, and the pre-op CT has significantly better tissue resolution than the post-op CT for alignment with MRI. The co-registration steps are briefly as follows. First, a T2 MRI is co-registered to the T1 MRI. Next, a pre-op CT image is co registered to the T2 MRI. Finally, the post-op CT image containing the electrodes is co-registered to the pre-op CT image and resliced. Any additional images to be included as “ride along” (II.C, below) should be co-registered and resliced to the T1 or T2 MRI, as appropriate. These co-registration steps can be performed sequentially using the Statistical Parametric Mapping (SPM) software [2]. The electrode positions are extracted from the resliced post-op CT image through cursor interaction in the CTMR software package [3].

Figure 1.

Figure 1.

CT and MRI co-registration. Single-headed arrows represent co-registration of source with target. Double-headed arrow represents cortical segmentation of T1 MRI using FreeSurfer. Electrode positions are obtained from the post-op CT image (CT-post) after co-registration and reslicing. The intermediate co-registration steps involve the T2 MRI and the pre-op CT image (CT-pre) and are recommended for maximum fidelity of alignment. T1 + contrast and FGATIR [5] are examples of ride along images, illustrating how they should be respectively co-registered.

The patient’s 3-D brain rendering is obtained from segmentation of the cortical surface. We do this by applying the software FreeSurfer to the T1 MRI [4].

B. Reslicing

As described in [6], a transformation matrix must be calculated from the AC-PC vector and mid-sagittal plane of the T1 MRI to reslice along the 3 canonical planes. We recapitulate the process here.

The T1 MRI is loaded into the SEEG View GUI (Fig. 2) and three orthogonal views are presented. To calculate the AC-PC vector, the user selects the anterior commissure (AC) and posterior commissure (PC) points, which are the standard midline anatomic features used to align images to anatomic atlases. The AC-PC unit vector y^ is calculated simply as

y^=AC-PCAC-PC. (1)

Figure 2.

Figure 2.

The SEEG View GUI. The subject’s T1 MRI has been loaded and the anterior commissure is selected (red dot). The brain has not yet been rotated so the three orthogonal views shown do not correspond to the canonical views. The user selects the AC, PC, and three additional points along the mid-sagittal plane to calculate the necessary rotations. Pressing “Launch Reslice” saves the rotated and resliced T1 MRI and ride along images in NIfTI format, along with the transformation matrix necessary to rotate electrodes and brain rendering vertices.

Next, the user selects three additional points along the midline. These points should be well spread out along the mid-sagittal plane to ensure accurate estimation of its true position. A vector normal to the mid-sagittal plane is fit from the AC, PC, and the three chosen midline points m1,m2, and m3 using principal component analysis. The five points are loaded as rows into a matrix and the column mean is subtracted, giving A. The covariance matrix, C, is calculated as C=ATA. An eigenvalue decomposition of C yields the eigenvectors ek and eigenvalues λk, satisfying:

Cekλkek=0. (2)

The first two eigenvectors (corresponding to the two largest eigenvalues) describe orthogonal directions of greatest variance, defining the mid-sagittal plane. The third eigenvector e3 is therefore normal to the mid-sagittal plane. This direction e3/e3 is denoted x^ in neurosurgical AC-PC convention. Crossing x^ and y^ gives an orthonormal vector z^ along the ventral-dorsal axis. The third axis of AC-PC space is defined as z^=x^×y^ (with × being the cross product).

The image volume is then rotated into AC-PC space with three rotation matrices about the three axes. The matrix Rz rotates about the z-axis by angle θ=tan-1y^1/y^2:

Rz=cos(θ)-sin(θ)0sin(θ)cos(θ)0001. (3)

Rx rotates about the x-axis by angle φ=tan-1y^3/y^2/cos(θ):

Rx=1000cos(φ)sin(φ)0-sin(φ)cos(φ). (4)

After defining a new vector, a^, by rotating z^,

a^=RxRzz^, (5)

we rotate about the y-axis with Ry to maintain left-right symmetry by angle η=-tan-1a^1/a^3:

Ry=cos(η)0sin(η)010-sin(η)0cos(η). (6)

Applying these rotation matrices to the 3-D brain image V (where V is in scanner space) transforms V into AC-PC space. The output is an image volume Vc centered on the mid-commissural point (MCP) and whose x, y, z axes are normal to the sagittal, coronal, and axial planes, respectively.

Vc=RyRxRzV (7)

Rotation and reslicing of the brain image occur upon pressing “Launch Reslice”, and output voxel values are determined using an algorithm similar to [7]: voxel values in the output Vc are trilinearly interpolated from voxel values in the input V. Vc is saved along with its transformation matrix, RyRxRz.

C. Ride along images

The same rotations can be readily applied to additional images, such as FGATIR or T1 contrast-enhanced MR, which have been co-registered to the T1 MRI during the preprocessing step (II.A, above). These are loaded as “ride along” images in the SEEG View GUI. Ride along images are especially useful when segmentation of anatomic features requires comparison of several different sequences. The resliced Ride along images are also saved in NIfTI format.

D. Transform electrode and brain rendering positions

SEEG electrode and brain rendering vertex positions obtained in the preprocessing step must also be transformed from T1 scanner space to AC-PC space. This is achieved by multiplying the positions (of electrodes or vertices), X^, by the same rotation matrices as applied to the brain image in (7),

X^c=RyRxRzX^. (8)

E. Visualization

The set of transformed electrodes is first projected onto the 3-D brain rendering so that it can be visualized in its entirety. This allows for broad overview of SEEG lead alignment and trajectories within the brain. A set of signed plot weights corresponding to each electrode can be given as input to scale the diameter and color of electrodes.

The electrodes are then visualized on axial, coronal, and sagittal slices of the brain image, Vp. The desired slice thickness, in millimeters, is defined by the user. Visualized slice stacks span only the brain volume containing electrodes, and each electrode is added to its nearest slice (along each dimension). As above, a set of signed plot weights can be given to scale the diameter and color of electrodes.

III. Results

We demonstrate the application of SEEG View on SEEG data from one subject during a face-house visual discrimination task [8]. The subject was presented grayscale images of 53 faces and 50 houses (luminance- and contrast-matched) displayed in random order for 1 second each, with 1-second blank screen inter-stimulus interval between the images. In order to maintain fixation on the stimuli, the subject was asked to verbally report on the singular appearance of a simple target (an upside-down house).

A. Reslicing

We began by loading the subject’s T1 MRI in the SEEG View GUI (Fig. 2). The orthogonal views shown in the GUI contain arbitrary rotations and translations relative to AC-PC space, corresponding to scanner alignment. There was no need to manually rotate the image prior to this step. We manually selected 5 points to define the AC-PC unit vector and the mid-sagittal plane, and then pressed “Launch Reslice” (Fig. 2) to save the resliced image and transformation matrix.

B. Localization of electrophysiological recordings

We visualized electrodes first on the subject’s semi-transparent 3-D brain rendering and then across each of the three canonical views (Fig. 3). Each electrode was weighted by “category associated activation”, R2, which measures the variance in broadband power across stimuli explained by the stimulus category, house vs. face [8]. The broadband power (70 – 170 Hz) was calculated for each electrode on the 900-millisecond interval following stimulus onset, and is an estimate of underlying population neuronal activity [9]. In other words, electrode colors and diameters were scaled by relative neuronal activation during face vs. house stimuli, with positive values indicating greater activation during house stimuli and negative values indicating greater activation during face stimuli.

Figure 3.

Figure 3.

Brain rendering and canonical slices of the subject’s T1 MRI with SEEG electrodes, depicting results of the face-house visual discrimination task. The canonical slices enable precise anatomic localization of electrodes and reveal house-associated sites deep in the collateral sulcus. (A) 3-D rendering of the subject’s left hemisphere (from FreeSurfer cortical segmentation) with projected SEEG electrodes. Positive electrode weights (red) indicate greater broadband power during house stimuli and negative weights (blue) indicate greater broadband power during face stimuli. (B) Mean log10 power spectral density across all 50 house stimuli (magenta) and all 53 face stimuli (violet), calculated from the representative house-associated site pinpointed in D, E. Frequencies around line noise (60 Hz) and its harmonics (120 Hz, 180 Hz) are omitted. Broadband power is calculated from 70 Hz to 170 Hz (gray rectangle) for each stimulus presentation. (C) Distribution of log10 broadband power for house stimuli (magenta) and face stimuli (violet) at the representative house-associated site. Small black dots depict values for individual stimuli and large black squares depict the mean for all stimuli of each category. (D) Coronal slices of T1 MRI every 8 mm apart with SEEG electrodes plotted each onto the closest slice. The slices span only the volume containing electrodes, as marked by light blue lines in A. Electrode weights are as in A. (E) Axial and sagittal slices of T1 MRI every 8 mm apart with SEEG electrodes plotted. The slices containing the representative house-associated site are shown at the top and framed in their respective montages below.

Our analysis revealed a few house-associated sites located deep in the collateral sulcus (Fig. 3D, E), consistent with previous functional MRI literature on locating place-selective areas within the human brain [10]. Face-associated sites were not identified in our subject, which may be explained by the lack of SEEG coverage on the surface of the fusiform gyrus, where face-encoding primarily takes place [11]. These results are effectively communicated by our visualization software, especially along the coronal planes.

IV. Discussion

A. Clinical utility

When planning epilepsy treatment and when reviewing post-operative images, viewing SEEG electrodes overlayed on familiar brain slices allows for confident identification of key brain structures and precise localization of epileptogenic foci. Most neurologists and neurosurgeons are used to interpreting structures along the three canonical planes, not along arbitrary planes or those sliced obliquely along SEEG leads. We hope the user-friendly system detailed in this paper will be integrated into existing epilepsy planning and navigation software at some future date.

B. Research utility

The ability to record neural signals throughout the brain volume in awake human subjects is a unique opportunity. Analysis of these signals holds potential to benefit multiple neurological domains, such as in advancing stimulation-based therapies for epilepsy or blindness. Identifying the positions of recording sites is prerequisite to the interpretation of the electrophysiological signals. SEEG View enables researchers to map electrophysiological properties onto universal MRI views that are familiar to most experts and collaborators. In our example application, we showed clearly the collateral sulcul location of an electrode strongly activated by house images, consistent with previous literature [10]. In addition, when research is conducted across multiple subjects, the canonical views afforded by SEEG View enable direct comparison of electrode position across all subjects regardless of individual scanner alignment or lead trajectories.

Clinical Relevance—

This tool enables precise communication of SEEG electrode activity and location by visualization on slices of MRI in canonical axial, coronal, and sagittal planes.

Acknowledgment

We are grateful for the participation of the patients in this study, for the help from Benjamin Brinkmann in identifying electrode positions from CT, and for the assistance of Cindy Nelson, Karla Crockett, and other staff at Saint Mary Hospital, Mayo Clinic, Rochester.

*This work was supported by the Van Wagenen Fellowship, the Foundation for OCD Research, the Brain Research Foundation with a Fay/Frank Seed Grant, the Brain & Behavior Research Foundation with a NARSAD Young Investigator Grant, and NIH-NIMH CRCNS R01MH122258-01 & NIH-NCATS CTSA KL2 TR002379. Its contents are solely the responsibility of the authors and do not necessarily represent the official views of the NIH.

The experimental procedures involving human subjects described in this paper were approved by the Institutional Review Board.

Contributor Information

Harvey Huang, Medical Scientist Training Program, Mayo Clinic, Rochester, MN 55902 USA..

Gabriela Ojeda Valencia, Physiology and Biomedical Engineering Department, Mayo Clinic, Rochester, MN 55902 USA..

Dora Hermes, Physiology and Biomedical Engineering Department, Mayo Clinic, Rochester, MN 55902 USA..

Kai J. Miller, Neurologic Surgery Department, Mayo Clinic, Rochester, MN 55902 USA.

References

  • [1].Miller KJ, “A library of human electrocorticographic data and analyses,” Nat. Hum. Behav, vol. 3, no. 11, pp. 1225–1235, 2019. [DOI] [PubMed] [Google Scholar]
  • [2].Penny WD, Friston KJ, Ashburner JT, Kiebel SJ, and Nichols TE, Statistical parametric mapping: the analysis of functional brain images Elsevier, 2011. [Google Scholar]
  • [3].Hermes D, Miller KJ, Noordmans HJ, Vansteensel MJ, and Ramsey NF, “Automated electrocorticographic electrode localization on individually rendered brain surfaces,” J. Neurosci. Methods, vol. 185, no. 2, pp. 293–298, 2010. [DOI] [PubMed] [Google Scholar]
  • [4].Dale AM, Fischl B, and Sereno MI, “Cortical surface-based analysis: I. Segmentation and surface reconstruction,” Neuroimage, vol. 9, no. 2, pp. 179–194, 1999. [DOI] [PubMed] [Google Scholar]
  • [5].Sudhyadhom A, Haq IU, Foote KD, Okun MS, and Bova FJ, “A high resolution and high contrast MRI for differentiation of subcortical structures for DBS targeting: the Fast Gray Matter Acquisition T1 Inversion Recovery (FGATIR).,” NeuroImage, vol. 47 Suppl 2, pp. T44–52, Aug. 2009. [DOI] [PubMed] [Google Scholar]
  • [6].Richner TJ, Klassen BT, and Miller KJ, “An in-plane, mirror-symmetric visualization tool for deep brain stimulation electrodes,” in 2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC), 2020, pp. 1112–1115. [DOI] [PubMed] [Google Scholar]
  • [7].Fischer J and Del Rio A, “A fast method for applying rigid transformations to volume data,” 2004. [Google Scholar]
  • [8].Miller KJ, Schalk G, Hermes D, Ojemann JG, and Rao RP, “Spontaneous decoding of the timing and content of human object perception from cortical surface recordings reveals complementary information in the event-related potential and broadband spectral change,” PLoS Comput. Biol, vol. 12, no. 1, p. e1004660, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [9].Miller KJ, Sorensen LB, Ojemann JG, and den Nijs M, “Power-Law Scaling in the Brain Surface Electric Potential,” PLoS Comput. Biol., vol. 5, no. 12, p. e1000609, Dec. 2009. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [10].Weiner KS et al. , “Defining the most probable location of the parahippocampal place area using cortex-based alignment and cross-validation,” NeuroImage, vol. 170, pp. 373–384, 2018. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [11].Kanwisher N, McDermott J, and Chun MM, “The Fusiform Face Area: A Module in Human Extrastriate Cortex Specialized for Face Perception,” J. Neurosci, vol. 17, no. 11, p. 4302, Jun. 1997. [DOI] [PMC free article] [PubMed] [Google Scholar]

RESOURCES