Skip to main content
PLOS ONE logoLink to PLOS ONE
. 2023 Jul 7;18(7):e0287921. doi: 10.1371/journal.pone.0287921

Modular pipeline for reconstruction and localization of implanted intracranial ECoG and sEEG electrodes

Daniel J Soper 1,2,*,#, Dustine Reich 1,3,#, Alex Ross 4,#, Pariya Salami 1,2, Sydney S Cash 1,2, Ishita Basu 4,, Noam Peled 5,6,, Angelique C Paulk 1,2,
Editor: Federico Giove7
PMCID: PMC10328232  PMID: 37418486

Abstract

Implantation of electrodes in the brain has been used as a clinical tool for decades to stimulate and record brain activity. As this method increasingly becomes the standard of care for several disorders and diseases, there is a growing need to quickly and accurately localize the electrodes once they are placed within the brain. We share here a protocol pipeline for localizing electrodes implanted in the brain, which we have applied to more than 260 patients, that is accessible to multiple skill levels and modular in execution. This pipeline uses multiple software packages to prioritize flexibility by permitting multiple different parallel outputs while minimizing the number of steps for each output. These outputs include co-registered imaging, electrode coordinates, 2D and 3D visualizations of the implants, automatic surface and volumetric localizations of the brain regions per electrode, and anonymization and data sharing tools. We demonstrate here some of the pipeline’s visualizations and automatic localization algorithms which we have applied to determine appropriate stimulation targets, to conduct seizure dynamics analysis, and to localize neural activity from cognitive tasks in previous studies. Further, the output facilitates the extraction of information such as the probability of grey matter intersection or the nearest anatomic structure per electrode contact across all data sets that go through the pipeline. We expect that this pipeline will be a useful framework for researchers and clinicians alike to localize implanted electrodes in the human brain.

Introduction

Patients with medication-resistant epilepsy can be candidates for surgical treatments for alleviating seizure burden that typically involve intracranial electrode implants to accurately identify the seizure onset area(s) [16]. These surgically implanted electrodes consist of two types: 1) contacts along thin tubes that extend into the brain (also intraparenchymal depths) targeting subcortical brain regions or deep cortical structures, which we call stereotactic electroencephalography (sEEG) electrodes, or 2) grids and strips on silastic sheets that lay on the cortical surface, which we call electrocorticography (ECoG) electrodes. These electrodes are designed to record neural activity, intracranial EEG (iEEG), with the goal of delineating the seizure onset zone (SOZ) for further clinical interventions such as resection, ablation, or stimulator placement [1,2,710]. Intracranial brain recordings via these electrodes also allow for the study of brain activity during other cognitive and physiological processes otherwise not possible with non-invasive measures [1,1114]. In addition, multiple groups have begun using sEEG and ECoG electrodes in clinical trials to identify locations for deep brain stimulation to treat severe depression [1518].

A key requirement to achieving clinical and research goals is the precise localization of the implanted electrodes relative to brain regions. Most methods for localization use spatial co-registration of the pre-implantation MRI with a post-implantation CT or MRI to produce a visual representation of the implanted electrodes [5,1926]. Several implementations involve all-in-one software packages that provide validated pipelines for localizing electrode locations [1,19,2230], and some pipelines require an experienced radiologist to identify the brain locations of each electrode contact manually [1,5]. In addition, some co-registration pipelines require the pre-operative and post-operative scans to first be transformed into a standardized brain space (e.g., Montreal Neurological Institute (MNI) space) before identifying electrode locations [28,29]. There are various methods for a user to achieve their goal when attempting to localize implanted electrodes, but here we lay out a protocol involving multiple software packages that we have used in a large data set (>260 patients) and which we have used to address many neuroscientific and clinically-relevant goals [5,6,1114,3038].

Our protocol incorporates several different software packages and methods and facilitates the incorporation of additional packages and their outputs depending on user skill and need. The overarching outputs of the protocol are (1) visualization of the electrodes, (2) localizations of the electrodes relative to the brain, (3) algorithmic localization of electrodes to brain structures, (4) data curation into an anonymized, shareable format, and (5) additional quantitative tools for identifying specific electrode placement relative to white matter, grey matter, subcortical regions, or whether contacts are outside brain. Regardless of the use case, we attempt to lay out the pipeline to be clear and easy to follow to maximize reproducibility across users.

We developed and designed our protocol pipeline to achieve three major benefits: first, (1) it is modular in execution with flexible optional outputs; (2) it is easy to use with steps explained in plain terms, even for naïve users; and (3) it maps electrodes to the patient’s native space for electrode localization.

First, modularity both in the steps and the output is of particular importance so that we have a multi-purpose pipeline which does not require knowledge or execution of all steps in the entire protocol. For example, we anticipate that clinicians may only require the 2D or 3D visualization outputs from this pipeline, while neuroscience researchers may want to quantify electrode locations with respect to brain regions and anatomical features. To this end, we note what steps are optional for specific final products. Another aspect of this modularity is that other pipelines or changes to the programming code can be added by the user with relative ease. All of the code for this protocol is documented and open to changes as desired, and we include references to alternative software and methods for different steps within the protocol.

Second, our protocol is built to be accessible to users with minimal programming experience, allowing even naïve users to follow the steps to achieve the output of interest. The relevant MATLAB code uses mostly basic MATLAB functions with a few additional provided functions to assist users who do not have access to paid MATLAB toolboxes. The Python and Bash commands are also easily implemented and rarely need to be altered. Orienting radiological images (MRI) in 3D space, creating images, and saving images are all automatic. This is particularly advantageous in the sense that a potential user need not have specialized knowledge of neuroanatomical landmarks to be able to perform successful coregistration of the pre-operative MRI (before electrode implants) and post-operative images (CT or MRI with implanted electrodes) [25,28]. We also include information on how to install the necessary software packages, as well as information which will help naïve users to follow this pipeline with minimal effort, including videos and example data [39].

Finally, our images and electrode coordinates remain in the patient’s native space. This is especially important for patients with substantial abnormalities in their brain structure due to lesions or prior surgery. Such alterations in anatomy can make morphing into a common brain space problematic. Relevant to this point, we further include two different approaches to map electrodes to brain regions identified through the automatic parcellation and segmentation of the patient’s brain into common atlas space [5,30,4042]. We incorporate the preservation of native space and the transformation in a common space in order to improve the flexibility of this pipeline.

Notably, our pipeline is not a single software package but is a methodology that takes advantage of multiple software packages, utilizing the strengths of each package for an expandable and flexible pipeline for electrode localization (S1 Fig). With the minimum installation of 2 pieces of software, and a total of 5 downloads, we demonstrate a working pipeline which can create 2D and 3D visualizations of iEEG electrodes along with automatic, algorithmic localization of electrode contacts to brain structures and brain regions using multiple approaches. This protocol has been followed by multiple users, ranging from individuals new to programming to adept programmers, to reconstruct electrode locations in over 260 patients with iEEG across multiple hospitals. The pipeline also incorporates software for de-identified output using the iEEG BIDS formatting which is crucial in accelerating data sharing [43]. In addition, in the hands of advanced users, portions of the software in the pipeline identifies electrode contact location relative to brain features and permits visualization of real-time activity on 3D brain surfaces [30].

Materials and methods

The protocol and pipeline pertains to the mapping of electrode locations for recorded intracranial neural activity from patients undergoing invasive monitoring, typically for medication-resistant epilepsy [39]. Participants undergoing invasive monitoring could be implanted with stereo-electroencephalography (sEEG) and/or ECoG grids and strips to locate epileptogenic tissue in relation to essential cortex. In the examples used here, depth electrodes (Ad-tech Medical, Racine WI, USA, or PMT, Chanhassen, MN, USA) with diameters 0.86–1.27 mm and 4–16 platinum/iridium-contacts 1–2.4 mm long with inter-contact spacing ranging from 4–10 mm (median 5 mm) were placed based on the clinical indications for seizure localization determined by a multidisciplinary clinical team independent of this research.

The series of steps for this pipeline are briefly listed below with the relevant references (Fig 1). However, the detailed steps (including video) of the protocol described here is published on protocols.io, https://www.protocols.io/view/modular-reconstruction-and-co-registration-of-imag-5qpvornedv4o/v2 [39]) and is included for printing as S1 File with this article. The protocol is the definitive guide for installation and execution of the pipeline we describe here.

Fig 1. Protocol pipeline.

Fig 1

The steps from the original pre-operative and post-operative imaging to localize electrodes to the resultant visualizations for a number of different uses. Steps 7–10 are advanced in that they are not required for the visualization of the image location relative to the pre-operative MRI. However, they are useful steps for different aspects of researching the human brain.

