|Home | About | Journals | Submit | Contact Us | Français|
Dr. Azarion is an epileptologist with research interests in imaging and epilepsy surgery.
Dr. Wu is a computer scientist interested in neuroscience, mathematics and medical imaging.
Visualizing implanted subdural electrodes in 3D space can greatly aid planning, executing, and validating resection in epilepsy surgery. Coregistration software is available, but cost, complexity, insufficient accuracy or validation limit adoption. We present a fully automated open-source application, based upon a novel method using post-implant CT and post-implant MR images, for accurately visualizing intracranial electrodes in 3D space.
CT-MR rigid brain coregistration, MR non-rigid registration, and prior-based segmentation were carried out on 7 subjects. Post-implant CT, post-implant MR, and an external labeled atlas were then aligned in the same space. The coregistration algorithm was validated by manually marking identical anatomical landmarks on the post-implant CT and post-implant MR images. Following coregistration, distances between the center of the landmark masks on the post-implant MR and the coregistered CT images were calculated for all subjects. Algorithms were implemented in open-source software and translated into a “drag and drop” desktop application for Apple Mac OS X.
Despite post-operative brain deformation, the method was able to automatically align intra-subject multi-modal images and segment cortical subregions so that all electrodes could be visualized on the parcellated brain. Manual marking of anatomical landmarks validated the coregistration algorithm with a mean misalignment distance of 2.87 ± 0.58 mm between the landmarks. Software was easily used by operators without prior image processing experience.
We demonstrate an easy to use, novel platform for accurately visualizing subdural electrodes in 3D space on a parcellated brain. We rigorously validated this method using quantitative measures. The method is unique because it involves no pre-processing, is fully automated, and freely available worldwide. A desktop application, as well as the source code, are both available for download on the International Epilepsy Electrophysiology Portal (https://www.ieeg.org/) for use and interactive refinement.
Surgery is the most effective treatment for intractable drug-resistant partial epilepsy.1,2 During phase II (invasive) monitoring, subdural electrodes for electrocorticography (ECoG) are often implanted to precisely localize the ictal onset zone, seizure spread, and for functional brain mapping with electrical stimulation. ECoG findings are delineated with respect to electrode locations. The accuracy of resection depends upon clear and exact visualization of this combined electrode map relative to the cortical surface. Pre-operative imaging methods have been developed for 3D electrode visualization on reconstructed post-implantation brain images. These electrode visualization tools improve the integration of intracranial electrophysiological data with other imaging modalities that map the epileptic network, identify eloquent brain regions, and localize important functions by overlaying fMRI and MEG recordings on pre-surgical MRI scans.3
To date many different imaging techniques have been employed to visualize intracranial electrodes. Such methods include projecting lateral skull radiographs onto MRI,4 curvilinear reformatting of 3D MRI,5 surface CT reconstruction,6 and fusing intraoperative digital photography with pre-implantation MRI.7,8 Recently developed labor-intensive methods rely on intraoperative photographs and avoid conventional techniques of CT-MRI coregistration.3 These techniques have been validated more rigorously than earlier work, with more promising electrode localization accuracy. Because these methods rely on intraoperative photographs, not all electrodes can be visualized on the final 3D rendered image. Matching MRI to photographs relies on electrodes that are in view of the camera. Given that electrodes are often positioned under the skull and away from the exposed cortex, electrode contacts on the outer boundaries of the grid as well as strip electrodes may not be visualized.9
Although not as rigorously validated, and with higher electrode localization error, many epilepsy centers more commonly coregister conventional post-implant CT and pre-implant MRI to generate a final 3D image to display implanted electrodes.10-16 These algorithms employ surface oriented, mutual-information based, or landmark-based methods.13 These methods are more prone to errors from preprocessing (e.g. brain surface extraction, skull segmentation) and manual marking of landmarks for coregistration. Most of these algorithms also rely on projecting electrodes onto the cortical surface, with the aim of addressing coregistration errors due to brain shift that occurs during and after subdural electrodes implantation. This is related to blood and fluid accumulating underneath the craniotomy flap as well as the thickness of the implanted material.17-20 This nonlinear deformation especially affects electrodes under the bone flap, causing them to be buried when visualized in a model created by the pre-implant MRI.3,9 Parenchymal shift introduced by implantation of subdural electrodes can often be larger than one centimeter,21 potentially causing localization errors at least this large when the post-implant CT is coregistered with the pre-implant MRI.7 The effect of brain shift is significantly reduced when the post-implant CT is coregistered with the post-implant MRI.
One aim of this study is to demonstrate the feasibility of a novel and fully automated method of coregistering CT and MRI that accurately and reliably visualizes all electrodes in 3D space by coregistering the post-implant CT with the post-implant MRI. The final image showing the electrodes is displayed on a parcellated brain with rich cortical annotation. In conjunction with results of cortical stimulation mapping, the goal of the parcellated brain image is to aid in determining the approximate boundaries of functional anatomy. We are able to visualize all electrode contacts and include the effect of brain shift on electrode visualization by coregistering the post-implant CT with the post-implant MR image. This method is one of the most rigorously validated CT-MRI coregistration algorithms for visualization of intracranial electrodes, and is among the first to be done on a parcellated brain.
A second contribution of the present study is that we share our source code, and provide a free, easy to use “drag and drop” application on the International Epilepsy Electrophysiology Portal (https://www.ieeg.org), a platform to accelerate collaborative science. We propose that crowd-sourced tools and open source standards, may increase scientific collaboration across centers and accelerate investigator-driven multi-center studies in the translational neurosciences.
Seven patients with intractable drug-resistant epilepsy were included in our experiments. All subjects were implanted with subdural electrodes for intracranial EEG monitoring. Mean age at implant was 31 years (range 21 – 42). Four of the subjects were male and three were female. The Institutional Review Board of the University of Pennsylvania approved this study.
Intracranial EEG electrode placement was planned at a multidisciplinary surgical conference during which multimodality imaging, scalp video EEG, clinical history, and neuropsychological testing were reviewed. The StealthStation neuronavigation (Medtronic, Minneapolis, MN) was utilized in the operating room to assist in implantation. Platinum electrodes embedded in a silastic membrane (Ad-Tech Medical Instrument Corporation, Racine, WI) were used. The diameter of each electrode disc was 4 mm and electrode spacing from center to center was 10 mm. The implanted units had between 4 and 64 contacts (grids: 8 X 8, 4 X 8, 2 X 8, strips: 1 X 4, 1 X 6, 1 X 8). Electrodes were implanted on the frontal, temporal, and parietal regions (right hemisphere in two subjects, left hemisphere in two subjects, bilaterally in three subjects). Six subjects were implanted with both subdural grids and strips, while one subject was implanted with only strips. Overall 9 grids (1 in 4 subjects, 2 in 1 subject, 3 in 1 subject) and 32 strips (range 1 – 14) for a total of 548 contacts (36 minimum, 92 maximum for each subject) were implanted.
Patients were stabilized post-operatively in the neurointensive care unit for approximately 24 hours before being transferred to the epilepsy monitoring unit for intracranial EEG monitoring. Based on the results of intracranial EEG monitoring, five of the subjects were determined to have seizures of extra-temporal onset and two of the subjects had seizures of temporal onset.
All subjects had both post-implant CT and post-implant MRI scans. The post-implant spiral CT images (Siemens, Germany) were obtained first, within 12 hours of surgery for all subjects. Both bone and tissue windows were obtained (120 KV, 300 mA, axial slices 1.0 mm thickness).
A post-implant MRI with volumetric sequences was obtained a mean of 12.4 hours after the post-implant CT (range 2 – 20.3 hours) on a 1.5-Tesla (T) MRI machine (Siemens, Germany) equipped with ultra-gradients, a standard head coil, and vacuum cushion to reduce patient movement. MRI protocol included axial T1 (TE = 2.79 ms, TR = 1180 ms, FOV = 25, flip angle = 15°, matrix of 256 × 256 mm2, 1.0 mm slice thickness) ; sagittal T1 weighted images (TE = 12 ms, TR = 410 ms, FOV = 23, flip angle = 80°, matrix of 256 × 192 mm2, 5.0 mm slice thickness); axial FLAIR (TE = 98 ms, TR = 10000 ms, FOV = 23, flip angle = 150°, matrix of 256 × 166 mm2, 3.0 mm slice thickness). The timing of acquisition of both the CT and MRI post-implantation scans was based on the current protocol employed at the Hospital of the University of Pennsylvania to minimize patient transport and discomfort.
MRI for intracranial electrode localization could be safely performed for both 1.5-T and 3-T MRI after evaluation by Ad-Tech Medical Instrument Corporation in accordance with ASTM F2052-02 Standard Test Method for measurement of Magnetically Induced Displacement Force on Medical Devices in the Magnetic Resonance Environment and for heating (summary provided by company). Independent verification of safety with respect to any possible heating of the electrodes has also been reported by Carmichael et al.22
In an initial step, mutual information is used as the similarity metric to align the two images for each subject. CT data are transformed into MR space, with the CT designated as the floating image and the MR the fixed image. Rigid and subsequent affine transformations are applied to the CT image to account for differences between the two brain images in position, rotation, and scale. The transformation parameters for the CT image are probed, adjusting the similarity matrix, and the transformation corresponding to the maximum value of mutual information is chosen as the best position of the floating image to align with the fixed image. This is a standard method to register multi-modal intra-subject image volumes.23
High intensity electrodes in the CT image are extracted by applying a predefined threshold. Although skull and other bone tissues are brighter than soft brain tissues in CT, metal electrodes are even brighter than most hard tissues. Thresholding may result in extraction of non-electrode objects such as high intensity bone areas and electrode connection wires. These artifacts are deleted by applying a brain mask that keeps only electrodes inside or close to the brain. The brain mask is automatically generated by applying the Brain Extraction Tool (BET) provided from the Functional MRI of the Brain Software Library (Oxford, UK).24 Electrode segmentation is mapped to the MR space by means of the CT to MR image transform obtained previously.
An external brain atlas with rich cortical annotation is used to segment the subject MR scan. We chose the atlas of Non-rigid Image Registration Evaluation Project (NIREP) from the University of Iowa, which is based on 16 normal adult T1-weighted brain scans and has 32 cortical gray matter labels.25 Skull and other non-brain tissues in the subject MR images are stripped by applying the BET.24
The correspondence between the patient MR image and the NIREP atlas is established by non-rigidly registering the gray scale atlas to the patient MR image. Cross-correlation is used as the similarity metric. The non-rigid registration can overcome local brain deformation and shift resulting from electrode placement and surgical intervention, even though the atlas used is based on normal healthy brains.
Atlas labels are propagated to the subject MR image through the deformation resulting from the non-rigid registration. In order to further adapt the labels to the patient's anatomy, we perform prior-based segmentation on the subject MR image using the propagated labels as priors.26 The segmentation algorithm, Atropos, adopts a Bayesian framework and finite mixtures to maximize the posterior probability of a set of labels using Expectation Maximization. The smoothness of segmentation is enforced by a Markov random field component, which encourages each label to be similar to its spatial neighbors on the image grid. Atropos further refines the resultant brain parcellation to fit the tissue boundary of the MR image. The implementation of the rigid and non-rigid registration, as well as prior-based segmentation, are based on the open-source software ANTS (University of Pennsylvania, Philadelphia, PA) and its accompanying tools (e.g. Atropos). The non-rigid registration method implemented in ANTS, specifically symmetric normalization (SyN), has been ranked among the most accurate registration methods.27
The flow chart of the processing pipeline is shown in Fig. 1. The running time is approximately 20 minutes for CT-MR coregistration, and approximately 3 hours for brain parcellation.
The resultant electrode and cortical subregion segmentations are visualized in 3D space with distinct colors. The solid segmentations are converted to mesh-based surface representations for efficient manipulation, such as rotation and translation. Smoothing is applied to remove the wavy shape of the segmentations in cases of limited image resolution. We use the open-source software ITK-SNAP (University of Pennsylvania, Philadelphia, PA) and Visualization Toolkit (VTK, Kitware Inc.) for the visualization task. This enables simultaneous 3D image rendering and volume navigation using highly customizable parameters such as the opacity.28
In some cases the electrodes in the final segmentation appear partially or fully buried by the brain tissue. We remedy this by using a post-processing script in MATLAB (The Mathworks Inc., Natick, MA). This script takes as inputs the brain mask produced from the MR and the aligned electrode mask produced from the CT after it is registered to the MR. A ray is projected from the center of the brain to the cortical surface, passing through each individual electrode. The center of the mass of each electrode is found and shifted outward along the ray until the center of the electrode reaches the surface. This method involves movement of the electrodes along the Z axis (radial axis with respect to the brain center). There is no movement of the electrodes along the X-Y plane, a factor that would contribute to electrode localization error. To prevent movement of the depth electrodes, we set a threshold distance, and any electrode that would have to be projected beyond the threshold distance is left in place. This produces a new electrode mask that is combined with the parcellated brain. Our excavation algorithm is similar to the work of prior investigators.7,9
We provide access to all source code for all software described in sections 2.3 to 2.5 through GitHub, a recognized free code repository (https://github.com/).
Alignment between the subject CT and MR images is the core component of the pipeline, allowing for improved visualization of the electrodes with respect to neuroanatomy. To verify the validity of this alignment, we established a protocol to specify the true correspondence between the two image modalities based on anatomical features available in both scans. In the first step of the validation, a single investigator marked 4 identical landmarks on both the post-implant CT and post-implant T1 MRI for all 7 subjects, independent of the coregistration. The landmarks used were the pineal gland, midline inferior most point of the nasal bridge, a frontal cortical point immediately posterior to the superior most midline of the frontal sinus, and the confluence of sinuses with overlap at the internal occipital protuberance. Precise identification of cortical landmarks in the vicinity of electrodes contacts on the MR images could be made, but these same cortical landmarks could not be manually found on the post-implant CT. Post-operative edema as well as metal artifact made identification of these specific cortical points virtually impossible on the post-implant CT. Thus, the above subcortical, bony landmark, and frontal and posterior cortical landmarks were chosen given the feasibility of their segmentation on the post-implant CT. Examples of these marked landmarks for 4 subjects are shown for both the T1 MRI and CT (Fig. 2). Note that the coregistration algorithm did not use the information from these landmarks and vice versa.
Two different user interfaces were created. One is designed for Linux operating systems and requires familiarity with the command line. A second push-button application was designed for the Apple Mac OS X, coded in Objective-C. Once opened, the application requires that only one file from each set of DICOM images be dragged and dropped into the appropriate location on the interactive interface. In both applications parcellation is selectable as a processing option (not required given that the user may desire faster processing time). A “progress bar” tracks processing, allowing the user to know that the application is proceeding normally (Fig 3).
The automated pipeline successfully performed rigid registration between the CT and MR images for all 7 subjects, and all electrode contacts were visualized. Even though the intensity atlas was constructed based on normal healthy brains, the non-rigid registration between the subject MR images and the atlas was also successful for all 7 subjects. Post-implant brains were partly deformed as a consequence of the craniotomy and subsequent electrode implantation. In addition, epileptic pathology often results in structural changes in the cerebrum. Despite these factors, independent visualization of the brain segmentation by two epileptologists (KD, AA) determined that parcellation conformed to known structural anatomy, serving as a good reference for electrode localization (Fig. 4).
The “excavation” algorithm to correct visualization of buried electrodes only needed to be applied to subjects 3 and 7. One example result is shown in Fig. 5. Depth electrodes were not visualized on the surface per the algorithm previously described in section 2.5.
To validate electrode locations we quantitatively assessed the accuracy of alignment between the MR and CT for each subject. The 3-dimensional coordinates of the segmented masks from the T1 MR images were averaged to locate the center of the image. Following coregistration of the post-implant CT with the post-implant T1 MRI, the same procedure was repeated to calculate the center of the masks on the coregistered CT image. The distance between the centers of the two masks was calculated in a standardized and automated manner. The mean of the distances were as follows: Pineal gland (mean distance, SD) 3.46 mm ± 1.00 mm, inferior point of nasal bridge 2.08 mm ± 0.81 mm, frontal cortical point 2.94 mm ± 1.35 mm, and confluence of sinuses 2.98 mm ± 1.21 mm. In comparison, the voxel size for all 7 subjects in the X-Y-Z plane was 0.5 mm X 0.5 mm X 1 mm for the post-implant CT, and 1 mm X 1 mm X 1 mm for the post-implant T1 MRI. The results of the distances from the center of the masks on the T1 MRI to that of the coregistered CT are shown for all 7 subjects (Table 1).
The software was tested by individuals of different educational levels, including undergraduate students, research assistants, physicians and Ph.D. researchers. Interface elements were iteratively assessed and refined to enable trouble-free use that was deemed to be intuitive by novice users.
Accurate and clear visualization of intracranial electrodes is essential to accurately target regions for resection in epilepsy surgery localized by electrophysiology. This study demonstrates the feasibility of applying a state-of-the-art automated method to coregister and segment electrode locations using CT and post-operative MR. We also demonstrate that it is practical to parcellate epileptic brain images after electrode implantation. Algorithms are implemented in an automated, intuitive interface that is free for use.
The proposed coregistration method is effective and practical, as it works directly on raw imaging data in a fully automated manner. Once input images are provided, manual intervention is not necessary. No complex pre-processing, such as brain surface extraction, skull stripping, or brain tissue segmentation is required due to registration of raw images with voxel-based whole head (including head and skull) matching. We eliminate pre-processing steps that can propagate errors to registration. Our adopted implementation (ANTS) has also been validated by external users.27,29,30 One limitation of our coregistration method is that in rare cases it cannot accommodate large discrepancies in head-position between MR and CT. Coregistration with errors of this nature is obvious by gross visual inspection. No subject tested in this experiment had such a head-pose discrepancy.
Another reason for the high level of accuracy of our coregistration method is that the post-implant MRI, and not the pre-implant MRI is used for registration. In patients chronically implanted with intracranial electrodes there is often edema as well as subdural blood overlying implanted electrodes. These factors, along with electrode thickness, can contribute to brain tissue displacement relative to the pre-operative MRI.7 The unequal shift in electrodes causes inaccuracies in localization based on mutual information algorithms that coregister the post-implant CT with the pre-implant MR.3 By using only post-implantation images, effects of brain shift are not ignored. The subjects in our study had the post-implant MRI performed soon after (mean of 12.4 hours) the post-implant CT. This minimized the effect of any brain shift occurring in the intervening time period between the two scans. The majority of groups employing coregistration algorithms have used the pre-implant MRI. This is due to concerns that the final coregistered image will distort anatomical detail in the vicinity of the electrodes if the post-implant MRI is used.31 Results of our final coregistration images for all subjects showed that the anatomical detail in the vicinity of the electrodes was not compromised.
Due to brain shift, other groups employing coregistration of the post-implant CT to the pre-implant MRI have had to devise complicated algorithms to “de-bury” electrodes on the final 3D coregistered image for all subjects.32 This process often adds additional processing time and may compromise accuracy. Even though we used the post-implant MRI for all subjects to include brain shift, we had to apply a simplified excavation algorithm to several electrodes in 2 subjects. Not surprisingly, in these 2 subjects the intervening time period from acquisition of the post-implant MRI to that of the initial post-implant CT was above the mean of 12.4 hours (subject 3, 13.75 hours; subject 7, 17 hours), providing enough time for significant brain shift to occur. If the post-implant MR images had been obtained sooner relative to acquisition of the post-implant CT, then it is possible that the excavation algorithm might not have been required.
The small number of subjects for validation is a limitation of this application. The number of patients was limited to the number of patients scanned with MRI post-implant at our center at the time the study was performed. However, in contrast to most other CT-MRI coregistration algorithms, our results have been validated on all subjects. Our mean electrode localization error of 2.87 ± 0.58 mm is equal to or better than other reported methods. Given that the inter-electrode distance is usually 10 mm, an error of even 4 mm is substantial and could possibly cause the electrode to be localized on an incorrect gyrus.3 Using the pre-implant MRI images for the registration algorithm, and validation with intra-operative implantation photographs, others have reported a mean electrode localization error ranging from 2 ± 0.12 mm to 6.8 ± 2.4 mm.11,12,32 Our method of validation using internal landmarks appears to more accurately assess the electrode localization error compared to conventional methods of using intraoperative photographs. The timing of the post-implant CT acquisition with respect to when the implantation intra-operative photograph was obtained is not reported in the studies referenced above. If there is considerable delay from when the post-implant CT is obtained, then blood and CSF accumulation can occur in the epidural and subdural spaces, causing migration of implanted electrodes.33 Electrode grid movement may potentially be more than the mean localization error of the electrodes, raising concerns with only using intraoperative implantation photographs as a validation technique. Using intraoperative photographs also relies on manual inspection of electrodes relative to anatomical landmarks. Although our method of validation involves manual segmentation of landmarks, the exact same points are found on both the CT and MRI images, with distances between the centers of the masks calculated in an automated fashion. Also, 2D photograph based distance measures are artificially smaller than the actual 3D distance measures in 3D images. If a line segment is projected in 3D space to a 2D plane (e.g. a 2D photograph), then the length of the projected line segment will be smaller than the original length based on the Pythagorean theorem.
Recent 3D electrode visualization algorithms developed by Pieters et al. address concerns of grid shift when solely using implantation photographs as a validation technique. Similar to work by Hermes et al, they also use implantation and explantation photographs, and report substantial grid movement in some of the subjects that was subsequently incorporated into their validation analysis (mean electrode localization error of 2.0 mm). Their recursive grid partitioning method for electrode visualization requires the user to manually mark grid corners based on intra-operative photographs. Even though this technique is accurate, it requires these additional manual steps, and only works to visualize grid electrode contacts seen in the surgical field at the time the implantation photograph is taken. An extrapolation method is employed for the remaining non-visible grid electrodes. Subsequently, strip electrodes cannot be visualized on the final 3D image. This illustrates that conventional CT-MRI coregistration algorithms are critical to localize electrodes that are not visible in the surgical field during craniotomy, as is commonly the case when recording from non-convexity cortex such as the temporal lobe.12 Our coregistration algorithm does not have this limitation, and our final 3D rendered images clearly show all electrode contacts for all subjects.
Even with our level of electrode localization accuracy, grid movement at the time of explantation and resection still presents a challenge, a factor that is not taken into account with post-implant CT-MRI coregistration. In cases of suspected grid movement, repeat CT and MR imaging immediately prior to explantation, with subsequent implementation of our proposed coregistration algorithm could potentially eliminate the negative impact of grid movement on electrode localization error.
We also demonstrate parcellation on the final 3D coregistered brain image. Accurate cortical parcellation is a challenging task, since boundaries between gyri and sulci are not well defined by MRI features, but by prior knowledge or artificial delimitation.34 Accurately mapping between two different brains (e.g. template and patient) is still an unsolved problem due to the lack of one-to-one correspondence between cortical folds of two individuals.35 Furthermore, the functional anatomy of epilepsy patients may be shifted due to reorganization secondary to pathological plasticity in epileptogenic networks.36-38 This is the main limitation of any parcellation algorithm applied to epileptic brain; thus, all clinical information gained from these images should only be used in conjunction with results of cortical stimulation or other electrophysiologic based mapping.39,40 Specific to the subjects in this study, for reasons explained, the parcellated images only provided a general approximation of functional anatomy of epileptic brains relative to normal adult brain scans. For all 7 subjects, the results of electrophysiologic based mapping were primarily used to determine the boundaries of resection.
In this paper we present a method for accurately visualizing subdural implanted electrodes in patients undergoing evaluation for surgical treatment of epilepsy. We believe our work is an important addition to currently available approaches because its accuracy is competitive with the best methods currently available, it is easy to use, fully automated, and free for use through the International Epilepsy Electrophysiology Portal (https://www.ieeg.org). As with software of any kind, we expect our platform to continuously evolve. By providing access to source code, improvement and updating will occur with greater ease. Our platform has the potential to be adopted by the worldwide epilepsy community, and to become the standard through which functional and pathological localization can be compared across epilepsy centers. This collaborative effort will hopefully improve the accuracy of epilepsy surgery.
This study was funded by National Institutes of Health (NIH), Epilepsy Foundation (EF), Mirowski Family Foundation, and Citizens United for Research in Epilepsy (CURE) grants through the University of Pennsylvania. NIH (8KL2TR000139-07, 2KL2RR024132-06), University of Pennsylvania Institute for Translational Medicine and Therapeutics; NIH (DA022807, NS045839); The National Library of Medicine, American Recovery and Reinvestment Act (HHSN276201000492P); EF Research and Training Fellowship for Clinicians (190678); CURE (“Flexible, Active, Implantable Devices for Epilepsy”). The International Epilepsy Electrophysiology Portal is funded by the NIH (5-U24-NS-063930-04).
6. Conflicts of Interest
None of the authors have any conflict of interest to disclose. We confirm that we have read the Journal's position on issues involved in ethical publication and affirm that this report is consistent with those guidelines.