Background/Objectives: To create an open-source method for reconstructing microelectrode recording (MER) and deep brain stimulation (DBS) electrode coordinates along multiple parallel trajectories with patient-specific DBS implantation platforms to facilitate DBS research. Methods: We combined the surgical geometry (extracted from WayPoint Planner), pre-/intra-/postoperative computed tomography (CT) and/or magnetic resonance (MR) images, and integrated them into the Analysis of Functional NeuroImages (AFNI) neuroimaging analysis environment using functions written in Python. Electrode coordinates were calculated from image-based electrode surfaces and recording trajectory depth values. Coordinates were translated into appropriate trajectories, and were tested for proximity to patient-specific or atlas-based anatomical structures. Final DBS electrode coordinates for 3 patient populations (ventral intermediate nucleus [VIM], subthalamic nucleus [STN], and globus pallidus pars interna [GPi]) were calculated. For STN cases, MER site coordinates were then analyzed to see whether they were inside or outside the STN. Results: Final DBS electrode coordinates were described for VIM, STN, and GPi patient populations. 115/169 (68%) STN MER sites were within 1 mm of the STN in AFNI’s Talairach and Tournoux (TT) atlas. Conclusions: DBStar is a robust tool kit for understanding the anatomical location and context of electrode locations, and can easily be used for imaging, behavioral, or electrophysiological analyses.
Deep brain stimulation (DBS) is a surgical therapy most often used for movement disorders such as Parkinson disease (PD), essential tremor (ET), and dystonia. Successful DBS surgery requires the placement of stimulating electrodes at specific target locations with millimeter accuracy. Part of this procedure can involve making microelectrode recordings (MER) along implantation trajectories to map neural activity from the awake patient. As baseline and task-related intraoperative electrophysiology provide valuable insight into both human neural functions and the therapeutic effects of DBS, there is a need to precisely determine MER locations to understand the anatomical context of intraoperative recording sites and final implantation locations .
Neurosurgeons have traditionally used stereotactic frames such as the Leksell (Elekta AB, Stockholm, Sweden) to guide electrode placement, but in the last decade, patient-customized platforms such as the STarFix microTargeting Platform (FHC Inc., Bowdoin, ME, USA) have increasingly been used . Custom-designed frames have demonstrated accuracy comparable to that of traditional stereotactic frames, and can reduce operating times by up to 2 h [2, 3]. However, while patient-specific frames provide clinical advantages, their flexible geometry poses a challenge for the postoperative reconstruction of recording locations. Specifically, the orientation of the Ben-Gun array for MER is predetermined by FHC’s platform creation software, with the surgeon’s planning accounting only for the center trajectory. Because the orientation of the array around the center trajectory is frame-dependent, the precise locations along noncenter trajectories are not explicitly described. While one can define recording depth coordinates along the center trajectory in the planning software, this is a manual and somewhat arbitrary process that reports coordinates based on idealized trajectories in preoperative images. In contrast, we sought to calculate MER coordinates based on the empirical location of coordinates within intra- or postoperative images, while systematically using the known spatial relationships between MER trajectories in the Ben-Gun array.
Previous DBS-related work with the open-source Analysis of Functional NeuroImages (AFNI) DBSproc Tool Kit has focused on registering different imaging modalities and extracting electrode locations from computed tomography (CT) or magnetic resonance (MR) images, with a focus on diffusion tensor imaging analyses [4-7]. Although this software allows for the image-based reconstruction of DBS electrode locations along the final electrode trajectory, it is currently not capable of reconstructing coordinates from additional parallel trajectories used throughout implantation surgery. However, trajectory geometry information created during surgical planning with WayPoint Planner software (FHC Inc.) allows for the patient-specific translation of coordinates into separate surgical trajectories.
We therefore expanded this tool kit by describing DBStar (targeting for DBS and STarFix), a software processing pipeline for calculating locations along the electrode implantation trajectories for postoperative analysis with the FHC/STarFix system. We provided initial validation with final DBS electrode placement coordinates in the ventral intermediate nucleus (VIM), subthalamic nucleus (STN), and globus pallidus pars interna (GPi). We also provided coordinate data for STN MER sites, used for clinical somatotopic assessments and behavioral tasks. We include here a Python software repository and sample data to share our work with the community.
All preoperative MR images were collected on the same 3.0-T Siemens Verio scanner (Siemens Healthcare USA, Malvern, PA, USA) at Rhode Island Hospital. T1-weighted (T1w) images were collected in an MPRAGE sequence (repetition time [TR]: 2,530 ms, echo time [TE]: 285 ms, matrix size: 512 × 512 voxels, 0.5 × 0.5 mm2 in-plane resolution, 224 sagittal slices, 1-mm slice thickness). T2w images were collected in a SPACE sequence (TR: 3,200 ms, TE: 409 ms, matrix size: 512 × 512 voxels, 0.5 × 0.5 mm2 in-plane resolution, 224 sagittal slices, 1-mm slice thickness).
Preoperative CT images were collected on a GE LightSpeed VCT (GE Healthcare, Chicago, IL, USA) multidetector scanner. Preoperative CT images were acquired with the following parameters: tube voltage, 120 kV; tube current, 186 mA; data acquisition diameter, 320 mm; reconstruction diameter, 250 mm; matrix size, 512 × 512 voxels; 0.488 × 0.488 mm2 in-plane resolution; 267 axial slices; 0.625-mm slice thickness. Some postoperative CT images were acquired with the same acquisition sequence, while others were downsampled to 36–42 thick-slice (5-mm coronal and axial slices, 0.445 × 0.445 mm2 in-plane resolution) volumes.
Intraoperative CT images were collected on a Mobius AIRO mobile multidetector scanner (Mobius Imaging, Shirley, MA, USA). They were acquired with the following parameters: tube voltage, 120 kV; tube current, 240 mA; data acquisition diameter, 1,331 mm; reconstruction diameter, 337 mm; matrix size, 512 × 512 voxels; 0.658 × 0.658 mm2 in-plane resolution; 182 axial slices; 1-mm slice thickness.
Postoperative MR images were collected on a 1.5-T Siemens Aera scanner (Siemens Healthcare). T1w images were collected in an MPRAGE sequence (TR: 2,300 ms, TE: 4.3 ms, matrix size: 256 × 256 voxels, 1.0 × 1.0 mm2 in-plane resolution, 183 axial slices, 1-mm slice thickness, specific absorption rate [SAR] < 0.1 W/kg, acquisition time: 7 min 30 s).
All patients consented to the surgical procedure and the associated research activities. All research protocols were approved by the Lifespan Institutional Review Board for human research. All patients underwent neuropsychiatric, physical therapy, speech/swallow, and neurological evaluation for DBS by the Rhode Island Hospital DBS Fast Track Clinic . Preoperative MR images were acquired around the time of the clinic visit. One week prior to DBS electrode implantation surgery, anchor screws were affixed to the patient’s skull, and a CT scan was acquired immediately afterwards. T1w (pre- and postgadolinium images to visualize the vasculature), T2w, and CT images underwent intensity-based rigid registration using a mutual information-based algorithm with the WayPoint Planner software. Anterior and posterior commissures (AC and PC) and the midsagittal plane were manually located on the T1w images. The surgical targets were then located on the T2w images, and the T1w postcontrast images were used to draw the trajectories. All surgical planning was performed by the surgeon (W.F.A.). A 3D model of the STarFix platform was then calculated and sent for 3D printing. The platform was sent back to the hospital a few days later, where it was sterilized prior to surgery.
Patients underwent electrode implantation surgery one week later under local anesthesia and mild initial sedation. Once the platform was affixed to the patient’s skull, 3–4 recording microelectrodes in a Ben-Gun cross-orientation (anterior, posterior, center, medial, and lateral) were placed through burr holes into the patient’s brain along the platform’s trajectory guides. Intraoperative neurophysiology was acquired using 1 or 2 synchronized NeuroOmega recording systems (Alpha Omega, Nazareth, Israel) from awake patients. Electrophysiology data were collected at semiregular intervals to functionally map the surgical trajectory, while extra time was spent at depths with good single-unit activity for clinical somatotopic assessments (passive/active movement of limbs, sensation, and light on the retina) and cognitive/behavioral tasks. During each recording event, depth values along the trajectory with respect to the planned target were recorded for postoperative analysis. Intraoperative CT images were acquired prior to implanting the final stimulating electrode to confirm proper location. After the final DBS electrodes were placed, patients underwent stimulation testing to observe the therapeutic benefit and any side effects. Final DBS electrode locations were adjusted as needed. Postoperative MR images were obtained 1 day after the electrode implantation operation, to confirm proper final DBS electrode location and screen for postoperative hemorrhage or infarct. Pulse generator batteries were placed 1 week after the DBS electrode implantation surgery.
After the operation, the plan used to generate the platform was loaded into the WayPoint Planner software v3.0 (FHC Inc., Fig. 1a). Image files in the Digital Imaging and Communications in Medicine (DICOM) format for each sequence (including intra- and/or postoperative images) were loaded into the plan, and then subsequently registered to the preoperative CT volume using the same intensity-based rigid registration algorithm. All registrations were visually inspected for proper alignment (Fig. 1b). After all images were registered to the original preoperative CT, the registration data were exported as a text file. This text file included each volume’s linear transformation matrix to the preoperative CT, as well as the planned trajectory information.
All DICOM images were reconstructed to 3-dimensional neuroimaging informatics technology initiative (NIFTI) volumes via the “dcm2nii” command from the MRIcron Tool Kit . Transformation matrices saved in the exported text file were then applied to the volumes using the AFNI command “3dAllineate,” bringing all volumes to a common space with the preoperative CT. The mid-commissural point (MCP) as determined from the surgical plan was then set as the coordinate origin for all transformed volumes. All registrations were again visually inspected (Fig. 1b).
For within-subject anatomical analyses, plan-registered preoperative T1w volumes were anatomically parcellated using the Freesurfer “recon-all” processing pipeline . All parcellations were visually inspected for accuracy by making sure mask voxels overlaid the appropriate anatomical structures. For group-level anatomic analyses, all plan-registered preoperative T1w volumes underwent nonlinear registration to the AFNI Talairach and Tournoux (TT) reference volume “TT_N27” using the “3dQWarp” command. However, any other AFNI atlas volume can be substituted. All transformed T1w volumes were visually inspected. Volume masks from the “TTatlas” dataset (in the TT_N27 atlas coordinate space) were used for anatomical validation of the coordinates [11, 12].
Three-dimensional surfaces were generated from intra- or postoperative images using the AFNI command “@eproc,” by methods described previously . Intra- or postoperative CT or MR images were used for electrode surface reconstruction using intensity-based thresholding, with the MR images requiring an intensity inversion step beforehand (Fig. 1c). Although all intra- or postoperative images can be used for calculating either recording or final coordinates, we chose to calculate MER coordinates from intraoperative CT images and final DBS coordinates from postoperative MR images when possible, as these were the images closest in time for each type of electrode. Using the contrast inherent in the images containing metallic electrodes, the software defined candidates for electrodes as objects > 35 mm in length along their principal axis closest to the coordinate z axis (vertical axis). All electrode segmentations were manually reviewed, and then generated as volumes for further analysis using the AFNI command “3dcalc” (Fig. 1d). Each selected electrode surface was collapsed into a principal axis, upon which each surface node was projected (Fig. 1d–f). In other words, each node of the electrode surface has an assigned trajectory depth.
Recording or final trajectory depth values collected during the operation were then placed along this principal axis, using offsets specific to each type of electrode captured in the image (Fig. 1g). For example, the coordinates for a MER site 3.17 mm above the surgical target was calculated from intra- and/or postoperative electrode surfaces. To accurately calculate coordinates from intraoperative electrode surfaces, we specified how many trajectories were visible in the image and the trajectory depth of the electrodes when the CT was acquired. Macroelectrode coordinates can also be calculated by adding a simple micro-to-macro offset value (3 mm above micro for AlphaOmega electrodes). For postoperative images, a 1.5-mm offset for the DBS electrode tip (and the position and depth along the recording trajectory at which it was placed) was used for the postoperative images containing DBS electrodes (DBS 3387 or 3389, Medtronic, Minneapolis, MN, USA).
A 3-dimensional coordinate relative to the MCP was then calculated, by taking the average of the surface node coordinates within a 2-mm window (1 mm above and below) centered at the recording or final depth (Fig. 1h, i). Based on the trajectory or trajectories represented in the electrode-containing volume and the patient-specific implantation angles, the depth coordinate could then be translated to any of the other Ben-Gun electrode trajectories (Fig. 1j, k). Once depth coordinates are calculated, their location within the patient-specific anatomic parcellation can be queried. Patient-specific depth coordinates can also be transformed to a standard atlas volume for understanding within-group coordinate distribution. Similar anatomic contextualizing of coordinates can also be performed within the atlas volume using preexisting volume masks.
DBStar code and documentation can be downloaded from: https://bitbucket.org/asaadneurolab/dbstar.
Anatomic Validation Analyses
For each surgical target population, the final location coordinate was defined as the bottom of contact 0 in the DBS electrode. We compiled the lateral, anterior-posterior, and vertical locations of each target population, both in their native coordinate space and in the TT_N27 coordinate space. The center coordinates of DBS contacts 0 and 3 (the ventral- and dorsal-most contacts, respectively) were also calculated based on Medtronic 3389 (STN patients) or 3387 (VIM and GPi patients) electrode geometry. Center-of-mass coordinates from the most appropriate TT atlas structure were given to provide the context. The center of mass of each anatomical volume (Freesurfer or TT atlas) was calculated using the AFNI command “3dCM.”
Coordinates of STN MER sites were compared to the STN center of mass to investigate the locations of recording sites, as this was our largest patient population. The differences along the horizontal, anterior-posterior, and vertical axes for each MER coordinate to the center-of-mass coordinate were calculated, in addition to the Euclidean distance. MER site coordinates were then localized on both native parcellation and predefined atlas volumes. Because Freesurfer’s most specific STN-containing structure is the ventral diencephalon (ventral DC), which contains several other midbrain structures, we only report the TT atlas results. Atlas-warped MER coordinates were queried against the “TTatlas” using AFNI’s “whereami” command. A coordinate was considered “in target” if any part of the atlas STN volume (“left/right subthalamic nucleus”) was present within a 1-mm radius of the coordinate. STN MER site coordinates “in target” were compared with those “out of target.”
All patients underwent DBS evaluation and implantation at Rhode Island Hospital in 2013–2016. Demographic data for STN (n = 13), VIM (n = 10), and GPi (n = 10) DBS patients are described in Table 1.
Final Target Anatomic Validation with STN, VIM, and GPi Datasets
The final DBS electrode coordinates for STN patients were 10.82 ± 1.55 mm lateral, 3.48 ± 1.49 mm posterior, and 5.10 ± 1.87 mm inferior to the MCP in native coordinate space. The atlas-warped STN final implantation coordinates were 11.12 ± 1.98 mm lateral, 0.89 ± 1.14 mm posterior, and 5.57 ± 1.65 mm inferior to the atlas MCP (Fig. 2). For reference, the TT atlas STN center-of-mass coordinate was 10.15 mm lateral, 1.60 mm posterior, and 3.05 mm inferior to the atlas MCP.
The final DBS electrode coordinates for VIM patients were 11.75 ± 1.65 mm lateral, 6.63 ± 1.57 mm posterior, and 0.73 ± 2.06 mm superior to the MCP in native coordinate space. The atlas-warped VIM final implantation coordinates were 11.74 ± 1.78 mm lateral, 4.25 ± 1.66 mm posterior, and 0.10 ± 2.71 mm inferior to the atlas MCP. For VIM, the closest match in TT atlas was the ventral lateral nucleus, whose center-of-mass coordinate was 13.60 mm lateral, 0.79 mm posterior, and 9.45 mm superior to the atlas MCP.
The final DBS electrode coordinates for GPi patients were 19.18 ± 1.42 mm lateral, 2.96 ± 1.41 mm anterior, and 2.18 ± 2.68 mm inferior to the MCP in native coordinate space. The atlas-warped GPi final implantation coordinates were 19.95 ± 2.31 mm lateral, 3.32 ± 1.58 mm anterior, and 2.22 ± 2.04 mm inferior to the atlas MCP. The TT atlas GPi center-of-mass coordinate was 14.73 mm lateral, 7.40 mm anterior, and 1.87 mm inferior to the atlas MCP.
STN Recording Site Validation
One hundred and sixty-nine atlas-warped MER site coordinates used for behavioral task recordings of the STN were included. Table 4 shows the resulting MER site coordinates for all recordings, and those within or outside of the STN. Taken together, all recording sites (n = 169) were 2.29 ± 1.43 mm lateral, 2.76 ± 2.10 mm anterior, and 0.68 ± 1.66 mm superior to the STN center of mass, with a Euclidean distance of 4.44 ± 1.68 mm (Fig. 3a).
One hundred and fifteen of the 169 (68%) MER site coordinates were found to be within 1 mm of the TT atlas STN volume. MER sites within the STN (n = 115) were found to be 1.92 ± 1.44 mm lateral, 1.91 ± 1.55 mm anterior, and 0.86 ± 1.58 mm superior to the STN center of mass, with a Euclidean distance of 3.66 ± 1.24 mm (Fig. 3b). MER sites outside the STN (n = 54) were found to be 3.10 ± 1.05 mm lateral, 4.57 ± 1.98 mm anterior, and 0.29 ± 1.77 mm superior to the STN center of mass, with a Euclidean distance of 6.09 ± 1.24 mm. Note that the observation that some recording sites fell outside the STN was expected, given the use of multiple simultaneous trajectories controlled by a single microdrive.
We demonstrate here an open-source tool kit that reliably reconstructs microelectrode and DBS electrode locations using the patient-specific geometry of a custom STarFix platform. Coordinates can be calculated either in a patient’s native AC-PC space or in an atlas space for group-level analysis. Both native and atlas coordinates can be placed in an anatomical context by using either segmented volumes from a Freesurfer-parcellated patient’s T1w volume, or anatomical masks from a standard atlas.
MER site coordinates based on trajectory depth values collected during several surgical STN cases were consistently calculated to be located nearby the appropriate target structure, as verified by the external AFNI TT atlas. In addition, the topological distribution of MER sites on a target structure (i.e., dorsolateral STN) could be investigated by recalculating coordinates relative to a target’s center of mass. Furthermore, AFNI’s “whereami” function was integrated to provide a quick measure of a coordinate’s proximity to a target structure, providing a principled method to sort through MER sites during analysis.
Comparisons between coordinates can easily be made by grouping them based on the “whereami” results or by behavioral task or clinical outcome data. The software package also includes tools for reporting and consolidating coordinate results in OpenDocument spreadsheet format (ods). It also includes functions and syntax for quickly producing group-level figures based on desired patients and coordinates. In addition, the AFNI neuroimaging open software platform allows for the integration of other datasets, including electrophysiology, behavior, and diffusion or other neuroimaging datasets. Specifically, tractography or volume of tissue activation analyses can be performed with DBSproc once DBStar has determined the coordinates. While our results here are limited to one atlas, the AFNI platform also allows for the creation of other atlases, which could be customized specifically for DBS patient populations. If the STarFix (or a similar) system is used in nonhuman primate research, AFNI macaque atlases can also be used . Finally, while our study was based on the use of the STarFix platform, the workflow and algorithms presented here can be adapted for other stereotactic frames as well.
Overall, our method for reconstructing electrode positions is robust. Electrode coordinates are determined by a collection of interrelated data: surgical trajectory depth, the trajectory/trajectories represented in the image, the type of electrode represented in the image, and the position of the electrode in an image. Together, these data create a principled coordinate that best reflects clinical reality. While electrodes in intra- or postoperative images (CT or MRI) provide the starting point for calculating recording or implantation coordinates, using previously determined anatomical features (AC and PC) and trajectory angles reduces the variability inherent in any imaging-based coordinate reconstruction. The tool kit includes options for different types of Medtronic and AlphaOmega electrodes, but can easily be expanded.
Although our reconstruction is principled and preliminary results show correspondence with the clinical standard-of-care, there is no “gold standard” (other than postmortem histology) for verifying these results [14-16]. In addition, our intrapatient linear registration methods did not take pneumocephalus-related intraoperative brain shift into account. While a great effort has been made to understand the causes and consequences of brain shift on electrode location, we presently have no automated method to calculate the extent of pneumocephalus in intraoperative images and apply the brain shift to our coordinates in a principled manner [3, 17-20]. Future releases will seek to integrate brain shift calculations with the calculation of electrocorticography contact coordinates.
Regardless, we believe our methods are robust and consistent. While there are other software packages that offer similar image registration and electrode contact reconstruction for DBS research, the AFNI/DBStar platform is the only free, open-source software package to use the patient-specific geometry of a STarFix platform to guide contact coordinate calculation across multiple trajectories [21, 22]. This method can be performed independently of patient outcomes, and can thus help inform studies that compare effectiveness at different surgical sites. We hope this software will be used to integrate clinical, neurophysiological, and anatomical data in order to better understand the therapeutic mechanisms of DBS.
Neurophysiological data collection for research was supported by a Doris Duke Clinical Scientist development award (W.F.A.).
Funding for P.M.L. was provided by an NHLBI T35 HL094308 training grant.