In terms of the necessary computational hardware to support this pipeline, the reconstruction steps using FreeSurfer are the most demanding. Therefore, we recommend that the system meet their requirements (https://surfer.nmr.mgh.harvard.edu/fswiki/rel7downloads) as the rest of the pipeline is less computationally intense. There are four main hardware requirements: (1) Intel processor supporting AVX instructions, (2) 8GB of RAM for the reconstruction, or 16GB of RAM for better graphical viewing, (3) a 3D graphics card with its own memory and accelerated OpenGL drivers, and finally (4) around 300MB of free hard drive space per processed subject.

Though this protocol was created with first-time, naïve users in mind, it must be understood that this protocol is intended as less of a pedagogical tool and more as a guide for researchers familiar with the input (e.g. brain imaging), output, and motivations of localizing electrodes in the brain. As such, some of the steps described below may take much longer for users new to these concepts. For this reason, in the online protocol, we include videos which capture the sequence of steps needed such that users have both written and visual instructions to follow the steps [39]. Further, the protocol is designed to have multiple, parallel outputs such that users can stop at one step and not proceed to the next steps (Figs 1 and S1; Table 1).

Table 1. Required and optional steps for arriving at specific output in the protocol.

Basic Pipeline 2D Visuals Only Advanced Pipeline
Protocol
Steps
Steps 1–6 Steps 1 and 3–6 All Steps, 1–10

Output
• RAS coordinates
• Reconstructed Surface
• 2D Visuals of electrodes on the preoperative MRI
• 3D Visuals of electrodes in the Freesurfer reconstructed brain
• RAS coordinates
• 2D Visuals of electrodes on the preoperative MRI
• RAS coordinates
• Reconstructed Surface
• 2D Visuals
• 3D Visuals
• ELA probabilities
• BIDS Files Structure
• EVL localizations
• Nearest Anatomical Structure
• Grey/White Distances
• De-faced Imaging

This table lists the three main use cases for this pipeline at the top with their corresponding steps and output below.

Step 1: Retrieve images, 5–10 minutes

Following implant, the pre-operative T1-weighted MRI before contrast is acquired along with the post-operative CT or MRI with electrodes implanted. These images do not have to be anonymized or named anything in particular at this step.

Step 2: Freesurfer reconstruction output, 3–10 Hours

To reconstruct the brain regions and parcellate/segment the brain regions from the MRI, we used the recon-all function from the FreeSurfer scripts (http://surfer.nmr.mgh.harvard.edu) on the pre-operative T1-weighted MRI [41,42,4461] followed by functions which subdivided brain regions based on the Desikan-Killiany-Tourville Cortical Atlas (DKT) using default parameters [42]. This step is time-consuming and is not necessary if only the 2D visualizations from Step 6 are desired. However, there are different paths for different outputs associated with this pipeline which are detailed both in Table 1 and in two flow charts (Figs 1 and S1). For the output from the “Basic” or “Advanced” pipelines, we find starting Step 2 as soon as possible, even before the initial electrode implant, can offset the amount of time the FreeSurfer pipeline takes.

Step 3: Imaging co-registration with freeview, 5 minutes

The pre-operative T1-weighted MRI is co-registered with a post-operative CT using volumetric image co-registration procedures using FreeSurfer tools (http://surfer.nmr.mgh.harvard.edu), [41,42,4461] specifically using Freeview and default parameters. These procedures rely on linear transformations of the post-operative imaging onto the pre-operative imaging. A key point is that all the imaging is registered to a single identified pre-operative T1-weighted MRI scan. As such, if multiple CT scans are performed, each can be registered to the single pre-operative T1-weighted MRI scan sequentially such that the coordinates can be mapped to the same space. A short video of how this is performed is included in the protocols.io publication [39]. Optionally, we have also found we could use Mango [6264] or LeadDBS [29] for this alignment step, since the coordinates just need to be in the native space of the pre-operative MRI (S1 Fig).

Step 4: Identifying RAS coordinates, 0.5–2 hours

Electrode coordinates are manually determined from the overlaid electrodes (from the post-operative CT or MRI) in the patient’s native space [5]. The length of time this step takes depends on many factors including: the resolution of the post-operative scans, the number of electrodes, knowledge of the relative locations for each electrode, and the skill level of the user. There is a short video example of identifying these coordinates in the protocols.io publication [39].

Step 5: Snapping the electrode grid, 30 minutes

When grid and strip electrodes on the surface of the brain are implanted, there is a shift and compression in the brain as a result of the surgery, which can lead to the electrodes being incorrectly mapped relative to the pre-operative MRI. Various researchers have identified algorithms to shift the electrodes to the surface of the brain while constraining the relationships between contacts, though these details are reported and validated elsewhere [21,65,66]. We use the extracted and smoothed surface of the pre-operative MRI as a target for snapping the grids and strips, specifically using the method detailed in Dykstra et al. [5]. This method was selected for its ease of use with the pipeline, but many other pipelines can handle this step as well if desired (Table 2, S1 Fig) [5,21,65,66].

Table 2. Features of this pipeline and alternatives.

Pipeline Name Image Registration Freesurfer-Compatible Snap to Cortical Surface Automatic Visualizations Electrode Region Labelling Native Space Neural Data Processing Anonymization
This Pipeline Manual Yes Dykstra et al. [5] 2D, 3D, Length-wise Surface & Volume-Based Yes No BIDS
Lead DBS Automatic Yes Yes 2D, 3D Subcortical Possible No No
Brainstorm Automatic Yes Yes 2D, 3D Surface-Based No? Yes No
iELVis Automatic/ Manual Yes Dykstra et al. or Yang et al. [5,21,66] 2D, 3D Surface-Based Yes? No No
LeGUI Automatic No Hermes et al. [65] or Normal Vector Projection No Volume-Based Yes No No
Stolk/ Fieldtrip Automatic Yes Dykstra et al. [5,25] No Surface & Volume-Based Yes Yes No

This table lists eight aspects of an electrode localization pipeline with six pipelines along the left side, including this pipeline.

Step 6: Creating images of the MRI with the electrode overlay, 30 minutes

To communicate the electrode locations relative to the MRI among the interested teams, we generate a.pdf (Adobe Acrobat) document (S2 Fig) which includes per-page, individual contact locations relative to the 3D brain and the MRI axes (coronal, sagittal, and horizontal sections). Further, we visualize the length of the depth electrode in a re-sliced coronal view along the long axis of the depth electrode. This step can be run with only 2D output (the electrode overlaid onto the MRI slice) as well, which does not require 3D surfaces (which are produced from FreeSurfer). This step uses a custom MATLAB script that we developed and which is included in the associated GitHub page (https://github.com/Center-For-Neurotechnology/Reconstruction-coreg-pipeline) and detailed in the online protocol [39].

Step 7: Multi-Modality Visualization Tool-lite (MMVT-lite), 10 minutes

The Multi-Modality Visualization Tool (MMVT) is an open-source python package developed by NP that converts the FreeSurfer reconstruction output into a Blender (blender.org) [67] file for three-dimensional visualization of electrode locations which can incorporate MRI, Freesurfer output, RAS mapping, and even evoked potentials into the visualization (https://mmvt.mgh.harvard.edu/) [30]. The original MMVT output has been highlighted in a number of publications and journal covers in the past few years [17,31,68,69]; however, the full MMVT installation requires a considerable number of dependencies for installation and has not been updated to use the latest version of blender.

As such, for the purposes of our protocol, we introduce MMVT-lite (https://github.com/pelednoam/mmvt_lite), which incorporates FreeSurfer commands that include parcellating the brain, mapping to different brain atlases, and the electrode labelling algorithm (ELA, (https://github.com/pelednoam/ieil)) [40] but does not output a blender file. MMVT-lite requires fewer dependencies than the original MMVT version, can be installed on any Mac or Linux machine (or Windows virtual machine) and uses ELA for automatic labelling of electrodes relative to different brain regions. NP developed ELA to identify the nearest brain region label by identifying the probability of overlap of an expanding area (cylinder) around each electrode with identified brain structure labels corresponding to grey matter (whether cortical or subcortical) using purely anatomical approaches. We map electrodes to regions in a given location which can be flexibly chosen within FreeSurfer, using the DKT 40 atlas in combination with a subcortical mapping [41,42,52,61]. As the ELA method involves arriving at probabilities that the contacts or the bipolar pair of electrodes are in that labelled brain region based on proximity to labelled nearby surfaces of the brain structures, a single contact can have multiple probabilities above zero if the contact is near different areas. This data is output in the form of a spreadsheet (.xls or.csv) with every brain region given a probability that each electrode contact is located in that region. Notably, parcellating the brain, which involves mapping brain structures onto the brain using common brain atlases, can also be independently done of MMVT-lite using FreeSurfer or SPM tools [41,42,46,60,70].

Step 8: iEEG BIDS formatting of channel labels and file formats, 30–40 minutes

Another feature we have incorporated into our pipeline involves converting the neural and electrode labelling into the intracranial electroencephalography Brain Imaging Data Structure (iEEG BIDS) format and folder structure including listing the electrodes based on iEEG BIDS formats [43]. As such, we included our modified code from the Bids Starter Kit code (https://bids-standard.github.io/bids-starter-kit/) which includes reformatting the neural, imaging, and electrode localization data into the Brain Vision format with the BIDS folder structure (https://bids-standard.github.io/bids-starter-kit/tutorials/ieeg.html).

Step 9: Extra measurements of electrode location relative to brain features, 20–30 minutes

The next step involves running custom MATLAB code developed by ACP that uses the FreeSurfer output, RAS file, and MMVT file output structure to perform different calculations regarding electrode location, label electrodes based on DKT or other selected brain atlas maps and produce output that matches the iEEG BIDS formatting. This also includes using a second approach for labelling each electrode based on the brain region location.

A second, novel, optional type of labelling that we developed for this pipeline for further electrode location validation, labelled Electrode Volume Labelling (EVL), involves mapping electrode locations relative to brain volumes circumscribed by the parcellated brain region maps. To do this, we export the FreeSurfer volume parcellations into 3D files (.stl files) using 3DSlicer (https://www.slicer.org/). The steps involve importing files from the FreeSurfer output folder and then saving the volumes per brain label: 1) load the brain.mgz and aparc.DKTatlas+aseg.mgz files from the SurferOutput folder; 2) save the output volumes of the parcellations: save (export) the.stl file to the selected folder. The resultant saved volumes are imported into MATLAB (MATLAB 2020b). Then the MATLAB function alphaShape is used to generate enclosing volumes per brain region label. The second MATLAB function, inshape, is then used to determine if an electrode was within the brain region volume (such as a cortical ribbon for a cortical label). Notably, for this step, we check that the T1 used in the original coregistration (Step 3) is in the same orientation and location as the FreeSurfer output.

For identification of electrode location relative to grey and white matter, we measure the orthogonal Euclidean distance from the center of each bipolar pair of electrodes to the nearest reconstructed vertex of the pial and white matter surfaces generated from FreeSurfer tools following colocalization [41,42,4461]. Inter-contact distances between each contact is re-calculated using Euclidean measures. We classify electrode sites as in the grey matter, subcortical regions, white matter, and pial surface by identifying the colocalized location if the location is within the grey matter volume, the white matter volume, and the reconstructed subcortical volumes in the participants’ native space. The classification of the sites relative to the surfaces is done using the MATLAB inpolyhedron function [14,71]. In addition, we use the MATLAB functions alphaShape and inshape to identify electrodes on the pial surface but not within the cortex.

Step 10: Defacing the MRIs and CTs for deidentified data sharing, 10–15 minutes

For sharing data following FAIR data practices [72], it is essential that the data be de-identified to protect the identity of the patients. A number of algorithms can be used to de-face the scans [1,5,19,27,48,49,51,73]. However, as there can be errors in removing facial features from scans while allowing the scans to be useable for future reconstructions [74], we use the fieldtrip de-facer function for manual defacing of each scan [25,27].

Ethics statement

All imaged patients voluntarily participated after fully informed consent as monitored by the Partners Institutional Review Board covering Brigham and Women’s Hospital (BWH) and Massachusetts General Hospital (MGH). The full consent process is both verbal and written in that the initiation of consent starts with a conversation and the final consent is given through a written form. Participants were informed that participation would not alter their clinical treatment in any way, and that they could withdraw at any time without jeopardizing their clinical care.

Expected results

There are multiple outputs from this pipeline which can help answer multiple clinical and research questions (Fig 1, Table 1). We can find the location of the electrodes in a patient’s native brain space, thus allowing us to visualize the electrodes in the patient’s brain to be shared as.pdf documents in an easy-to-understand format (Figs 1, 2 and S1; Table 1). We also can use one of many brain atlases, which can be used to parcellate the brain into identified brain regions in FreeSurfer [41,42,4461] followed by the electrode labelling algorithm (ELA; [40]) or the Electrode Volume Labelling (EVL). This allows us to algorithmically determine the locations of electrode contacts in the brain. This brain region localization alone has been useful for following seizure activity, planning stimulation, and localizing neural activity relative to cognitive processes [5,6,1114,3038]. Finally, this output data is easily converted into a universal format so that we can share our data with the greater scientific community (iEEG BIDS; [43]).

Fig 2. Electrode localization for mapping seizure onset zones across successive implants.

Fig 2

A. The clinical sEEG recording during seizure onset during the second implant, shown here for comparison’s sake. Zoomed image shows the onset of seizure at the channels displayed in panel B (RAH and RA). B. Example pipeline output images showing RAH and RA electrode locations relative to three views of the structural pre-op MRI. C. How the pipeline can be used clinically to compare electrode placements between old and new implantations on the same patient, including sites which exhibited abnormal activity most frequently per implant period preceding a seizure. Top: First and second postoperative CTs overlaid on the most recent MRI showing different electrode locations. Blue/cyan is the second implant while red/yellow is the first implant. Bottom: Previously implanted electrodes are green, and the new electrodes are shown in blue. Sites which showed seizures onsets during the first implant period are magenta and during the second implant period are red. Visualizing implanted electrode locations in the structural MRI.

A primary design feature and requirement of this pipeline is to generate a shareable visual representation of the electrodes in the brain in a format which would be familiar to clinicians with a clear layout and at least three main views of the pre-operative MRI (coronal, sagittal, and horizontal; Figs 2B, S1 and S2; Table 1). The visualization is used to validate whether electrodes are implanted in the desired brain regions and to map neural epileptiform activity and the seizure onset zone (SOZ) to specified brain regions. This pipeline has been shared with clinical teams at Massachusetts General Hospital and Brigham and Women’s Hospital for nearly 15 years, which accounts for over 260 patients as of publication [5,6,1114,3038]. The end product is a shareable.pdf file (Adobe Acrobat; S1 File) that provides clinical and research teams with the appropriate electrode locations and labels, the three MRI views, a re-sliced coronal view along the length of a depth electrode shaft, and the electrode locations in the 3D brain per page of the.pdf. Grids and strips can also be displayed in the 3D brain for surface reconstructions (Fig 1). Importantly, the Step 6 output (Figs 1 and S1; Table 1) can be retrieved without running the 3D brain reconstructions (FreeSurfer, Methods Step 2) if only the MRI views are desired, highlighting the modularity of the pipeline and functionality for different use cases (S1 Fig).

To demonstrate the usefulness of the visualization and localization pipeline, we present a case where a patient had undergone pre-surgical evaluation with intracranial leads twice across many years but with slightly different electrode locations (Fig 2). In this case, we co-register two different post-operative CTs with different implants to a single T1-weighted MRI scan. We map the electrode locations illustrated relative to the ongoing neural activity recorded by the clinical neurophysiological system (Natus Medical Incorporated) (Fig 2A). Often presented in surgical planning conferences, identified seizure activity is compared with the electrode locations in the reconstructions for easy localization (Fig 2B and 2C). Mapping the electrode locations from the separate implants reveals if there was regional overlap of epileptiform activity in these two different intracranial investigations in the same participant. Even though the electrodes were different (sEEG vs ECoG strips) and in slightly different locations, the active sites identified as exhibiting epileptiform activity by the clinical team (including board-certified epileptologists) were in a similar area (the brain area near RAH1-2 in the second implant and RSUB5-6 in the first implant; Fig 2C). This information could be useful in discussing the epileptiform network as identified in the same participant.

An important step is to validate our co-registrations and visualization output. For this step, we confirm that the locations of the contacts, when plotted on the pre-op MRI, were in concordance with the locations identified using other pipelines. For N>100, clinical teams, led by epileptologists, neurophysiologists, and neurosurgeons, ran separate reconstruction pipelines for making visual representations of the electrodes in the brain, including using Brainstorm, iELVis, or LeadDBS [21,28,29]. Our visuals are always compared to these other reconstructions, and for all cases, we had parity in the location on the MRI scan. Additionally, we have output from the pipeline from 2 naïve users who had no experience with these types of protocols or processes (S2 Fig). Not only did their localization match with an experienced user (DJS), but output from the two users matched each other in these steps, with average absolute differences pre contact at 0.97±0.55 mm (across all three RAS axes and contacts) and an average root mean square error relative to the experienced user (DJS) of 0.96 (for naïve user 1) and 0.92 (for naïve user 2; S2 Fig). The output from their execution of the protocol demonstrates further the internal consistency and reproducibility of Steps 1–6 of this protocol.

Electrode localization relative to brain regions

There are a large number of ways to visualize electrode locations in the brain [1,1930,75,76]. Some pipelines involve transforming the brain regions and electrode locations into a common map (MNI) and visualize activity in a single brain [1,28,29]. Other approaches involve projecting activity onto the surface or onto an inflated (flattened) cortical map [75,76]. Further, when transforming the patient brain into a common atlas, the regions of interest can be represented as voxels using a volumetric approach or as surfaces using the surface-based approach. Typically, surface-based approaches are used for labeling cortical areas because of the inherent variability across cortices, and volume-based approaches are better suited to more homogeneous subcortical labeling [60]. As such, we developed two separate pipelines, one mostly surface based and one purely volume based, for localizing electrodes to brain regions in commonly used atlases per electrode contact or pairs of electrodes (Figs 3 and 4). The two methods are 1) the Electrode Labelling Algorithm (ELA) using the Multi-Modal Visualization Tool (MMVT; Fig 3) also briefly described elsewhere [6,30,40] and 2) Electrode Volume Labeling (EVL; Fig 4), described here for the first time [39].

Fig 3. The electrode labelling algorithm.

Fig 3

A. The electrode labeling algorithm (ELA) involves identifying, in a reconstructed MRI, the location of a depth electrode (red dots overlaid on the MRI, black line in inset) and all the surrounding voxels such that their distance from the electrode is smaller than a given threshold area (red). B. Illustration of the intersection of the volume relative to the labelled cortical or subcortical surface created from the FreeSurfer output, indicating contacts with low and high probabilities of being in that brain region. C. Example spreadsheet output from ELA of probabilities in contact volumes intersecting with surfaces. D. Electrode locations color-coded by log probability of being in nearest grey matter/white matter. E. The electrode brain region labelling approach involves labelling the electrode location relative to the highest grey matter (non-white matter) probability. F. Electrodes color coded to brain region locations with the corresponding color-coded surfaces exported from FreeSurfer.

Fig 4. Electrode Volume Labelling and electrode location measurements.

Fig 4

A. Electrode Volume Labelling (EVL) steps, which involve exporting the aparc+aseg volume brain region labelling from FreeSurfer (such as from the DKT 40 map) to.stl files, which can be imported into MATLAB. Next, electrode contacts are labelled per brain region if they are contained within these volumes, which can contain the thickness of the cortical volume. B. Volumetric categorization of electrode contacts as white matter, cortex, subcortical structures, and outside the brain. C. Euclidean measurements of distances between the recording contacts and the nearest anatomical features. D. Further measurements of electrode contacts relative to different features of the nearest cortical structure. E. Categorization of electrode locations relative to neuroanatomical structures (cortical grey matter, subcortical structures, white matter, and outside brain) for depth electrodes with different ending trajectories for different brain regions. Counts of electrode locations relative to different classifications are across individuals (up to 27 patients).

The ELA is a combined volume and surface approach which involves sampling the volume of space around electrode contacts to identify the nearest surface reconstructed from FreeSurfer, arriving at a probability that the electrode location is near that brain region surface (Fig 3). As such, for each contact, there can be multiple probability values above zero of that contact being in white matter or intersecting with the nearest grey matter surface (Fig 3). In our current approach, we take the highest probability value in the non-white matter labels to determine the brain region location for each contact (Fig 3), though further information is accessible in the ELA output [40]. Finally, after identifying the maximal grey matter probabilities per contact, we can then color code the contacts with the same labels in a common brain with the same atlas (e.g. with the DTK atlas; Fig 3F). We provide this code in our pipeline (https://github.com/Center-For-Neurotechnology/Reconstruction-coreg-pipeline) for use. ELA is currently incorporated into the MMVT-lite pipeline for processing the data but can be used separately [40]. Not only can we identify the brain region of each contact, but the pipeline also provides localizations as probabilities for better statistical rigor (and supplies the maximum likelihood value). This localization is now applied to almost all research projects performed by our lab as well as other researchers [6,11,13,14,18,31,3436,38].

The second method developed de novo for this protocol, Electrode Volume Labeling (EVL), uses a purely volumetric approach (Fig 4). The steps involve exporting the volumetric aparc segmentations in FreeSurfer [42] using 3DSlicer [77] into.stl files which can be imported into MATLAB or Python for further mapping. Using MATLAB functions, we then classify electrode locations as within different volumes (including white matter volumes). This approach takes into account the thickness of various structures including grey matter. EVL is likely more relevant to depth electrodes than surface arrays (ECoG grids and strips), which is partly why we use both methods for identifying brain region locations per contact.

We have taken measures to validate our ELA and EVL output, though there is much more room for validation in this space. First, for ELA, we provided the 2D electrode localizations (as visualized with the.pdf output) of 20 patients relative to the MRI images to a neurologist and a psychiatrist with training in identifying brain regions with the brain labels. They confirmed the locations through a visual inspection of the localization. For N>200 patients, we have run ELA and found that the locations detected automatically match with the locations found in the MRI upon visual inspection. A limitation here is that these are not trained neuro-radiologists, though we consider these checks be a meaningful indication of accuracy. Further, in comparing EVL versus ELA, we find the methods for identifying brain region per contact are generally consistent between methods, with differences in identification of contacts which are fully in white matter versus grey matter which is may be expected with a volume versus surface based approach (N = 23).

Electrode characterization and measurements relative to anatomical structures

In parallel to electrode localization relative to brain regions, there are a number of different measures which could be relevant to further study, including localization relative to grey and white matter, contact size, and contact spacing. The organization of the FreeSurfer folders and RAS coordinates allows us to perform automatic calculations of these metrics using basic MATLAB functions without additional toolboxes. An essential step for identifying electrode locations relative to brain regions involves algorithmically and automatically labeling electrode contacts in the patient’s native space using purely anatomical landmarks. These measurements include locations relative to anatomical features such as the nearby grey matter, the nearest grey-white boundary, whether contacts are in white or grey matter, or the angles relative to the nearest cortical column. Some of the measures involve volumetric localization (Fig 4B). Other measures involve calculating the closest points (vertices) of the nearest imported brain surfaces (Fig 4C and 4D). As this approach allows across-patient comparisons automatically, we are able to calculate coverage of electrode contacts in grey matter, white matter, subcortical regions, and outside the brain for different depth trajectories (Fig 4E). A depth trajectory is where the distal tip of the sEEG electrode is aimed during implantation. Along this trajectory, we then calculate the number of contacts classified as in grey matter, white matter, subcortical regions, and outside brain using volumetric measures (see Methods and protocol [39]). Across one data set (N = 27), the location of electrodes in white matter versus cortical grey matter varies depending on the depth electrode trajectory (Fig 4E). This information may be useful for designing novel electrodes for localizing grey matter along common trajectories [7880]. Further, this localization information and measures of electrode location is instrumental for examining how anatomical features alter neural responses to stimulation or for seizure localization (Fig 5) [6,14].

Fig 5. Pipeline research use cases for stimulation and seizure onset.

Fig 5

A. Electrode localization and labelling across patients. The color coding indicates common labels across participants (designated EPXX) for implanted leads. B. The pipeline allows automatic identification of electrode coverage across patients per brain label. Contact counts for different brain regions in individual participant (top) and across multiple participants (bottom, N = 30). C. Demonstration of how stimulation electrode location relative to the grey-white boundary can affect responses in local contacts (less than 15 mm away) and in distant contacts (greater than 15 mm; [14]). D. Electrode labeling algorithm (ELA) used to determine the location of electrodes during seizure onset (colored dots represent seizure onsets). Using ELA output, phase-amplitude coupling was analyzed and found to have different dynamics in different brain regions. δ: Delta; θ: Theta; R: Ripple; FR: Fast ripple; PAC: Phase-amplitude coupling; a.u.: Arbitrary unit [6].

Use-case: Across-patient mapping, data standardization, and data sharing

Aside from the initial co-registration and electrode localization, the remaining steps in electrode localization, brain region labeling, and mapping are automatic, including measurements of electrode locations relative to neuroanatomical markers (Figs 4E and 5A). Therefore, across patients, we are able to color code contacts paired to brain regions across participants (Fig 5A) and summarize counts of contacts per brain region to identify coverage in a data set (Fig 5B), allowing for standardization across data sets.

Relevant to this point, as many journals and funding agencies now require the data be shared, we implement de-identification (defacing) and data reformatting into the iEEG BIDS format (see Methods and protocol [39]) following FAIR practices [72] to ensure we can safely share data following Open Science practices such as on the Data Archive BRAIN Initiative (DABI; https://dabi.loni.usc.edu [81]). At this archive, we share two imaging data sets with their various outputs from the pipeline (https://dabi.loni.usc.edu/dsi/R01NS062092). We have already shared a large intracranial data set using this pipeline (N = 52; [13,14,35]; https://dabi.loni.usc.edu/dsi/W4SNQ7HR49RL). Further electrode localization steps described in the protocol can also be included in the file output in a standardized and well-documented approach (see protocol [39]).

Use-case: Planning for neuromodulation / stimulation

In addition to its clinical uses, this pipeline is also valuable for researchers. For example, this pipeline has been used in understanding how stimulation alters brain activity as well as probe activity in different states such as during sleep and under general anesthesia (N = 82, [11,13,14,3336,38]), where the reconstructed localizations were used to inform selecting stimulation sites. Localizing stimulation sites is important because a key facet of stimulation is understanding the distance between stimulation sites and the brain areas that are targets for stimulation [13,14]. As such, simple calculations of Euclidean distance are crucial for understanding how the brain responds to stimulation (Fig 5C). Using the surfaces, localizations, 3D output, and measurements (Fig 4D), we can precisely show where and how stimulation will impact a certain area based on the stimulating contact’s location and orientation relative to the grey-white matter boundary (Fig 5C). We found that stimulation responses vary depending on the stimulation location relative to grey and white matter [14]. We found that stimulation in white matter induced larger distant effects while stimulation closer to the boundary between grey and white matter induced larger local responses (Fig 5C) [14]. These metrics and relationships with stimulation may have implications for the use of neuromodulation for therapeutic use and understanding brain connectivity, which is dependent on this pipeline [14].

Use-case: Localizing and characterizing seizures

Another project set which has relied on this pipeline involves seizure electrophysiology (Fig 5D). Understanding the epileptogenic network and the role of different structures in seizure onset, spread, and termination is critical to understanding the underlying mechanisms of epilepsy [6,32]. One way to study seizures is to differentiate them based on their region of onset and the regions to which they spread. Understanding these pathways provides insights into seizure dynamics and how they may eventually be disrupted. For example, we have studied seizures recorded from 43 patients, and we used ELA to determine the brain region in which each electrode registering the seizure onset was most likely to be located in these patients. The seizures were classified based on (a) their electrographic pattern (e.g., low-voltage fast activity) at the onset and (b) the region (e.g., hippocampus, lateral temporal, etc.) from which the seizures originated. The phase-amplitude coupling (PAC) analysis showed that seizures originating from different regions might have more distinct PACs, and therefore the region of onset may distinctively impact the dynamics of seizure initiation. For instance, seizures with low-voltage fast activity at their onset have different PAC dynamics if they originate in the hippocampus versus lateral temporal regions (Fig 5D) [6].

Limitations

This methodology and pipeline has a number of inherent limitations which users should be aware of before using this overall approach. First, the manual step of electrode picking can present challenges such as poor contrast, an overwhelming imaging artifact from the electrodes, and low-resolution imaging. Therefore, it is not entirely surprising that the inconsistencies between electrode contact distances presented here can show up in the localizations. One approach to handle this discrepancy and to validate the localization would be to utilize algorithms to automatically detect the ‘bright spots’ of a postoperative CT scan and use this information to identify the centers of the electrode contacts, an approach utilized by some software packages [19,20,29]. We do not apply this approach here, but it could be done in future work. A second way to validate the electrode localizations would be to have multiple users localize the contacts, providing cross-user validation (which we have done previously, S2 Fig) or compare reconstructions across software packages, though this latter step could be outside the scope of the current study.

Secondly, because this is not a single software package and we make use of multiple software packages (e.g. FreeSurfer, Blender, MATLAB) as well as rely on the command-line for execution of the steps in the pipeline, there is no unifying graphical user interface for controlling all aspects of the pipeline. Therefore, some knowledge of how to navigate between directories through the command-line and how to safely manipulate their contents is required. We reference guides and give tips in our protocol to assuage such fears. Nevertheless, this may be off-putting to potential users who would ideally like to control everything from a single application (such as MATLAB), to potential users with no previous experience controlling an operating system from the command-line, or to potential users who would feel more comfortable controlling everything from a single graphical user interface (such as Lead-DBS or Brainstorm [28,29]).

Thirdly, because the methodology entails the execution of commands in the bash shell—bash being a Unix shell—and preprocessing of the images is handled by FreeSurfer—an application that is only available for Mac OS and Linux OS—not every user or organization will be able to immediately take advantage of this pipeline. While we have suggested running the pipeline through an Ubuntu virtual machine should a Windows user be interested in executing the pipeline, this may be off-putting to people with no prior experience installing or working within virtual machines.

Finally, one major limitation in any electrode localization approach is that the post-operative scans and localizations are only ‘snapshots’ of the electrode locations. Tissue shifts during and after implant could result in some amount of error. As such, these electrode localizations are best-guess approximations and any analyses and interpretations should keep this issue in consideration. We recommend using the most up-to-date post-operative imaging in order to avoid this problem. The associated brain shifts with ECoG electrodes are a further example of how localization error can propagate as the methodology, as described above, is prone to error or requires assumptions.

This pipeline is an attempt to demonstrate a longstanding collection of methodologies that take advantage of the strengths of different software packages generating all the output described above, with alternatives given along the way (S1 Fig). While each software piece may or may not be the perfect tool for each job, we find parts of the pipeline are sufficient for many use cases, and that there are alternatives in part or in whole to our pipeline. The comparison table (Table 2) and software pipeline with alternative options (S1 Fig) are quick guides on which of the popular software packages may best assist or even substitute for our pipeline methodology for a given feature.

Future directions

In the future, we anticipate the implementation and possible incorporation of new analysis pipelines into this overall pipeline. This includes white matter tract mapping using such approaches as TRACULA [82,83]. Since seizure disorders like epilepsy are understood to be disorders of the network [84], having more information about how these networks are constructed would be an invaluable tool. This can be used by research teams to answer questions regarding white matter connectivity and its relation to seizure disorders.

Another example of a future tool to add to this pipeline is the inclusion of additional subcortical atlases used in pipelines like LeadDBS [29]. This is a pipeline similar to ours, but where we focus on cortical areas, LeadDBS focuses on subcortical areas with an emphasis on the thalamus. The combination or integration of these two pipelines would also be a major advance for both clinicians and researchers, as both cortical and deep brain structures could be accurately localized and visualized.

While no pipeline like this will be perfect for all use cases, this protocol represents a reproducible pipeline followed by multiple users and applied in hundreds of instances for reconstructing a patient’s brain, visualizing implanted electrodes, algorithmically identifying the brain region for each implanted electrode, and organizing all this data into a sharable format. As this type of data becomes more common and widely used, we hope that each of these facets will become more robust, more user-friendly, and more clinically and scientifically impactful.

Associated content

dx.doi.org/10.17504/protocols.io.5qpvornedv4o/v2.

Supporting information

S1 Fig. Flowchart showing the pipeline steps with required software.

(TIF)

S2 Fig. Naïve users output for sub-0t3i compared to experienced user (DJS).

(TIF)

S1 File. Protocols.io pipeline publication PDF.

(PDF)

Acknowledgments

We would like to thank Olivia Gawel, Devang Sehgal, Aniruddha Shekara, and Roshni Khatri for their incredible work testing the feasibility of this pipeline. We would also like to thank Rina Zelmann and Brian Coughlin for their feedback on this manuscript. Finally, we would like to thank most of all the patient-participants with whom we work for volunteering their time and energy to research during their clinical care.

Abbreviations

Pre-op

pre-operative (before intracranial electrode implant

Post-op

post-operative (after intracranial electrode implant

DICOM

Digital Imaging and Communications in Medicine

MPRAGE

magnetization-prepared 180 degrees radio-frequency pulses and rapid gradient-echo

Ax

Axial

NifTI

Neuroimaging Informatics Technology Initiative

MRI

Magnetic Resonance Imaging

CT

Computed Tomography

RAS

Right Anterior Superior

OS

Operating System (Windows, Mac, Linux

MMVT

Multi-Modal Visualization Tool

ECoG

electrocorticography

sEEG

stereoelectroencephalography

iEEG

intracranial electroencephalography

Reconstruction

recreation of a brain’s surfaces and/or volumes from an MRI file

Data Availability

All relevant data for this study are publicly available in Data Archive BRAIN Initiative repository (https://doi.org/10.18120/gpgp-4r37).

Funding Statement

The authors report the following sources of funding: Support included Tiny Blue Dot foundation, https://www.tinybluedotfoundation.org/, to SSC, DJS, DR, and ACP. SSC was funded by NIH grants NINDS R01- NS062092, 1K24NS088568, R01-NS079533, R01-NS072023, and Massachusetts General Hospital Executive Committee on Research (MGH-ECOR). Some of this research was sponsored by the U.S. Army Research Office and Defense Advanced Research Projects Agency (DARPA), https://www.darpa.mil/, under Cooperative Agreement Number W911NF-14-2-0045 issued by ARO contracting office in support of DARPA’s SUBNETS Program. PS is supported by DoD (CDMRP FY21 Epilepsy Research Program W81XWH-22-1-0315). IB and AR were partially funded by the NIMH grant 1 R21 MH127009-01A1. The views and conclusions contained in this document are those of the authors and do not represent the official policies, either expressed or implied, of the funding sources. The funders had and will not have a role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

References

  • 1.Mercier MR, Dubarry A-S, Tadel F, Avanzini P, Axmacher N, Cellier D, et al. Advances in human intracranial electroencephalography research, guidelines and good practices. NeuroImage. 2022; 119438. doi: 10.1016/j.neuroimage.2022.119438 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2.McGonigal A, Bartolomei F, Régis J, Guye M, Gavaret M, Fonseca AT-D, et al. Stereoelectroencephalography in presurgical assessment of MRI-negative epilepsy. Brain. 2007;130: 3169–3183. doi: 10.1093/brain/awm218 [DOI] [PubMed] [Google Scholar]
  • 3.Cuello Oderiz C, Von Ellenrieder N, Dubeau F, Eisenberg A, Gotman J, Hall J, et al. Association of Cortical Stimulation-Induced Seizure with Surgical Outcome in Patients with Focal Drug-Resistant Epilepsy. JAMA Neurology. 2019;76: 1070–1078. doi: 10.1001/jamaneurol.2019.1464 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Zweiphenning WJEM, von Ellenrieder N, Dubeau F, Martineau L, Minotti L, Hall JA, et al. Correcting for physiological ripples improves epileptic focus identification and outcome prediction. Epilepsia. 2022;63: 483–496. doi: 10.1111/epi.17145 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Dykstra AR, Chan AM, Quinn BT, Zepeda R, Keller CJ, Cormier J, et al. Individualized localization and cortical surface-based registration of intracranial electrodes. NeuroImage. 2012;59: 3563–3570. doi: 10.1016/j.neuroimage.2011.11.046 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6.Salami P, Peled N, Nadalin JK, Martinet L-E, Kramer MA, Lee JW, et al. Seizure onset location shapes dynamics of initiation. Clinical Neurophysiology. 2020. doi: 10.1016/j.clinph.2020.04.168 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7.Lee B, Zubair MN, Marquez YD, Lee DM, Kalayjian LA, Heck CN, et al. A Single-Center Experience with the NeuroPace RNS System: A Review of Techniques and Potential Problems. World Neurosurgery. 2015;84: 719–726. doi: 10.1016/j.wneu.2015.04.050 [DOI] [PubMed] [Google Scholar]
  • 8.Acharya JN. Responsive neurostimulation for epilepsy: More than stimulation. Clinical Neurophysiology Practice. 2018;3: 120–121. doi: 10.1016/j.cnp.2018.06.002 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Zaher N, Urban A, Antony A, Plummer C, Bagic A, Richardson RM, et al. Ictal Onset Signatures Predict Favorable Outcomes of Laser Thermal Ablation for Mesial Temporal Lobe Epilepsy. Frontiers in Neurology. 2020;11: 1–8. doi: 10.3389/fneur.2020.595454 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10.Kini LG, Bernabei JM, Mikhail F, Hadar P, Shah P, Khambhati AN, et al. Virtual resection predicts surgical outcome for drug-resistant epilepsy. Brain. 2019;142: 3892–3905. doi: 10.1093/brain/awz303 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Basu I, Yousefi A, Crocker B, Zelmann R, Paulk AC, Peled N, et al. Closed-loop enhancement and neural decoding of cognitive control in humans. Nature Biomedical Engineering. 2021. doi: 10.1038/s41551-021-00804-y [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12.Dykstra AR, Halgren E, Thesen T, Carlson CE, Doyle W, Madsen JR, et al. Widespread Brain Areas Engaged during a Classical Auditory Streaming Task Revealed by Intracranial EEG. Frontiers in Human Neuroscience. 2011;5: 1–14. doi: 10.3389/fnhum.2011.00074 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Crocker B, Ostrowski L, Williams ZM, Dougherty DD, Eskandar EN, Widge AS, et al. Local and Distant responses to single pulse electrical stimulation reflect different forms of connectivity. NeuroImage. 2021;237: 118094. doi: 10.1016/j.neuroimage.2021.118094 [DOI] [PubMed] [Google Scholar]
  • 14.Paulk AC, Zelmann R, Crocker B, Widge AS, Dougherty DD, Eskandar EN, et al. Local and distant cortical responses to single pulse intracranial stimulation in the human brain are differentially modulated by specific stimulation parameters. Brain Stimulation. 2022;15: 491–508. doi: 10.1016/j.brs.2022.02.017 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Scangos KW, Makhoul GS, Sugrue LP, Chang EF, Krystal AD. State-dependent responses to intracranial brain stimulation in a patient with depression. Nature Medicine. 2021;27: 229–231. doi: 10.1038/s41591-020-01175-8 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 16.Scangos KW, Khambhati AN, Daly PM, Makhoul GS, Sugrue LP, Zamanian H, et al. Closed-loop neuromodulation in an individual with treatment-resistant depression. Nature Medicine. 2021. doi: 10.1038/s41591-021-01480-w [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17.Adkinson JA, Tsolaki E, Sheth SA, Metzger BA, Robinson ME, Oswalt D, et al. Imaging versus electrographic connectivity in human mood-related fronto-temporal networks. Brain Stimulation. 2022;15: 554–565. doi: 10.1016/j.brs.2022.03.002 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Sheth SA, Bijanki KR, Metzger B, Allawala A, Pirtle V, Adkinson JA, et al. Deep Brain Stimulation for Depression Informed by Intracranial Recordings. Biological Psychiatry. 2021; 1–6. doi: 10.1016/j.biopsych.2021.11.007 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Davis TS, Caston RM, Philip B, Charlebois CM, Anderson DN, Weaver KE, et al. LeGUI: A Fast and Accurate Graphical User Interface for Automated Detection and Anatomical Localization of Intracranial Electrodes. Frontiers in Neuroscience. 2021;15: 769872. doi: 10.3389/fnins.2021.769872 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.LaPlante RA, Tang W, Peled N, Vallejo DI, Borzello M, Dougherty DD, et al. The interactive electrode localization utility: software for automatic sorting and labeling of intracranial subdural electrodes. International Journal of Computer Assisted Radiology and Surgery. 2017;12: 1829–1837. doi: 10.1007/s11548-016-1504-2 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Groppe DM, Bickel S, Dykstra AR, Wang X, Mégevand P, Mercier MR, et al. iELVis: An open source MATLAB toolbox for localizing and visualizing human intracranial electrode data. Journal of Neuroscience Methods. 2017;281: 40–48. doi: 10.1016/j.jneumeth.2017.01.022 [DOI] [PubMed] [Google Scholar]
  • 22.Deman P, Bhattacharjee M, Tadel F, Job A-S, Rivière D, Cointepas Y, et al. IntrAnat Electrodes: A Free Database and Visualization Software for Intracranial Electroencephalographic Data Processed for Case and Group Studies. Frontiers in Neuroinformatics. 2018;12. doi: 10.3389/fninf.2018.00040 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Medina Villalon S, Paz R, Roehri N, Lagarde S, Pizzo F, Colombet B, et al. EpiTools, A software suite for presurgical brain mapping in epilepsy: Intracerebral EEG. Journal of Neuroscience Methods. 2018;303: 7–15. doi: 10.1016/j.jneumeth.2018.03.018 [DOI] [PubMed] [Google Scholar]
  • 24.Blenkmann AO, Phillips HN, Princich JP, Rowe JB, Bekinschtein TA, Muravchik CH, et al. iElectrodes: A Comprehensive Open-Source Toolbox for Depth and Subdural Grid Electrode Localization. Frontiers in Neuroinformatics. 2017. doi: 10.3389/fninf.2017.00014 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.Stolk A, Griffin S, van der Meij R, Dewar C, Saez I, Lin JJ, et al. Integrated analysis of anatomical and electrophysiological human intracranial data. Nature Protocols. 2018;13: 1699–1723. doi: 10.1038/s41596-018-0009-6 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.Frauscher B, von Ellenrieder N, Zelmann R, Doležalová I, Minotti L, Olivier A, et al. Atlas of the normal intracranial electroencephalogram: neurophysiological awake activity in different cortical areas. Brain. 2018;141: 1130–1144. doi: 10.1093/brain/awy035 [DOI] [PubMed] [Google Scholar]
  • 27.Oostenveld R, Fries P, Maris E, Schoffelen J-M. FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data. Computational intelligence and neuroscience. 2011;2011: 156869. doi: 10.1155/2011/156869 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 28.Tadel F, Baillet S, Mosher JC, Pantazis D, Leahy RM. Brainstorm: A User-Friendly Application for MEG/EEG Analysis. Oostenveld R, editor. Computational Intelligence and Neuroscience. 2011;2011: 879716. doi: 10.1155/2011/879716 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 29.Horn A, Kühn AA. Lead-DBS: A toolbox for deep brain stimulation electrode localizations and visualizations. NeuroImage. 2015;107: 127–135. doi: 10.1016/j.neuroimage.2014.12.002 [DOI] [PubMed] [Google Scholar]
  • 30.Felsenstein O, Peled N, Hahn E, Rockhill AP, Folsom L, Gholipour T, et al. Multi-Modal Neuroimaging Analysis and Visualization Tool (MMVT). arXiV. 2019;1: 1–29. [Google Scholar]
  • 31.Provenza NR, Paulk AC, Peled N, Restrepo MI, Cash SS, Dougherty DD, et al. Decoding task engagement from distributed network electrophysiology in humans. Journal of Neural Engineering. 2019;16: 056015. doi: 10.1088/1741-2552/ab2c58 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.Salami P, Borzello M, Kramer MA, Westover MB, Cash SS. Quantifying seizure termination patterns reveals limited pathways to seizure end. Neurobiology of Disease. 2022;165: 105645. doi: 10.1016/j.nbd.2022.105645 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 33.Krempp C, Paulk AC, Truccolo W, Cash SS, Zelmann R. Effect of Closed-Loop Direct Electrical Stimulation during Sleep Spindles in Humans. 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC), Montreal, QC, Canada. 2020; 3586–3589. doi: 10.1109/EMBC44109.2020.9175404 [DOI] [PubMed] [Google Scholar]
  • 34.Zelmann R, Paulk A, Basu I, Sarma A, Yousefi A, Crocker B, et al. CLoSES: A platform for closed-loop intracranial stimulation in humans. NeuroImage. 2020;223: 117314. doi: 10.1016/j.neuroimage.2020.117314 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Basu I, Robertson MM, Crocker B, Peled N, Farnes K, Vallejo-Lopez DI, et al. Consistent Linear and Non-Linear Responses to Electrical Brain Stimulation Across Individuals and Primate Species. Brain Stimulation. 2019;12: 877–892. doi: 10.1016/j.brs.2019.03.007 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Zelmann R, Paulk AC, Tian F, Balanza G, Peralta JD, Crocker B, et al. Differential Cortical Network Engagement During States of Un / Consciousness in Humans. Research Square. 2022; 1–28. doi: 10.21203/rs.3.rs-2006868/v2 [DOI] [Google Scholar]
  • 37.Widge AS, Zorowitz S, Basu I, Paulk AC, Cash SS, Eskandar EN, et al. Deep brain stimulation of the internal capsule enhances human cognitive control and prefrontal cortex function. Nature Communications. 2019;10: 1–11. doi: 10.1038/s41467-019-09557-4 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 38.Tian F, Lewis LD, Zhou DW, Balanza GA, Paulk AC, Zelmann R, et al. Characterizing brain dynamics during ketamine-induced dissociation and subsequent interactions with propofol using human intracranial neurophysiology. Nature Communications. 2023;14: 1748. doi: 10.1038/s41467-023-37463-3 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 39.Soper D, Ross A, Reich D, Cash SS, Basu I, Peled N, et al. Modular Reconstruction and Co-registration of Imaging from Implanted ECoG and SEEG Electrodes. protocols.io. 2022. [Google Scholar]
  • 40.Peled N, Gholipour T, Paulk AC, Felsenstein O, Dougherty DD, Widge AS, et al. Invasive Electrodes Identification and Labeling. GitHub Repository. 2017;https://gi. doi: 10.5281/zenodo.1078789 [DOI] [Google Scholar]
  • 41.Fischl B, van der Kouwe A, Destrieux C, Halgren E, Ségonne F, Salat DH, et al. Automatically Parcellating the Human Cerebral Cortex. Cerebral Cortex. 2004;14: 11–22. doi: 10.1093/cercor/bhg087 [DOI] [PubMed] [Google Scholar]
  • 42.Desikan RS, Ségonne F, Fischl B, Quinn BT, Dickerson BC, Blacker D, et al. An automated labeling system for subdividing the human cerebral cortex on MRI scans into gyral based regions of interest. NeuroImage. 2006;31: 968–980. doi: 10.1016/j.neuroimage.2006.01.021 [DOI] [PubMed] [Google Scholar]
  • 43.Holdgraf C, Appelhoff S, Bickel S, Bouchard K, D’Ambrosio S, David O, et al. iEEG-BIDS, extending the Brain Imaging Data Structure specification to human intracranial electrophysiology. Scientific data. 2019;6: 102. doi: 10.1038/s41597-019-0105-7 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 44.Segonne F, Dale AM, Busa E, Glessner M, Salat D, Hahn HK, et al. A hybrid approach to the skull stripping problem in MRI. NeuroImage. 2004;22: 1060–1075. doi: 10.1016/j.neuroimage.2004.03.032 [DOI] [PubMed] [Google Scholar]
  • 45.Sled JG, Zijdenbos AP, Evans AC. A nonparametric method for automatic correction of intensity nonuniformity in MRI data. IEEE Trans Med Imaging. 1998;17: 87–97. doi: 10.1109/42.668698 [DOI] [PubMed] [Google Scholar]
  • 46.Fischl B, Liu A, Dale AM. Automated manifold surgery: constructing geometrically accurate and topologically correct models of the human cerebral cortex. IEEE Medical Imaging. 2001;20: 70–80. doi: 10.1109/42.906426 [DOI] [PubMed] [Google Scholar]
  • 47.Reuter M, Fischl B. Avoiding Asymmetry-Induced Bias in Longitudinal Image Processing. NeuroImage. 2011;57: 19–21. doi: 10.1016/j.neuroimage.2011.02.076 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 48.Dale A, Fischl B, Sereno MI. Cortical Surface-Based Analysis: I. Segmentation and Surface Reconstruction. NeuroImage. 1999;9: 179–194. [DOI] [PubMed] [Google Scholar]
  • 49.Fischl B, Sereno MI, Dale A. Cortical Surface-Based Analysis: II: Inflation, Flattening, and a Surface-Based Coordinate System. NeuroImage. 1999;9: 195–207. [DOI] [PubMed] [Google Scholar]
  • 50.Segonne F, Pacheco J, Fischl B. Geometrically accurate topology-correction of cortical surfaces using nonseparating loops. IEEE Trans Med Imaging. 2007;26: 518–529. doi: 10.1109/TMI.2006.887364 [DOI] [PubMed] [Google Scholar]
  • 51.Fischl B, Sereno MI, Tootell RBH, Dale AM. High-resolution intersubject averaging and a coordinate system for the cortical surface. Human Brain Mapping. 1999;8: 272–284. doi: [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 52.Reuter M, Rosas HD, Fischl B. Highly Accurate Inverse Consistent Registration: A Robust Approach. NeuroImage. 2010;53: 1181–1196. doi: 10.1016/j.neuroimage.2010.07.020 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 53.Fischl B, Dale AM. Measuring the thickness of the human cerebral cortex from magnetic resonance images. Proceedings of the National Academy of Sciences of the United States of America. 2000;97: 11050–11055. doi: 10.1073/pnas.200033797 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 54.Rosas HD, Liu AK, Hersch S, Glessner M, Ferrante RJ, Salat DH, et al. Regional and progressive thinning of the cortical ribbon in Huntington’s disease. Neurology. 2002;58: 695–701. doi: 10.1212/wnl.58.5.695 [DOI] [PubMed] [Google Scholar]
  • 55.Kuperberg GR, Broome M, McGuire PK, David AS, Eddy M, Ozawa F, et al. Regionally localized thinning of the cerebral cortex in Schizophrenia. Archives of General Psychiatry. 2003;60: 878–888. doi: 10.1001/archpsyc.60.9.878 [DOI] [PubMed] [Google Scholar]
  • 56.Jovicich J, Czanner S, Greve D, Haley E, van der Kouwe A, Gollub R, et al. Reliability in multi-site structural MRI studies: Effects of gradient non-linearity correction on phantom and human data. NeuroImage. 2006;30: 436–443. doi: 10.1016/j.neuroimage.2005.09.046 [DOI] [PubMed] [Google Scholar]
  • 57.Han X, Jovicich J, Salat D, van der Kouwe A, Quinn B, Czanner S, et al. Reliability of MRI-derived measurements of human cerebral cortical thickness: The effects of field strength, scanner upgrade and manufacturer. NeuroImage. 2006;32: 180–194. doi: 10.1016/j.neuroimage.2006.02.051 [DOI] [PubMed] [Google Scholar]
  • 58.Fischl B, Salat DH, van der Kouwe AJW, Makris N, Ségonne F, Quinn BT, et al. Sequence-independent segmentation of magnetic resonance images. NeuroImage. 2004;23: S69–S84. doi: 10.1016/j.neuroimage.2004.07.016 [DOI] [PubMed] [Google Scholar]
  • 59.Salat D, Buckner RL, Snyder AZ, Greve DN, Desikan RS, Busa E, et al. Thinning of the cerebral cortex in aging. Cerebral Cortex. 2004;14: 721–730. doi: 10.1093/cercor/bhh032 [DOI] [PubMed] [Google Scholar]
  • 60.Fischl B, Salat DH, Busa E, Albert M, Dieterich M, Haselgrove C, et al. Whole brain segmentation: automated labeling of neuroanatomical structures in the human brain. Neuron. 2002;33: 341–355. doi: 10.1016/s0896-6273(02)00569-x [DOI] [PubMed] [Google Scholar]
  • 61.Reuter M, Schmansky NJ, Rosas HD, Fischl B. Within-Subject Template Estimation for Unbiased Longitudinal Image Analysis. NeuroImage. 2012;61: 1402–1418. doi: 10.1016/j.neuroimage.2012.02.084 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 62.Lancaster JL, Cykowski MD, McKay DR, Kochunov PV, Fox PT, Rogers W, et al. Anatomical global spatial normalization. Neuroinformatics. 2010;8: 171–182. doi: 10.1007/s12021-010-9074-x [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 63.Lancaster JL, McKay DR, Cykowski MD, Martinez MJ, Tan X, Valaparla S, et al. Automated analysis of fundamental features of brain structures. Neuroinformatics. 2011;9: 371–380. doi: 10.1007/s12021-011-9108-z [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 64.Lancaster JL, Laird AR, Eickhoff SB, Martinez MJ, Fox PM, Fox PT. Automated regional behavioral analysis for human brain images. Frontiers in Neuroinformatics. 2012;6: 1–12. doi: 10.3389/fninf.2012.00023 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 65.Hermes D, Miller KJ, Noordmans HJ, Vansteensel MJ, Ramsey NF. Automated electrocorticographic electrode localization on individually rendered brain surfaces. Journal of Neuroscience Methods. 2010;185: 293–298. doi: 10.1016/j.jneumeth.2009.10.005 [DOI] [PubMed] [Google Scholar]
  • 66.Yang AI, Wang X, Doyle WK, Halgren E, Carlson C, Belcher TL, et al. Localization of dense intracranial electrode arrays using magnetic resonance imaging. NeuroImage. 2012;63: 157–165. doi: 10.1016/j.neuroimage.2012.06.039 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 67.Community BO. Blender—a 3D modelling and rendering package. Stichting Blender Foundation, Amsterdam: Blender Foundation; 2018. Available: http://www.blender.org. [Google Scholar]
  • 68.Widge AS, Ellard KK, Paulk AC, Basu I, Yousefi A, Zorowitz S, et al. Treating refractory mental illness with closed-loop brain stimulation: Progress towards a patient-specific transdiagnostic approach. Experimental Neurology. 2017;287: 461–472. doi: 10.1016/j.expneurol.2016.07.021 [DOI] [PubMed] [Google Scholar]
  • 69.Provenza NR, Sheth SA, Rijn EMD, Mathura RK, Ding Y, Vogt GS, et al. Long-term ecological assessment of intracranial electrophysiology synchronized to behavioral markers in obsessive-compulsive disorder. Nature Medicine. 2021. doi: 10.1038/s41591-021-01550-z [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 70.Tzourio-Mazoyer N, Landeau B, Papathanassiou D, Crivello F, Etard O, Delcroix N, et al. Automated anatomical labeling of activations in SPM using a macroscopic anatomical parcellation of the MNI MRI single-subject brain. Neuroimage. 2002;15: 273–289. doi: 10.1006/nimg.2001.0978 [DOI] [PubMed] [Google Scholar]
  • 71.Sven. inpolyhedron—are points inside a triangulated volume? 2022. Available: https://www.mathworks.com/matlabcentral/fileexchange/37856-inpolyhedron-are-points-inside-a-triangulated-volume. [Google Scholar]
  • 72.Wilkinson MD, Dumontier M, Aalbersberg IjJ, Appleton G, Axton M, Baak A, et al. The FAIR Guiding Principles for scientific data management and stewardship. Scientific Data. 2016;3: 160018. doi: 10.1038/sdata.2016.18 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 73.Vinding MC, Oostenveld R. Sharing individualised template MRI data for MEG source reconstruction: A solution for open data while keeping subject confidentiality. NeuroImage. 2022;254: 119165. doi: 10.1016/j.neuroimage.2022.119165 [DOI] [PubMed] [Google Scholar]
  • 74.Theyers AE, Zamyadi M, O’Reilly M, Bartha R, Symons S, MacQueen GM, et al. Multisite Comparison of MRI Defacing Software Across Multiple Cohorts. Frontiers in Psychiatry. 2021;12. doi: 10.3389/fpsyt.2021.617997 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 75.Kleen JK, Speidel BA, Baud MO, Rao VR, Ammanuel SG, Hamilton LS, et al. Accuracy of omni-planar and surface casting of epileptiform activity for intracranial seizure localization. Epilepsia. 2021;62: 947–959. doi: 10.1111/epi.16841 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 76.Kwon H, Kronemer SI, Christison-Lagay KL, Khalaf A, Li J, Ding JZ, et al. Early Cortical Signals in Visual Stimulus Detection. NeuroImage. 2021;244: 118608. doi: 10.1016/j.neuroimage.2021.118608 [DOI] [PubMed] [Google Scholar]
  • 77.Fedorov A, Beichel R, Kalpathy-Cramer J, Finet J, Fillion-Robin J-C, Pujol S, et al. 3D Slicer as an image computing platform for the Quantitative Imaging Network. Magnetic resonance imaging. 2012;30: 1323–1341. doi: 10.1016/j.mri.2012.05.001 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 78.Desai SA, Gutekunst C-A, Potter SM, Gross RE. Deep brain stimulation macroelectrodes compared to multiple microelectrodes in rat hippocampus. Frontiers in Neuroengineering. 2014;7: 1–8. doi: 10.3389/fneng.2014.00016 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 79.Maggio F, Pasciuto T, Paffi A, Apollonio F, Parazzini M, Ravazzani P, et al. Micro vs macro electrode DBS stimulation: A dosimetric study. 2010 Annual International Conference of the IEEE Engineering in Medicine and Biology Society, EMBC’10. 2010; 2057–2060. doi: 10.1109/IEMBS.2010.5626487 [DOI] [PubMed] [Google Scholar]
  • 80.Martínez CGB, Niediek J, Mormann F, Andrzejak RG. Seizure Onset Zone Lateralization Using a Non-linear Analysis of Micro vs. Macro Electroencephalographic Recordings During Seizure-Free Stages of the Sleep-Wake Cycle From Epilepsy Patients. Frontiers in Neurology. 2020;11: 1–17. doi: 10.3389/fneur.2020.553885 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 81.Duncan D, Garner R, Brinkerhoff S, Walker HC, Pouratian N, Toga AW. Data Archive for the BRAIN Initiative (DABI). Scientific Data. 2023;10: 83. doi: 10.1038/s41597-023-01972-z [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 82.Yendiki A, Panneck P, Srinivasan P, Stevens A, Zöllei L, Augustinack J, et al. Automated Probabilistic Reconstruction of White-Matter Pathways in Health and Disease Using an Atlas of the Underlying Anatomy. Frontiers in Neuroinformatics. 2011;5. doi: 10.3389/fninf.2011.00023 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 83.Maffei C, Lee C, Planich M, Ramprasad M, Ravi N, Trainor D, et al. Using diffusion MRI data acquired with ultra-high gradient strength to improve tractography in routine-quality data. NeuroImage. 2021;245: 118706. doi: 10.1016/j.neuroimage.2021.118706 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 84.Kramer MA, Cash SS. Epilepsy as a Disorder of Cortical Network Organization. Neuroscientist. 2012;18: 360–372. doi: 10.1177/1073858411422754 [DOI] [PMC free article] [PubMed] [Google Scholar]

Decision Letter 0

Federico Giove

26 Jan 2023

PONE-D-22-33193Modular Pipeline for Reconstruction and Localization of Implanted Intracranial ECoG and sEEG ElectrodesPLOS ONE

Dear Dr. Soper,

Thank you for submitting your manuscript to PLOS ONE. After careful consideration, we feel that it has merit but does not fully meet PLOS ONE’s publication criteria as it currently stands. Therefore, we invite you to submit a revised version of the manuscript that addresses the points raised during the review process.

Your manuscript is of interest and certainly a welcome contribution to efforts at reproducible neuroscience. Reviewers raised a number of concerns/suggestions, that I ask to troughtfully consider and address.

In particular, address the concerns regarding validation, overal accuracy and limitations. Please clarify if/which parts of the protocol are newly introduced. Note that mere standardization of procedures already known is acceptable, but the distinction must be made clear to the reader.

Please diregard any comments regarding novelty and duplicate publication on protocols.io. They don't apply for your contribution.

Please submit your revised manuscript by Mar 05 2023 11:59PM. If you will need more time than this to complete your revisions, please reply to this message or contact the journal office at plosone@plos.org. When you're ready to submit your revision, log on to https://www.editorialmanager.com/pone/ and select the 'Submissions Needing Revision' folder to locate your manuscript file.

Please include the following items when submitting your revised manuscript:

  • A rebuttal letter that responds to each point raised by the academic editor and reviewer(s). You should upload this letter as a separate file labeled 'Response to Reviewers'.

  • A marked-up copy of your manuscript that highlights changes made to the original version. You should upload this as a separate file labeled 'Revised Manuscript with Track Changes'.

  • An unmarked version of your revised paper without tracked changes. You should upload this as a separate file labeled 'Manuscript'.

If you would like to make changes to your financial disclosure, please include your updated statement in your cover letter. Guidelines for resubmitting your figure files are available below the reviewer comments at the end of this letter.

If applicable, we recommend that you deposit your laboratory protocols in protocols.io to enhance the reproducibility of your results. Protocols.io assigns your protocol its own identifier (DOI) so that it can be cited independently in the future. For instructions see: https://journals.plos.org/plosone/s/submission-guidelines#loc-laboratory-protocols. Additionally, PLOS ONE offers an option for publishing peer-reviewed Lab Protocol articles, which describe protocols hosted on protocols.io. Read more information on sharing protocols at https://plos.org/protocols?utm_medium=editorial-email&utm_source=authorletters&utm_campaign=protocols.

We look forward to receiving your revised manuscript.

Kind regards,

Federico Giove, PhD

Academic Editor

PLOS ONE

Journal Requirements:

When submitting your revision, we need you to address these additional requirements.

1. Please ensure that your manuscript meets PLOS ONE's style requirements, including those for file naming. The PLOS ONE style templates can be found at 

https://journals.plos.org/plosone/s/file?id=wjVg/PLOSOne_formatting_sample_main_body.pdf and 

https://journals.plos.org/plosone/s/file?id=ba62/PLOSOne_formatting_sample_title_authors_affiliations.pdf

2. Our internal editors have looked over your manuscript and determined that it is within the scope of our Reproducibility and Replicability in Neuroscience and Mental Health Research Call for Papers. The Collection will encompass a diverse and interdisciplinary set of protocols and research articles adhering to transparent and reproducible reporting practices in the areas of clinical psychology, psychiatry, mental health, and neuroscience. Additional information can be found on our announcement page: https://collections.plos.org/call-for-papers/reproducibility-and-replicability-in-neuroscience-and-mental-health-research/. If you would like your manuscript to be considered for this collection, please let us know in your cover letter and we will ensure that your paper is treated as if you were responding to this call. If you would prefer to remove your manuscript from collection consideration, please specify this in the cover letter.

3. Please amend your current ethics statement to address the following concerns:

a) Did participants provide their written or verbal informed consent to participate in this study?

b) If consent was verbal, please explain i) why written consent was not obtained, ii) how you documented participant consent, and iii) whether the ethics committees/IRB approved this consent procedure.

4. We note that the grant information you provided in the ‘Funding Information’ and ‘Financial Disclosure’ sections do not match. 

When you resubmit, please ensure that you provide the correct grant numbers for the awards you received for your study in the ‘Funding Information’ section.

5. Thank you for stating the following in the Funding Section of your manuscript: 

"Support included Fonds de Recherche Santé Québec (FRSQ) postdoctoral fellowship to PS, Tiny Blue Dot foundation to SSC, DJS, DR, and ACP, SSC was funded by NIH grants NINDS R01- NS062092, 1K24NS088568, R01-NS079533, R01-NS072023, and Massachusetts General Hospital Executive Committee on Research (MGH-ECOR). Some of this research was sponsored by the U.S. Army Research Office and Defense Advanced Research Projects Agency (DARPA) under Cooperative Agreement Number W911NF-14-2-0045 issued by ARO contracting office in support of DARPA’s SUBNETS Program. The views and conclusions contained in this document are those of the authors and do not represent the official policies, either expressed or implied, of the funding sources."

We note that you have provided funding information that is not currently declared in your Funding Statement. However, funding information should not appear in the Acknowledgments section or other areas of your manuscript. We will only publish funding information present in the Funding Statement section of the online submission form. 

Please remove any funding-related text from the manuscript and let us know how you would like to update your Funding Statement. Currently, your Funding Statement reads as follows: 

"Support included Fonds de Recherche Santé Québec (FRSQ), https://frq.gouv.qc.ca/sante/, postdoctoral fellowship to PS.

Tiny Blue Dot foundation, https://www.tinybluedotfoundation.org/, to SSC, DJS, DR, and ACP. SSC was funded by NIH grants NINDS R01- NS062092, 1K24NS088568, R01-NS079533, R01-NS072023, and Massachusetts General Hospital Executive Committee on Research (MGH-ECOR). Some of this research was sponsored by the U.S. Army Research Office and Defense Advanced Research Projects Agency (DARPA), https://www.darpa.mil/, under Cooperative Agreement Number W911NF-14-2-0045 issued by ARO contracting office in support of DARPA’s SUBNETS Program. The views and conclusions contained in this document are those of the authors and do not represent the official policies, either expressed or implied, of the funding sources. The funders had and will not have a role in study design, data collection and analysis, decision to publish, or preparation of the manuscript."

Please include your amended statements within your cover letter; we will change the online submission form on your behalf.

6. We note that you have stated that you will provide repository information for your data at acceptance. Should your manuscript be accepted for publication, we will hold it until you provide the relevant accession numbers or DOIs necessary to access your data. If you wish to make changes to your Data Availability statement, please describe these changes in your cover letter and we will update your Data Availability statement to reflect the information you provide.

7. Your ethics statement should only appear in the Methods section of your manuscript. If your ethics statement is written in any section besides the Methods, please move it to the Methods section and delete it from any other section. Please ensure that your ethics statement is included in your manuscript, as the ethics statement entered into the online submission form will not be published alongside your manuscript. 

[Note: HTML markup is below. Please do not edit.]

Reviewers' comments:

Reviewer's Responses to Questions

Comments to the Author

1. Does the manuscript report a protocol which is of utility to the research community and adds value to the published literature?

Reviewer #1: Yes

Reviewer #2: Yes

Reviewer #3: Yes

Reviewer #4: No

**********

2. Has the protocol been described in sufficient detail?

To answer this question, please click the link to protocols.io in the Materials and Methods section of the manuscript (if a link has been provided) or consult the step-by-step protocol in the Supporting Information files.

The step-by-step protocol should contain sufficient detail for another researcher to be able to reproduce all experiments and analyses.

Reviewer #1: Partly

Reviewer #2: Partly

Reviewer #3: Yes

Reviewer #4: Partly

**********

3. Does the protocol describe a validated method?

The manuscript must demonstrate that the protocol achieves its intended purpose: either by containing appropriate validation data, or referencing at least one original research article in which the protocol was used to generate data.

Reviewer #1: No

Reviewer #2: No

Reviewer #3: Yes

Reviewer #4: Yes

**********

4. If the manuscript contains new data, have the authors made this data fully available?

The PLOS Data policy requires authors to make all data underlying the findings described in their manuscript fully available without restriction, with rare exception (please refer to the Data Availability Statement in the manuscript PDF file). The data should be provided as part of the manuscript or its supporting information, or deposited to a public repository. For example, in addition to summary statistics, the data points behind means, medians and variance measures should be available. If there are restrictions on publicly sharing data—e.g. participant privacy or use of data from a third party—those must be specified.

Reviewer #1: Yes

Reviewer #2: No

Reviewer #3: Yes

Reviewer #4: N/A

**********

5. Is the article presented in an intelligible fashion and written in standard English?

PLOS ONE does not copyedit accepted manuscripts, so the language in submitted articles must be clear, correct, and unambiguous. Any typographical or grammatical errors should be corrected at revision, so please highlight any specific errors that need correcting in the box below.

Reviewer #1: Yes

Reviewer #2: Yes

Reviewer #3: Yes

Reviewer #4: Yes

**********

6. Review Comments to the Author

Please use the space provided to explain your answers to the questions above. You may also include additional comments for the author, including concerns about dual publication, research ethics, or publication ethics. (Please upload your review as an attachment if it exceeds 20,000 characters)

Reviewer #1: The authors provide an overview of their software suite to enable intracranial electrode localization, visualization, and anatomical labeling. There are a lot of packages that do similar things, but theirs is particularly notable for the large number of patients it has been used on, providing output in BIDS format, and the large number of optional outputs (like each electrode's distance to the nearest gray/white junction). This will be a useful piece of software. But a few more things should be done with the paper first.

Nothing is currently done to validate any of the localizations. What is the gold standard here, and how do we know the software is performing correctly? Other papers have done things like compare expert anatomical labeling to the software (like a neuroradiologist) for a subset of patients.

A lot of the derived measurements, like Euclidean distances between electrodes, depend on accurate localization of the electrodes. But you can tell from the images that the SEEG contacts are probably not well localized. These linear devices have fixed inter-contact distances that can't be altered--the electrodes can bend but not compress or stretch. Fig. 4, for instance, shows several electrodes where the contacts are not colinear or on the same curved trajectory, but look "jaggedly" arranged. What do the authors make of this apparent error in the mapping?

One problem with all these software packages is that they lend a sense of exactitude to something that is not exact. This paper needs to spend some time talking about its limitations. Some examples are registration/fusion error, "snapping" grid electrodes to the brain surface (lots of error there), manually localization of SEEG contacts, and so on. Discussing these limitations is mandatory. Optional: To make a really great paper, the authors could assess the magnitude of these potential errors and quantify them. That way, when the software spits out a list of euclidean distances, it could also spit out a confidence interval, for example. This is similar to how they are ascribing the probability of an anatomical label. Steps like this would be amazing and really help the field.

The authors should do a more comprehensive job of listing the alternative software packages, their pros/cons, and how the current software package is different. Perhaps a table.

Some estimate of the time required to perform these steps is needed.

Some estimate of what kind of computer is required to perform these steps is needed. What are the minimum requirements?

More minor comments follow:

In lines 105-106, the authors equate grids and strips to ECoG and as something separate from SEEG. Electrocorticography means an electrical picture/drawing ('-graphy') from the cortex, which would describe most of SEEG too.

Line 175: Ad-Tech depth electrodes are 0.86 mm at the smallest, not 0.8 mm.

I did not review the Protocols.io document in detail, but it's wonderful that the authors included this supplement!

Step 1 needs more details on the expected imaging formats (NIFTI, DICOM, etc) and if there are any restrictions on DICOM headers (can they be anonymized?). Are there expected file names to identify each sequence? What are the minimum imaging resolutions required? What if there are multiple instances of the same sequence, like 2 versions of a post-op CT, one on post-op day 0 and one a few days later? Can both be used? Just in general more information is needed in this section, more than the single sentence there now

Lines 209-210 discuss needing an algorithm to map surface electrodes to the brain surface. More detail is needed here. Which algorithm is used and why that particular algorithm and not alternatives?

Reviewer #2: Summary: The authors describe a pipeline for localization of intracranial electrodes, implanted for diagnosing medically refractory epilepsy. The pipeline relies on basic functions from numerous other software packages. While it is potentially useful to have a pipeline such as this down on paper, the advances beyond the functions borrowed from other packages do not warrant the promotional style of writing. This reviewer is also unsure why this is being considered for publication at a journal, given that the protocol is already published with a DOI on protocols.io. The work doesn’t meet several of the criteria for publication as an article in PLoS ONE (original research not published elsewhere), but apparently these criteria do not apply for protocols? The major novel contribution of this work is the code that de-identifies images and formats them for BIDS.

Minor critiques:

- Line 116: It may be clearer to replace ‘implantation’ with ‘implanted electrodes’

- Line 152: ‘we remain in patient space’ should be reworded.

- Line 154: ‘alternations’ should be ‘alterations,’ I believe.

- The protocol relies on bash commands in linux, which limits its widespread utility.

- The protocol states the importance of the need to quickly generate co-registrations, but then uses recon-all in freesurfer, which takes tens of hours to run.

Major critiques:

- My major issue with this manuscript is stylistic. The manuscript too promotional in style. This is especially relevant given that the manuscript describes a protocol that is heavily based on functions from other widely used software packages.

- There are no example data provided to test the protocol. Given how heavily this work is based on other folks research, the least the authors can do is make it easy to test the protocol.

Reviewer #3: In this paper, a protocol proposed for localizing electrodes implanted in the brain which is accessible to multiple skill levels and modular in execution.

1) Step 5: Snapping the Electrode Grid

Please explain briefly in the text how the shift and compression in the brain as a result of the surgery will be compensated. It is not clear.

2) In Fig. 2, the electrode locations from the separate implants were mapped. Are you going to say that the method could identify electrodes sites which show epileptiform activity and consistent with what identified by board-certified epileptologists. From the signal recorded from each electrode, we could identify the seizure onset. Using the proposed algorithm, we could identify the electrode locations. What is consistency here? Different onset seizure locations were identified during different implants. How can we say consistent? Please clarify.

3) Fig. 2A correspond to what implant; first or second. Please clarify. Clarify what is RAH1 and RA1 in Fig. 2.

4) It was suggested that the region of seizure initiation may be more informative of different dynamics than the electrographic pattern at seizure onset (line 478). Please clarify how? How did you find it is more informative? What is PAC in Fig. 5? It seems to be phase amplitude coupling. It should be clarify in the Figure caption.

5) Fig. 4: Please clarity what is the right MRI plot in Fig 4E.

6) Define the abbreviations used in the text and figures.

7) The steps to identify the electrode position were presented in the paper. It would be very useful to provide the steps for installing the pipeline code and the required package and software. Does the pipeline code collect all the necessary codes in a single code?

Reviewer #4: Authors of “Modular pipeline for reconstruction and localization of implanted intracranial ECOG and sEEG electrodes”, describe a modular and extendable pipeline for processing, visualizing and analyzing intracranial data in human subjects – both electrocorticography strips/grids and stereoencephalography. Their manuscript proposes the combination of several long-established and some new programmatic routines to accomplish the processing/visualization steps. Importantly the proposed approach includes the ability to generate sharable data in NIH approved formats. This is a truly admirable effort to address many challenges for these types of data. My 3 primary concerns with the manuscript are 1) it was difficult to ascertain which aspects of the pipeline were derived from established software (seemed like most of the pipeline) versus the novel algorithms/programs generated by the authors, 2) there are many efforts that have attempted to address this challenge – maybe this would be more relevant for software only journal or as additional methods for a scientific manuscript that relies on this method 3), the method will be hard to follow; authors make an allusion to Lead-DBS as a comparison – Lead-DBS is a stand-alone Matlab program that does not require any additional downloads or programs and still has a highly active Slack channel for issues; secondly as a guide to the extent that this kind of work should be documented see Stolk et al., 2018 Nature Protocols (which is still not trivial to follow/replicate).

**********

7. PLOS authors have the option to publish the peer review history of their article (what does this mean?). If published, this will include your full peer review and any attached files.

If you choose “no”, your identity will remain anonymous but your review may still be made public.

Do you want your identity to be public for this peer review? For information about this choice, including consent withdrawal, please see our Privacy Policy.​

Reviewer #1: No

Reviewer #2: No

Reviewer #3: Yes: Abbas Erfanian

Reviewer #4: No

**********

[NOTE: If reviewer comments were submitted as an attachment file, they will be attached to this email and accessible via the submission site. Please log into your account, locate the manuscript record, and check for the action link "View Attachments". If this link does not appear, there are no attachment files.]

While revising your submission, please upload your figure files to the Preflight Analysis and Conversion Engine (PACE) digital diagnostic tool, https://pacev2.apexcovantage.com/. PACE helps ensure that figures meet PLOS requirements. To use PACE, you must first register as a user. Registration is free. Then, login and navigate to the UPLOAD tab, where you will find detailed instructions on how to use the tool. If you encounter any issues or have any questions when using PACE, please email PLOS at figures@plos.org. Please note that Supporting Information files do not need this step.

PLoS One. 2023 Jul 7;18(7):e0287921. doi: 10.1371/journal.pone.0287921.r002

Author response to Decision Letter 0


2 May 2023

Journal Requirements:

1. Please ensure that your manuscript meets PLOS ONE's style requirements, including those for file naming. The PLOS ONE style templates can be found at:

We have gone through and corrected the manuscript so that it meets the standards set by the PLOS ONE style guides.

2. Our internal editors have looked over your manuscript and determined that it is within the scope of our Reproducibility and Replicability in Neuroscience and Mental Health Research Call for Papers. The Collection will encompass a diverse and interdisciplinary set of protocols and research articles adhering to transparent and reproducible reporting practices in the areas of clinical psychology, psychiatry, mental health, and neuroscience. Additional information can be found on our announcement page: https://collections.plos.org/call-for-papers/reproducibility-and-replicability-in-neuroscience-and-mental-health-research/. If you would like your manuscript to be considered for this collection, please let us know in your cover letter and we will ensure that your paper is treated as if you were responding to this call. If you would prefer to remove your manuscript from collection consideration, please specify this in the cover letter.

We thank the editors very much for pointing out this call for papers which fits our protocol so well. We have indicated our desire to be considered for this “Reproducibility and Replicability in Neuroscience and Mental Health Research” collection in our cover letter.

3. Did participants provide their written or verbal informed consent to participate in this study?

The Ethics Statement was amended to clarify that the full consent process is both verbal and written in that the initiation of the consent process starts with a conversation with final consent given through a written form.

4. We note that the grant information you provided in the ‘Funding Information’ and ‘Financial Disclosure’ sections do not match. When you resubmit, please ensure that you provide the correct grant numbers for the awards you received for your study in the ‘Funding Information’ section.

We have checked the grant numbers and ensured that they are correct on re-submission.

5. We note that you have provided funding information that is not currently declared in your Funding Statement. However, funding information should not appear in the Acknowledgments section or other areas of your manuscript. We will only publish funding information present in the Funding Statement section of the online submission form. Please remove any funding-related text from the manuscript and let us know how you would like to update your Funding Statement. Please include your amended statements within your cover letter; we will change the online submission form on your behalf.

We have removed the Funding section in the manuscript and will include the amended statement in the Cover Letter.

6. We note that you have stated that you will provide repository information for your data at acceptance. Should your manuscript be accepted for publication, we will hold it until you provide the relevant accession numbers or DOIs necessary to access your data. If you wish to make changes to your Data Availability statement, please describe these changes in your cover letter and we will update your Data Availability statement to reflect the information you provide.

The data is available for a large subset of 52 patients (https://dabi.loni.usc.edu/dsi/W4SNQ7HR49RL), but we do not include all the outputs from the pipeline. We have therefore added data for two participants to a single repository (https://dabi.loni.usc.edu/dsi/R01NS062092) and have indicated as such in the manuscript.

7. Your ethics statement should only appear in the Methods section of your manuscript.

The ethics statement has been moved into the Methods section and deleted from any other section.

Reviewer 1

The authors provide an overview of their software suite to enable intracranial electrode localization, visualization, and anatomical labeling. There are a lot of packages that do similar things, but theirs is particularly notable for the large number of patients it has been used on, providing output in BIDS format, and the large number of optional outputs (like each electrode's distance to the nearest gray/white junction). This will be a useful piece of software. But a few more things should be done with the paper first.

We thank the reviewer for their positive comments and valuable input below; however, there is one point which we want to make clear. Specifically, we have attempted to clarify in the manuscript that this is a methodology and pipeline incorporating multiple software packages and is not a single software package. We realize this may be a limitation for some users and have highlighted this point in the updated “Limitations” section in the manuscript. We have found it beneficial to use multiple packages for different purposes to enable flexibility, modularity, and optional outputs which is why this protocol is not an all-in-one software package solution and has been useful for a number of different functions and a large data set over the years (N>260).

1. Nothing is currently done to validate any of the localizations. What is the gold standard here, and how do we know the software is performing correctly? (Other papers have done things like compare expert anatomical labeling to the software (like a neuroradiologist) for a subset of patients.

We thank the reviewer for their excellent point regarding the electrode localizations and labelling, particularly with regard to a gold standard for labeling. At one point, we did ask two experts (a neurologist and a psychiatrist) to examine the output which identified contact locations relative to the electrode localizations overlaid on the MRI brain. They both agreed that the labeling appeared accurate for 20 participants. Further, we developed two different approaches for identifying electrode locations (ELA and EVL) which, by and large, agree in electrode locations in grey matter. Some software packages perform validations by automatically detecting ‘bright’ spots from a postoperative CT and compare these relative to the RAS coordinates. We point to this option as a validation approach but, as we are not, for the most part, developing software in this manuscript, we did not implement this validation approach here. We refer to these approaches in the limitations sections as well as in the results.

We further asked two naïve users to perform electrode localization with the same data set to determine if there is user bias which could alter the locations (S3 Fig) and found across the board agreement between the new users and an experienced user (with average absolute differences pre contact at 0.97±0.55 mm). A final approach for validation would be to compare the electrode locations from post-operative MRIs where possible (which has been done in a subset of participants). This step, though, is the reason for the .pdf document we produce. In the .pdf output document, we are not making any assumptions regarding electrode location labeling per brain region but making it available for clinicians and experts to visually confirm electrode location.

2. A lot of the derived measurements, like Euclidean distances between electrodes, depend on accurate localization of the electrodes. But you can tell from the images that the SEEG contacts are probably not well localized. These linear devices have fixed inter-contact distances that can't be altered--the electrodes can bend but not compress or stretch.) Fig. 4, for instance, shows several electrodes where the contacts are not colinear or on the same curved trajectory, but look "jaggedly" arranged. What do the authors make of this apparent error in the mapping?

We thank the reviewer for their insightful comment. We agree that the contacts should have some constraints in that the inter-contact distances should not compress or stretch. However, as the manual step of electrode picking can be presented with challenges in that the contrast can be poor, the imaging artifact from the electrodes can be overwhelming, and the imaging quality can be low resolution, it is not entirely surprising that the jitter presented here can show up in the localizations. We have included more of these limitations in the manuscript itself. To get around this, several software packages attempt to include a best fit line (or a single vector as in Brainstorm) or use a 3D model of an electrode (such as in DBS within LeadDBS). In the past, we have also created 3D models of the cylinders of the electrode contacts which then can be modelled. We did not include these steps in this protocol but can if it is of use.

However, we were not as concerned about the jagged appearance as we also recognize there is some amount of error. The hope, then, was that the population-scale measures could reveal relationships between activity and electrode locations considering there will always be some error with these measures (in that the electrode could be in a slightly different location as time progresses). We have included this limitation in the manuscript as well.

3. One problem with all these software packages is that they lend a sense of exactitude to something that is not exact. This paper needs to spend some time talking about its limitations. Some examples are registration/fusion error, "snapping" grid electrodes to the brain surface (lots of error there), manually localization of SEEG contacts, and so on. Discussing these limitations is mandatory. Optional: To make a really great paper, the authors could assess the magnitude of these potential errors and quantify them. That way, when the software spits out a list of euclidean distances, it could also spit out a confidence interval, for example. This is similar to how they are ascribing the probability of an anatomical label. Steps like this would be amazing and really help the field.

The reviewer brings up an excellent point regarding confidence intervals and the usefulness of communicating the accuracy and precision or each measurement. We have expanded the limitations section of our manuscript to discuss these issues. We also tried to clarify that this manuscript is about sharing a methodology used in relatively large number of patients (N>260) to localize electrodes and less about the software development, particularly the use of the “snapping” grid approach. On this point in particular, there are other papers and methods which better detail this step which we now refer to in the manuscript, included in Table 2 and a detailed software flowchart in S1 Fig.

With regard to the idea of identifying the magnitude of the potential errors, we completely agree with the reviewer that producing confidence intervals which identify errors and probabilities would be an excellent study. However, we believe this approach is outside the scope of this manuscript currently as this is a protocol with the purpose of addressing “Reproducibility and Replicability in Neuroscience and Mental Health Research”, not necessarily a software development manuscript with validation. We have tried to further clarify this point throughout the manuscript.

4. The authors should do a more comprehensive job of listing the alternative software packages, their pros/cons, and how the current software package is different. Perhaps a table.

We thank the reviewer for their excellent suggestion on adding a table. We have included a table in the manuscript (Table 2) as well as flow chart of packages, alternatives, and outputs (S1 Fig). We also hope this table and flow chart figure can be used as further evidence to clarify that this is not a manuscript for detailing a single software package so much as an expandable methodology for addressing our various needs.

5. Some estimate of the time required to perform these steps is needed.

For each step in the manuscript, we added an estimated amount of time for each one, and for some we gave clarifying information about level of involvement.

6. Some estimate of what kind of computer is required to perform these steps is needed. What are the minimum requirements?

Thank you for pointing this issue out. We have included a list of requirements for a computer at the beginning of our Materials and methods section as listed below:

Line 210: “In terms of the necessary computational hardware to support this pipeline, the reconstruction steps using FreeSurfer are the most demanding. Therefore, we recommend that the system meet their requirements (https://surfer.nmr.mgh.harvard.edu/fswiki/rel7downloads) as the rest of the pipeline is less computationally intense. There are four main hardware requirements: (1) Intel processor supporting AVX instructions, (2) 8GB of RAM for the reconstruction, or 16GB of RAM for better graphical viewing, (3) a 3D graphics card with its own memory and accelerated OpenGL drivers, and finally (4) around 300MB of free hard drive space per processed subject.”

More minor comments follow:

1. In lines 105-106, the authors equate grids and strips to ECoG and as something separate from SEEG. Electrocorticography means an electrical picture/drawing ('-graphy') from the cortex, which would describe most of SEEG too.

We thank the reviewer for their input. We clarified in the manuscript (seen below) that, for this paper, we use ‘ECoG’ to refer to ECoG grids and strips which lay on the cortical surface, and ‘sEEG’ to refer to ECoG depths which aim for medial cortical/subcortical areas. We chose that separation as sEEG can be recording from subcortical structures as well which is why we separated the two designations.

Line 110: “These surgically implanted electrodes consist of two types: 1) contacts along thin tubes that extend into the brain (also intraparenchymal depths) targeting subcortical brain regions or deep cortical structures, which we call stereotactic electroencephalography (sEEG) electrodes, or 2) grids and strips on silastic sheets that lay on the cortical surface, which we call electrocorticography (ECoG) electrodes.”

2. Line 175: Ad-Tech depth electrodes are 0.86 mm at the smallest, not 0.8 mm.

We have changed the manuscript so that it states the more precise 0.86mm diameter.

3. Step 1 needs more details on the expected imaging formats (NIFTI, DICOM, etc) and if there are any restrictions on DICOM headers (can they be anonymized?). Are there expected file names to identify each sequence? What are the minimum imaging resolutions required? What if there are multiple instances of the same sequence, like 2 versions of a post-op CT, one on post-op day 0 and one a few days later? Can both be used? Just in general more information is needed in this section, more than the single sentence there now

Thank you for the input. The FreeSurfer software for running recon-all requires an MRI in the form of a NIFTI, DICOMS, or .MGZ images. The header information can be de-identified (and even de-faced), and we do this in our pipeline. For our pipeline, we expect that the MRI NIFTI be called ‘mri.nii’, though this is only a requirement in our MATLAB code for creating the .pdf visuals (step 6). The specifics of this are explained more clearly in our protocol.io submission. The minimum imaging resolution is set by FreeSurfer, so we can find and defer to the requirements by FreeSurfer (as listed in their website).

The questions concerning post-op CTs are unique to the needs of the user. Using the most recent Post-Operative CT imaging will arguably be more accurate considering brain shift should diminish over time. Our group’s standard operating procedure is to use the most recent CT. To use multiple CTs, you would need to run through Steps 3-7 with each CT and ensure that any subsequent CTs are co-registered accurately with the original structural T1 used with FreeSurfer. This process is in fact what we did for one of our Use Cases which involve mapping implants of different electrodes (separated by years) to the same preoperative MRI to see if there is colocalization of epileptiform activity (Fig 2). There is generally flexibility in this paradigm as long as the images are all registered to a single identified T1-weighted MRI. We included this information below:

Line 249: “A key point is that all the imaging is registered to a single identified pre-operative T1-weighted MRI scan. As such, if multiple CT scans are performed, each can be registered to the single pre-operative T1-weighted MRI scan sequentially such that the coordinates can be mapped to the same space.”

4. Lines 209-210 discuss needing an algorithm to map surface electrodes to the brain surface. More detail is needed here. Which algorithm is used and why that particular algorithm and not alternatives?

Thank you for this input. We would like to point out that there are are many methodologies for this and a number of publications and software packages to do this step. For our pipeline, we happen to use the methodology described by Dykstra et al. (2011) and incorporated into iELVIS out of convenience, as the basic pipeline developed in this lab was used to develop iELVis. However, many years ago, we tested multiple approaches in several patients using both the Yang et al. (2012) and Dykstra et al. (2011) projection methods and found that the Dykstra et al. approach was slightly easier to implement with better results (i.e., less likely to fail, better inter-contact spacing maintenance). Most of the alternative methods we discuss in this manuscript also use the Dykstra et al. projection method. Despite that, we think the reviewer’s suggestion is extremely important, so we have incorporated several references to other methods, if the reader is inclined.

Line 266: “Various researchers have identified algorithms to shift the electrodes to the surface of the brain while constraining the relationships between contacts, though these details are reported and validated elsewhere [21,65,66]. We use the extracted and smoothed surface of the pre-operative MRI as a target for snapping the grids and strips, specifically using the method detailed in Dykstra et al. [5]. This method was selected for its ease of use with the pipeline, but many other pipelines can handle this step as well if desired (Table 2, S1 Fig) [5,21,65,66].”

Reviewer 2

Summary: The authors describe a pipeline for localization of intracranial electrodes, implanted for diagnosing medically refractory epilepsy. The pipeline relies on basic functions from numerous other software packages. While it is potentially useful to have a pipeline such as this down on paper, the advances beyond the functions borrowed from other packages do not warrant the promotional style of writing. This reviewer is also unsure why this is being considered for publication at a journal, given that the protocol is already published with a DOI on protocols.io. The work doesn’t meet several of the criteria for publication as an article in PLoS ONE (original research not published elsewhere), but apparently these criteria do not apply for protocols? The major novel contribution of this work is the code that de-identifies images and formats them for BIDS.

We thank the reviewer for their input. We had hoped that, instead of being under the purview of original research, that this particular manuscript would fall under the category of “Reproducibility and Replicability in Neuroscience and Mental Health Research”. We therefore agree this manuscript is not original research so much as providing a methodology that can have multiple outputs depending on the user need. We attempt to clarify this point at multiple points in this revised manuscript.

Further, we have attempted, as best we could, to remove any language suggesting a ‘promotional’ style. This protocol and associated manuscript are simply a way to communicate a methodology and pipeline incorporating multiple software packages that has worked for a large data set (N>260) for several years with multiple users. As such, we agree it is not necessarily a novel contribution though, as per the purview of reproducibility, we hope the pipeline or parts of it can be of help to the community, particularly the flexibility and modularity of the protocol, video instructions of the steps involved (now incorporated into the updated protocos.io site), and shared code.

Minor critiques:

1. Line 116: It may be clearer to replace ‘implantation’ with ‘implanted electrodes’

Thank you for helping us to clarify this point. We have replaced ‘implantation’ with ‘implanted electrodes’.

2. Line 152: ‘we remain in patient space’ should be reworded.

We have specified that the images and coordinates are the things which remain in native space. We hope this clarifies our original intention.

3. Line 154: ‘alternations’ should be ‘alterations,’ I believe.

This has been corrected to ‘alterations’.

4. The protocol relies on bash commands in linux, which limits its widespread utility.

Though this is mainly a limitation of FreeSurfer, it certainly does affect the accessibility of this pipeline. That being said, it does still work with MacOS, and Windows has integrated Ubuntu terminals which can run FreeSurfer in a virtual environment (Install WSL | Microsoft Learn). Though it will be more difficult for users with only a dedicated Windows machine, there is still a documented path for FreeSurfer and this pipeline’s usage for them.

5. The protocol states the importance of the need to quickly generate co-registrations, but then uses recon-all in freesurfer, which takes tens of hours to run.

The reviewer makes an excellent point. The pipeline can quickly generate co-registrations and carry out the creation of visualizations without FreeSurfer. FreeSurfer simply allows for the 3D reconstruction and labelling of brain regions. If the user only requires the overlay of the electrode locations onto 2D representations of the MRI, the FreeSurfer step is not needed. To clarify this point, we added language and estimated times-to-complete for the different aspects of the pipeline so that it is clear that using the pipeline with FreeSurfer will take much longer. However, an important point is that the FreeSurfer step could also be performed before the implant surgery using the preoperative MRI scan. Therefore, the 3D aspects of the pipeline can still be run relatively quickly if the FreeSurfer is run before implant. We have added language to clarify that this is our use-case, but that users running through the pipeline after implant will need to budget extra time for 3D aspects.

Line 281: “This step is time-consuming and is not necessary if only the 2D visualizations from Step 6 are desired. However, there are different paths for different outputs associated with this pipeline which are detailed both in Table 1 and in two flow charts (Fig 1; S1 Fig). For the output from the “Basic” or “Advanced” pipelines, we find starting Step 2 as soon as possible, even before the initial electrode implant, can offset the amount of time the FreeSurfer pipeline takes.”

Major critiques:

1. My major issue with this manuscript is stylistic. The manuscript too promotional in style. This is especially relevant given that the manuscript describes a protocol that is heavily based on functions from other widely used software packages.

We thank the reviewer for their valuable feedback. We have gone through the manuscript in detail to decrease the amount of promotional statements and, in particular, made it more clear with regard to the limitations of these approaches. We also expanded our Limitations section and included Table 2 and S1 Fig which lists the software packages and useful functions each provide currently including alternatives and relevant pipeline outputs.

2. There are no example data provided to test the protocol. Given how heavily this work is based on other folks research, the least the authors can do is make it easy to test the protocol.

Thank you for this input. We have included example data to test the protocol which includes pre-operative and post-operative scans for two participants as well as the outputs from the pipeline as useful examples. This data is currently shared on the DABI website (https://dabi.loni.usc.edu/dsi/R01NS062092). Further, pre and postoperative scans as well as example FreeSurfer output along with the RAS coordinates relative to the T1 per participant are already available for a, large, deidentified data set for further tests (N=52; https://dabi.loni.usc.edu/dsi/W4SNQ7HR49RL).

Reviewer 3

In this paper, a protocol proposed for localizing electrodes implanted in the brain which is accessible to multiple skill levels and modular in execution.

We thank the reviewer for their detailed input and suggestions which we feel improve the manuscript.

1. Step 5: Snapping the Electrode Grid -- Please explain briefly in the text how the shift and compression in the brain as a result of the surgery will be compensated. It is not clear.

We thank the reviewer for their request. We have added more information in Step 5 regarding how compression in the brain is compensated with this current approach. We also detail some of the limitations of this approach in the manuscript.

2. In Fig. 2, the electrode locations from the separate implants were mapped. Are you going to say that the method could identify electrodes sites which show epileptiform activity and consistent with what identified by board-certified epileptologists. From the signal recorded from each electrode, we could identify the seizure onset. Using the proposed algorithm, we could identify the electrode locations. What is consistency here? Different onset seizure locations were identified during different implants. How can we say consistent? Please clarify.

We clarified our point and removed the term ‘consistent’. We were originally referring to the fact that, even though the recordings were from subdural strips and sEEG depth electrodes in implants separated by years, the same general region (the brain area near RAH1-2 and RSUB5-6) was active and produced epileptiform activity in the same area as identified by the clinical teams. As the electrodes were not placed in the exact same locations, we cannot definitively state that they are in the same spots, but we were highlighting how we could observe similar activity in the same general region. This information can be useful when discussing where the seizure onset zone could be or what areas of the brain are involved in the epileptiform network.

Line 418: “Mapping the electrode locations from the separate implants reveals if there was regional overlap of epileptiform activity in these two different intracranial investigations in the same participant. Even though the electrodes were different (sEEG vs ECoG strips) and in slightly different locations, the active sites identified as exhibiting epileptiform activity by the clinical team (including board-certified epileptologists) were in a similar area (the brain area near RAH1-2 in the second implant and RSUB5-6 in the first implant; Fig 2C). This information could be useful in discussing the epileptiform network as identified in the same participant.”

3. Fig. 2A correspond to what implant; first or second. Please clarify. Clarify what is RAH1 and RA1 in Fig. 2.

Thank you for the points. Fig. 2A refers to the second implant. RAH1 and RA1 are different depth electrodes which are then pictured in B. We have clarified these points in the manuscript and figure legend.

4. It was suggested that the region of seizure initiation may be more informative of different dynamics than the electrographic pattern at seizure onset (line 478). Please clarify how? How did you find it is more informative? What is PAC in Fig. 5? It seems to be phase amplitude coupling. It should be clarify in the Figure caption.

Thank you for this clarifying question. As the reviewer has suggested, the PAC stands for "phase-amplitude coupling". We have now added the abbreviations to the figure legend. Additionally, we have modified the main text to include a summary of the study as in the following:

Line 592: “For example, we have studied seizures recorded from 43 patients, and we used ELA to determine the brain region in which each electrode registering the seizure onset was most likely to be located in these patients. The seizures were classified based on (a) their electrographic pattern (e.g., low-voltage fast activity) at the onset and (b) the region (e.g., hippocampus, lateral temporal, etc.) from which the seizures originated. The phase-amplitude coupling (PAC) analysis showed that seizures originating from different regions might have more distinct PACs, and therefore the region of onset may distinctively impact the dynamics of seizure initiation. For instance, seizures with low-voltage fast activity at their onset have different PAC dynamics if they originate in the hippocampus versus lateral temporal regions (Fig. 5D)[6].”

5. Fig. 4: Please clarity what is the right MRI plot in Fig 4E.

Thank you for pointing this out to us. The right MRI plot in figure 4E was to demonstrate the extent of differences in the trajectory of depth electrodes for similar targets. We attempt to show that different trajectories result in different spreads of electrode localizations in areas such as grey matter, white matter, or outside the brain. We have clarified this in the text and figure.

6. Define the abbreviations used in the text and figures.

We have added more information and defined abbreviations in the manuscript.

7. The steps to identify the electrode position were presented in the paper. It would be very useful to provide the steps for installing the pipeline code and the required package and software. Does the pipeline code collect all the necessary codes in a single code?

Thank you for the inquiry. We have a detailed explanation of how to download the necessary code in the protocol.io submission made in tandem with this manuscript. We tried to keep all the processing code in the GitHub page made for this protocol pipeline. We also attempted to clarify that this pipeline involves multiple software packages which are dependent on user need and preferences, particularly dependent on the type of output the user requires. We have added a flow chart to better describe these steps in the manuscript and clarify what parts are needed for each step, including dependencies (S1 Fig).

For instance, there are two separate pipelines we are using for identifying electrode location relative to different brain regions and electrode labelling per brain region. In one pipeline, the code uses MMVT for the ELA mapping. In the other pipeline (EVL), the code uses various metrics within MATLAB along with Freesurfer and 3DSlicer for localizing the electrode location. We present code which then brings together these pipelines into a single script which we have run on multiple patients so far (N=23). We have attempted to clarify this point further in the manuscript at multiple points.

Reviewer 4

Authors of “Modular pipeline for reconstruction and localization of implanted intracranial ECOG and sEEG electrodes”, describe a modular and extendable pipeline for processing, visualizing and analyzing intracranial data in human subjects – both electrocorticography strips/grids and stereoencephalography. Their manuscript proposes the combination of several long-established and some new programmatic routines to accomplish the processing/visualization steps. Importantly the proposed approach includes the ability to generate sharable data in NIH approved formats. This is a truly admirable effort to address many challenges for these types of data.

We thank the reviewer for their positive comments and note of support.

My 3 primary concerns with the manuscript are:

1) It was difficult to ascertain which aspects of the pipeline were derived from established software (seemed like most of the pipeline) versus the novel algorithms/programs generated by the authors.

We thank the reviewer for making this point. As such, we created a flow chart in the manuscript (S1 Fig) and a table (Table 2) to better outline the parts which were established software versus code generated by ourselves. As this manuscript was meant to lay out a methodology incorporating multiple software packages, we attempt to make this goal clearer in the current manuscript at multiple points.

2) There are many efforts that have attempted to address this challenge – maybe this would be more relevant for software only journal or as additional methods for a scientific manuscript that relies on this method

We completely agree there are many attempts to address this challenge, particularly attempts which are all-in-one software packages which we refer to in the manuscript. Many of these packages are admirable and powerful in what they do. However, as illustrated in the table which we have now included (Table 2) and a flowchart (S1 Fig), several of the features we were hoping to use or have access to are not in the present software packages. Further, the main goal of this manuscript was to lay out a replicable and reproducible methodology highlighting using multiple software packages for the sake of flexibility and modularity in several cases and how this was used in our work over several years. We attempted to make this point clearer in the manuscript. As such, this manuscript is to detail the protocol, methodology, and use-cases for a pipeline applied to a large data set and falling under the of goals of “Reproducibility and Replicability in Neuroscience and Mental Health Research”. Further, while portions of this manuscript are mentioned in previous publications, we did not feel we could include the entirety of the approaches as supplemental methods in a purely scientific manuscript without obscuring a large number of details.

3) The method will be hard to follow; authors make an allusion to Lead-DBS as a comparison – Lead-DBS is a stand-alone Matlab program that does not require any additional downloads or programs and still has a highly active Slack channel for issues; secondly as a guide to the extent that this kind of work should be documented see Stolk et al., 2018 Nature Protocols (which is still not trivial to follow/replicate).

We thank the reviewer for the suggestions. To determine the level of difficulty for following this method and approach, we added two new users who have never dealt with this type of approach before (S3 Fig). Through their feedback, we believe we have improved the protocol as well as demonstrated that this is possible even for individuals who are naïve to the approach. Also, we added a table (Table 2) and a flow chart (S1 Fig) detailing these other software packages for easy comparison between established pipeline. Each of those self-contained software packages have benefits which we take advantage of and attempt to highlight in this methodology. Indeed, the purpose of this protocol is to offer a replicable and reproducible methodology to even naïve users with multiple outputs which is customizable to user needs. We are not trying to make an all-in-one software package, and we have attempted to make this clearer in the manuscript based on your recommendation. We have also incorporated the feedback from our naïve users to improve replicability of the protocol published on protocols.io.

Attachment

Submitted filename: Response to Reviewers.docx

Decision Letter 1

Federico Giove

15 Jun 2023

Modular pipeline for reconstruction and localization of implanted intracranial ECoG and sEEG electrodes

PONE-D-22-33193R1

Dear Dr. Soper,

We’re pleased to inform you that your manuscript has been judged scientifically suitable for publication and will be formally accepted for publication once it meets all outstanding technical requirements.

Within one week, you’ll receive an e-mail detailing the required amendments. When these have been addressed, you’ll receive a formal acceptance letter and your manuscript will be scheduled for publication.

An invoice for payment will follow shortly after the formal acceptance. To ensure an efficient process, please log into Editorial Manager at http://www.editorialmanager.com/pone/, click the 'Update My Information' link at the top of the page, and double check that your user information is up-to-date. If you have any billing related questions, please contact our Author Billing department directly at authorbilling@plos.org.

If your institution or institutions have a press office, please notify them about your upcoming paper to help maximize its impact. If they’ll be preparing press materials, please inform our press team as soon as possible -- no later than 48 hours after receiving the formal acceptance. Your manuscript will remain under strict press embargo until 2 pm Eastern Time on the date of publication. For more information, please contact onepress@plos.org.

Kind regards,

Federico Giove, PhD

Academic Editor

PLOS ONE

Additional Editor Comments (optional):

Reviewers' comments:

Reviewer's Responses to Questions

Comments to the Author

1. Does the manuscript report a protocol which is of utility to the research community and adds value to the published literature?

Reviewer #1: Yes

Reviewer #3: Yes

Reviewer #4: Yes

**********

2. Has the protocol been described in sufficient detail?

To answer this question, please click the link to protocols.io in the Materials and Methods section of the manuscript (if a link has been provided) or consult the step-by-step protocol in the Supporting Information files.

The step-by-step protocol should contain sufficient detail for another researcher to be able to reproduce all experiments and analyses.

Reviewer #1: Yes

Reviewer #3: Yes

Reviewer #4: Yes

**********

3. Does the protocol describe a validated method?

The manuscript must demonstrate that the protocol achieves its intended purpose: either by containing appropriate validation data, or referencing at least one original research article in which the protocol was used to generate data.

Reviewer #1: Yes

Reviewer #3: Yes

Reviewer #4: Yes

**********

4. If the manuscript contains new data, have the authors made this data fully available?

The PLOS Data policy requires authors to make all data underlying the findings described in their manuscript fully available without restriction, with rare exception (please refer to the Data Availability Statement in the manuscript PDF file). The data should be provided as part of the manuscript or its supporting information, or deposited to a public repository. For example, in addition to summary statistics, the data points behind means, medians and variance measures should be available. If there are restrictions on publicly sharing data—e.g. participant privacy or use of data from a third party—those must be specified.

Reviewer #1: Yes

Reviewer #3: N/A

Reviewer #4: Yes

**********

5. Is the article presented in an intelligible fashion and written in standard English?

PLOS ONE does not copyedit accepted manuscripts, so the language in submitted articles must be clear, correct, and unambiguous. Any typographical or grammatical errors should be corrected at revision, so please highlight any specific errors that need correcting in the box below.

Reviewer #1: Yes

Reviewer #3: Yes

Reviewer #4: Yes

**********

6. Review Comments to the Author

Please use the space provided to explain your answers to the questions above. You may also include additional comments for the author, including concerns about dual publication, research ethics, or publication ethics. (Please upload your review as an attachment if it exceeds 20,000 characters)

Reviewer #1: The authors have addressed my concerns. I am particularly pleased with the added validations that were done for the software's usability.

Reviewer #3: The authors have addressed all my concerns and those of the other reviewers very thoroughly and to

my satisfaction, and I recommend publication.

Reviewer #4: Authors have adequately addressed my comments. I do not have any additional comments for the authors.

**********

7. PLOS authors have the option to publish the peer review history of their article (what does this mean?). If published, this will include your full peer review and any attached files.

If you choose “no”, your identity will remain anonymous but your review may still be made public.

Do you want your identity to be public for this peer review? For information about this choice, including consent withdrawal, please see our Privacy Policy.

Reviewer #1: No

Reviewer #3: Yes: Abbas Erfanian

Reviewer #4: No

**********

Acceptance letter

Federico Giove

26 Jun 2023

PONE-D-22-33193R1

Modular pipeline for reconstruction and localization of implanted intracranial ECoG and sEEG electrodes

Dear Dr. Soper:

I'm pleased to inform you that your manuscript has been deemed suitable for publication in PLOS ONE. Congratulations! Your manuscript is now with our production department.

If your institution or institutions have a press office, please let them know about your upcoming paper now to help maximize its impact. If they'll be preparing press materials, please inform our press team within the next 48 hours. Your manuscript will remain under strict press embargo until 2 pm Eastern Time on the date of publication. For more information please contact onepress@plos.org.

If we can help with anything else, please email us at plosone@plos.org.

Thank you for submitting your work to PLOS ONE and supporting open access.

Kind regards,

PLOS ONE Editorial Office Staff

on behalf of

Dr. Federico Giove

Academic Editor

PLOS ONE

Associated Data

    This section collects any data citations, data availability statements, or supplementary materials included in this article.

    Supplementary Materials

    S1 Fig. Flowchart showing the pipeline steps with required software.

    (TIF)

    S2 Fig. Naïve users output for sub-0t3i compared to experienced user (DJS).

    (TIF)

    S1 File. Protocols.io pipeline publication PDF.

    (PDF)

    Attachment

    Submitted filename: Response to Reviewers.docx

    Data Availability Statement

    All relevant data for this study are publicly available in Data Archive BRAIN Initiative repository (https://doi.org/10.18120/gpgp-4r37).


    Articles from PLOS ONE are provided here courtesy of PLOS

    RESOURCES