• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.


Brainshift Correction Methods

Page history last edited by David Groppe 1 year ago

The iELVis toolbox currently supports two methods for correcting subdural electrode locations for postimplant brainshift (Dykstra et al., 2011; Yang, Wang, et al., 2011). Both methods project the postimplant locations to the preimplant FreeSurfer dural (i.e., smoothed pial) surface but they do this in slightly different ways. This page summarizes those differences and provides some additional details on how to use the algorithms in practice.


A. The Dykstra et al. Method

This method (illustrated in the figure below) projects each subdural electrode to the dural surface using an iterative optimization algorithm that attempts to minimize the change in each electrode's location and the distance between it and its four closest neighbors. This function also has the option to simply assign each subdural electrode to the nearest vertex on the dural surface in case the optimization performs poorly.

(A) The preoperative MRI is coregistered with the postoperative CT volume. The lower panel shows the maximal intensity projection of the CT volume in the sagittal dimension, which shows all the electrodes in a sagittal plane. (B) Due to the parenchymal shift from the implant procedure, some electrodes initially appear as though buried in the gray matter. To correct for this, each electrode coordinate is projected first to a smoothed pial surface (effectively a dural surface) and subsequently back to the pial surface.


When the optimization procedure runs the diagnostic plot below is produced:

?? Andy can you explain what each plot means here.



B. The Yang, Wang et al. Method

  • Strip Electrodes: For strip electrodes, this method simply assigns them to the nearest point on the preimplant dural surface.
  • Grid Electrodes: For grids, the user needs to specify the grid dimensions and the locations of the electrodes that compose the four corners of the grid. The corners are then projected to the dural surface via an inverse gnomic projection and the locations of the other electrodes in the grid are inferred based on the known spacing between electrodes (as illustrated in the Figure below).


Complete procedure for localization of grids from pre- and post-implant MR images. Post-implant MR image (B) is co-registered to the pre-implant MR image (A) using a rigid-body transformation. Widespread artifacts referred to as “black holes” surround each electrode of the dense grid, prohibiting unambiguous identification of all electrodes. Therefore, the co-registered image (D) is used to manually determine the xyz coordinates of two electrodes that are easily identifiable (yellow lines guide this procedure on simultaneous sagittal, axial, and coronal sections). These coordinates are in the same space as the smoothed pial surface reconstruction (C). The remaining electrodes are interpolated on a flat surface traversing the pial surface, referred to as the map plane (E). The two manually-localized electrodes on diagonal corners (blue) are on the cortical surface while the remaining electrodes (black) are either above or below the surface. Note that the entire lateral surface of the cortical hemisphere is shown here for illustrative purposes. The coordinates of the remaining electrodes are calculated using the inverse of the gnomonic projection to “fold” the grid onto the smoothed pial surface. Visualization is made on the subject-specific gyral surface (F). From Yang, Wang, et al. (2011).



Note a couple of particulars of Xiuyan Wang's Matlab code that implements his method: 

  • It requires a compiled Matlab executable file, fastmarch_mex.mexa64. The version of this file in the iELVis repo may not be compatible with your computer's operating system. If that's the case you will need to create a new mex file using the raw c++ code.
  • For each grid you need to be able to specify the number of rows and columns and the #'s of the corners (starting at 1 and going counterclockwise).
  • If you have a non-rectangular grid, you need to break it up into small rectangular grids in the mgrid file.
  • When you run yangWangElecPjct.m on subdural grids it does the inverse gnomic projection using a range of parameters and attempts to automatically select the best one according to two criteria that are visualized the plot it produces (see below figure). The left subplot shows in the blue the difference between the Euclidean distance between each grid electrode and its neighbors and the known distance if the grid were laying flat. The right subplot shows the standard deviation of the distances between electrode and its nearest neighbor. First, the code looks to see if any parameter produces brain shift corrected locations deviate from the flat electrode distances below a given threshold (left plot). If any parameters satisfy this threshold, the parameter that produces the smallest deviation is selected. If no parameters satisfy this threshold (as in the plot below), the code looks to see if any parameter produces a sufficiently small variation in inter-electrode distances (right plot). If any parameters satisfy this threshold, the parameter that produces the smallest variation is selected. If this fails, then the user is asked to chose the best parameter in the MATLAB command line.




Dykstra, A. R., Chan, A. M., Quinn, B. T., Zepeda, R., Keller, C. J., Cormier, J., et al. (2011). Individualized localization and cortical surface-based registration of intracranial electrodes. NeuroImage, 1–42. doi:10.1016/j.neuroimage.2011.11.046


Yang, A. I., Wang, X., Doyle, W. K., Halgren, E., Carlson, C., Belcher, T. L., et al. (2012). Localization of dense intracranial electrode arrays using magnetic resonance imaging. NeuroImage, 63(1), 157–165. doi:10.1016/j.neuroimage.2012.06.039

Comments (0)

You don't have permission to comment on this page.