Human intracranial electroencephalography (iEEG) recordings provide data with much greater spatiotemporal precision than is possible from data obtained using scalp EEG, magnetoencephalography (MEG), or functional MRI. Until recently, the fusion of anatomical data (MRI and computed tomography (CT) images) with electrophysiological data and their subsequent analysis have required the use of technologically and conceptually challenging combinations of software. Here, we describe a comprehensive protocol that enables complex raw human iEEG data to be converted into more readily comprehensible illustrative representations. The protocol uses an open-source toolbox for electrophysiological data analysis (FieldTrip). This allows iEEG researchers to build on a continuously growing body of scriptable and reproducible analysis methods that, over the past decade, have been developed and used by a large research community. In this protocol, we describe how to analyze complex iEEG datasets by providing an intuitive and rapid approach that can handle both neuroanatomical information and large electrophysiological datasets. We provide a worked example using an example dataset. We also explain how to automate the protocol and adjust the settings to enable analysis of iEEG datasets with other characteristics. The protocol can be implemented by a graduate student or postdoctoral fellow with minimal MATLAB experience and takes approximately an hour to execute, excluding the automated cortical surface extraction.

Access optionsAccess options

Rent or Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Additional information

Publisher’s note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

1. Zheng, J. et al. Nat. Commun. 8, 14413 (2017): http://dx.doi.org/10.1038/ncomms14413

2. Piai et al. Proc. Natl. Acad. Sci. USA 113, 11366–11371 (2016): http://dx.doi.org/10.1073/pnas.1603312113


  1. 1.

    Buzsaki, G., Anastassiou, C. A. & Koch, C. The origin of extracellular fields and currents--EEG, ECoG, LFP and spikes. Nat. Rev. Neurosci. 13, 407–420 (2012).

  2. 2.

    Malmivuo, J. & Plonsey, R. Bioelectromagnetism: Principles and Applications of Bioelectric and Biomagnetic Fields. Bioelectromagnetism: Principles and Applications of Bioelectric and Biomagnetic Fields (Oxford University Press, New York, 2012).

  3. 3.

    Brunner, P. et al. A practical procedure for real-time functional mapping of eloquent cortex using electrocorticographic signals in humans. Epilepsy Behav. 15, 278–286 (2009).

  4. 4.

    Ritaccio, A. et al. Proceedings of the fifth international workshop on advances in electrocorticography. Epilepsy Behav. 41, 183–92 (2014)

  5. 5.

    Lachaux, J.-P., Axmacher, N., Mormann, F., Halgren, E. & Crone, N. E. High-frequency neural activity and human cognition: past, present and possible future of intracranial EEG research. Prog. Neurobiol. 98, 279–301 (2012).

  6. 6.

    Friston, J. A. & Friston, K. Multimodal image coregistration and partitioning - a unified fFramework. Neuroimage 6, 209–217 (1997).

  7. 7.

    Jenkinson, M., Bannister, P., Brady, M. & Smith, S. Improved optimization for the robust and accurate linear registration and motion correction of brain images. Neuroimage 17, 825–841 (2002).

  8. 8.

    Cox, R. W. AFNI: software for analysis and visualization of functional magnetic resonance neuroimages. Comput. Biomed. Res. 29, 162–73 (1996).

  9. 9.

    Papademetris, X. et al. BioImage suite: an integrated medical image analysis suite: an update. Insight J. 2006, 209 (2006).

  10. 10.

    Azarion, A. A. et al. An open-source automated platform for three-dimensional visualization of subdural electrodes using CT-MRI coregistration. Epilepsia 55, 2028–2037 (2014).

  11. 11.

    Blenkmann, A. O. et al. iElectrodes: a comprehensive open-source Toolbox for depth and subdural grid electrode localization. Front. Neuroinform. 11, 14 (2017).

  12. 12.

    Groppe, D. M. et al. iELVis: an open source MATLAB toolbox for localizing and visualizing human intracranial electrode data. J. Neurosci. Methods 281, 40–48 (2017).

  13. 13.

    Kubanek, J. & Schalk, G. NeuralAct: a tool to visualize electrocortical (ECoG) activity on a three-dimensional model of the cortex. Neuroinformatics 13, 167–174 (2015).

  14. 14.

    Qin, C. et al. Automatic and precise localization and cortical labeling of subdural and depth intracranial electrodes. Front. Neuroinform. 11, 1–10 (2017).

  15. 15.

    Hill, N. J. et al. Recording human electrocorticographic (ECoG) signals for neuroscientific research and real-time functional cortical mapping. J. Vis. Exp. https://doi.org/10.3791/3993(2012).

  16. 16.

    LaPlante, R. A. et al. The interactive electrode localization utility: software for automatic sorting and labeling of intracranial subdural electrodes. Int. J. Comput. Assist. Radiol. Surg. 12, 1829–1837 (2017).

  17. 17.

    Branco, M. P. et al. ALICE: a tool for automatic localization of intra-cranial electrodes for clinical and high-density grids. J. Neurosci. Methods 301, 43–51 (2018).

  18. 18.

    Eglen, S. J. et al. Toward standard practices for sharing computer code and programs in neuroscience. Nat. Neurosci. 20, 770–773 (2017).

  19. 19.

    Delorme, A. & Makeig, S. EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics including independent component analysis. J. Neurosci. Methods 134, 9–21 (2004).

  20. 20.

    Zheng, J. et al. Amygdala-hippocampal dynamics during salient information processing. Nat. Commun. 8, 14413 (2017).

  21. 21.

    Tang, C., Hamilton, L. S. & Chang, E. F. Intonational speech prosody encoding in the human auditory cortex. Science 357, 797–801 (2017).

  22. 22.

    Martinet, L.-E. et al. Human seizures couple across spatial scales through travelling wave dynamics. Nat. Commun. 8, 14896 (2017).

  23. 23.

    Gelinas, J. N., Khodagholy, D., Thesen, T., Devinsky, O. & Buzsáki, G. Interictal epileptiform discharges induce hippocampal–cortical coupling in temporal lobe epilepsy. Nat. Med. 22, 641–648 (2016).

  24. 24.

    Piai, V. et al. Direct brain recordings reveal hippocampal rhythm underpinnings of language processing. Proc. Natl Acad. Sci. USA 113, 11366–11371 (2016).

  25. 25.

    Hermes, D., Miller, K. J., Noordmans, H. J., Vansteensel, M. J. & Ramsey, N. F. Automated electrocorticographic electrode localization on individually rendered brain surfaces. J. Neurosci. Methods 185, 293–298 (2010).

  26. 26.

    Dalal, S. S. et al. Localization of neurosurgically implanted electrodes via photograph-MRI-radiograph coregistration. J. Neurosci. Methods 174, 106–115 (2008).

  27. 27.

    Yang, A. I. et al. Localization of dense intracranial electrode arrays using magnetic resonance imaging. Neuroimage 63, 157–165 (2012).

  28. 28.

    Onofrey, J. A., Staib, L. H. & Papademetris, X. Learning intervention-induced deformations for non-rigid MR-CT registration and electrode localization in epilepsy patients. NeuroImage Clin. 10, 291–301 (2016).

  29. 29.

    Pieters, T. A., Conner, C. R. & Tandon, N. Recursive grid partitioning on a cortical surface model: an optimized technique for the localization of implanted subdural electrodes. J. Neurosurg. 118, 1086–1097 (2013).

  30. 30.

    Stieglitz, L. H. et al. Improved localization of implanted subdural electrode contacts on magnetic resonance imaging with an elastic image fusion algorithm in an invasive electroencephalography recording. Clin. Neurosurg. 10, 506–513 (2014).

  31. 31.

    Brang, D., Dai, Z., Zheng, W. & Towle, V. L. Registering imaged ECoG electrodes to human cortex: a geometry-based technique. J. Neurosci. Methods 273, 64–73 (2016).

  32. 32.

    Dykstra, A. R. et al. Individualized localization and cortical surface-based registration of intracranial electrodes. Neuroimage 59, 3563–3570 (2012).

  33. 33.

    Khodagholy, D. et al. Organic electronics for high-resolution electrocorticography of the human brain. Sci. Adv. 2, 1–9 (2016).

  34. 34.

    Seo, D. et al. Wireless recording in the peripheral nervous system with ultrasonic neural dust. Neuron 91, 529–539 (2016).

  35. 35.

    Lauro, P. M. et al. DBSproc: an open source process for DBS electrode localization and tractographic analysis. Hum. Brain Mapp. 37, 422–433 (2016).

  36. 36.

    Horn, A. & Kühn, A. A. Lead-DBS: a toolbox for deep brain stimulation electrode localizations and visualizations. Neuroimage 107, 127–135 (2015).

  37. 37.

    Dale, A. M., Fischl, B. & Sereno, M. I. Cortical surface-based analysis: I. Segmentation and surface reconstruction. Neuroimage 9, 179–194 (1999).

  38. 38.

    Lepore, N. et al. A new combined surface and volume registration. Med. Imaging 2010 Image Process. 7623, 76231E https://doi.org/10.1117/12.844434(2010).

  39. 39.

    Klein, A. et al. Evaluation of volume-based and surface-based brain image registration methods. Neuroimage 51, 214–220 (2010).

  40. 40.

    Hill, D. L. G. et al. Measurement of intraoperative brain surface deformation under a craniotomy. Neurosurgery 43, 514–526 (1998).

  41. 41.

    Roberts, D. W., Hartov, A., Kennedy, F. E., Miga, M. I. & Paulsen, K. D. Intraoperative brain shift and deformation: a quantitative analysis of cortical displacement in 28 cases. Neurosurgery 43, 749–758 (1998).

  42. 42.

    Miyagi, Y., Shima, F. & Sasaki, T. Brain shift: an error factor during implantation of deep brain stimulation electrodes. J. Neurosurg. 107, 989–97 (2007).

  43. 43.

    Hastreiter, P. et al. Strategies for brain shift evaluation. Med. Image Anal. 8, 447–464 (2004).

  44. 44.

    LaViolette, P. S. et al. Three-dimensional visualization of subdural electrodes for presurgical planning. Oper. Neurosurg. 68 https://doi.org/10.1227/NEU.0b013e31820783ba (2011).

  45. 45.

    Sweet, J. A., Hdeib, A. M., Sloan, A. & Miller, J. P. Depths and grids in brain tumors: Implantation strategies, techniques, and complications. Epilepsia 54, 66–71 (2013).

  46. 46.

    Kovalev, D. et al. Rapid and fully automated visualization of subdural electrodes in the presurgical evaluation of epilepsy patients. Am. J. Neuroradiol. 26, 1078–1083 (2005).

  47. 47.

    Wang, P. T. et al. A co-registration approach for electrocorticogram electrode localization using post-implantation MRI and CT of the head. in Proc. International. IEEE/EMBS Conference on Neural Engineering, NER 525–528 https://doi.org/10.1109/NER.2013.6695987(2013).

  48. 48.

    Schulze-Bonhage, A. H. J. et al. Visualization of subdural strip and grid electrodes using curvilinear reformatting of 3D MR imaging data sets. Am. J. Neuroradiol. 23, 400–403 (2002).

  49. 49.

    Boatman-Reich, D. et al. Quantifying auditory event-related responses in multichannel human intracranial recordings. Front. Comput. Neurosci. 4, 4 (2010).

  50. 50.

    Staresina, B. P. et al. Hierarchical nesting of slow oscillations, spindles and ripples in the human hippocampus during sleep. Nat. Neurosci. 18, 1679–1686 (2015).

  51. 51.

    Manning, J. R., Jacobs, J., Fried, I. & Kahana, M. J. Broadband shifts in local field potential power spectra are correlated with single-neuron spiking in humans. J. Neurosci. 29, 13613–13620 (2009).

  52. 52.

    Miller, K. J. Broadband spectral change: evidence for a macroscale correlate of population firing rate? J. Neurosci. 30, 6477–6479 (2010).

  53. 53.

    Ray, S. & Maunsell, J. H. R. Different origins of gamma rhythm and high-gamma activity in macaque visual cortex. PLoS Biol. 9 https://doi.org/10.1371/journal.pbio.1000610 (2011).

  54. 54.

    Crone, N. E., Miglioretti, D. L., Gordon, B., Lesser, R. P. & Crone, N. Functional mapping of human sensorimotor cortex with electrocorticographic spectral analysis II. Event-related synchronization in the gamma band. Brain 121, 2301–2315 (1998).

  55. 55.

    Oostenveld, R., Fries, P., Maris, E. & Schoffelen, J. M. FieldTrip: open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data. Comput. Intell. Neurosci. 2011 https://doi.org/10.1155/2011/156869 (2011).

  56. 56.

    Maris, E. & Oostenveld, R. Nonparametric statistical testing of EEG- and MEG-data. J. Neurosci. Methods 164, 177–190 (2007).

  57. 57.

    Bastos, A. M. & Schoffelen, J.-M. A tutorial review of functional connectivity analysis methods and their interpretational pitfalls. Front. Syst. Neurosci. 9, 1–23 (2016).

  58. 58.

    Drury, H. A., Van Essen, D. C., Corbetta, M. & Snyder, A. Z. Brain Warping 337–363 (Elsevier, Cambridge, MA, 1999).

  59. 59.

    Wells, W. M., Viola, P., Atsumi, H., Nakajima, S. & Kikinis, R. Multi-modal volume registration by maximization of mutual information. Med. Image Anal. 1, 35–51 (1996).

  60. 60.

    Collignon, A. & Maes, F. Automated multi-modality image registration based on information theory. Proc. Inf. Process. Med. Imaging 263–274 (1995).

  61. 61.

    Schaer, M. et al. A surface-based approach to quantify local cortical gyrification. IEEE Trans. Med. Imaging 27, 161–170 (2008).

  62. 62.

    Lancaster, J. L. et al. Automated labeling of the human brain: a preliminary report on the development and evaluation of a forward-transform method. Hum. Brain Mapp. 5, 238–242 (1997).

  63. 63.

    Tzourio-Mazoyer, N. et al. Automated anatomical labeling of activations in SPM using a macroscopic anatomical parcellation of the MNI MRI single-subject brain. Neuroimage 15, 273–289 (2002).

  64. 64.

    Cocosco, C. A., Kollokian, V., Kwan, R. K., Pike, G. B. & Evans, A. C. BrainWeb : online interface to a 3D MRI simulated brain database. Proc. 3rd Int. Conf. Funct. Mapp. Hum. Brain 5, S425 (1997). in.

  65. 65.

    Eickhoff, S. B. et al. A new SPM toolbox for combining probabilistic cytoarchitectonic maps and functional imaging data. Neuroimage 25, 1325–1335 (2005).

  66. 66.

    Wang, L., Mruczek, R. E. B., Arcaro, M. J. & Kastner, S. Probabilistic maps of visual topography in human cortex. Cereb. Cortex 25, 3911–3931 (2015).

  67. 67.

    Fan, L. et al. The human brainnetome atlas: a new brain atlas based on connectional architecture. Cereb. Cortex 26, 3508–3526 (2016).

  68. 68.

    Desikan, R. S. et al. An automated labeling system for subdividing the human cerebral cortex on MRI scans into gyral based regions of interest. Neuroimage 31, 968–980 (2006).

  69. 69.

    Destrieux, C., Fischl, B., Dale, A. & Halgren, E. Automatic parcellation of human cortical gyri and sulci using standard anatomical nomenclature. Neuroimage 53, 1–15 (2010).

  70. 70.

    Ashburner, J. & Friston, K. J. Nonlinear spatial normalization using basis functions. Hum. Brain Mapp. 7, 254–266 (1999).

  71. 71.

    Bigdely-Shamlo, N., Mullen, T., Kothe, C., Su, K.-M. & Robbins, K. A. The PREP pipeline: standardized preprocessing for large-scale EEG analysis. Front. Neuroinform. 9, 16 (2015).

  72. 72.

    Liu, Y., Coon, W. G., Pesters, A., de Brunner, P. & Schalk, G. The effects of spatial filtering and artifacts on electrocorticographic signals. J. Neural Eng. 12, 56008 (2015).

  73. 73.

    Dien, J. Issues in the application of the average reference: review, critiques, and recommendations. Behav. Res. Methods, Instrum., Comput. 30, 34–43 (1998).

  74. 74.

    Ludwig, K. A. et al. Using a common average reference to improve cortical neuron recordings from microelectrode arrays. J. Neurophysiol. 101, 1679–1689 (2009).

  75. 75.

    Trongnetrpunya, A. et al. Assessing Granger causality in electrophysiological data: removing the adverse effects of common signals via bipolar derivations. Front. Syst. Neurosci. 9, 189 (2015).

  76. 76.

    Shirhatti, V., Borthakur, A. & Ray, S. Effect of reference scheme on power and phase of the local field potential. Neural Comput. 882–913 https://doi.org/10.1162/NECO (2016).

  77. 77.

    Arnulfo, G., Hirvonen, J., Nobili, L., Palva, S. & Palva, J. M. Phase and amplitude correlations in resting-state activity in human stereotactical EEG recordings. Neuroimage 112, 114–127 (2015).

  78. 78.

    Zaveri, H. P., Duckrow, R. B. & Spencer, S. S. On the use of bipolar montages for time-series analysis of intracranial electroencephalograms. Clin. Neurophysiol. 117, 2102–2108 (2006).

  79. 79.

    Mercier, M. R. et al. Evaluation of cortical local field potential diffusion in stereotactic electro-encephalography recordings: a glimpse on white matter signal. Neuroimage 147, 219–232 (2017).

Download references


The authors thank the patient for participation and C.R. Holdgraf, V. Rangarajan, C.W. Hoy, J. Kam, L. Bellier, R. Helfrich, R. Jimenez, E. Gerber, A. Blenkmann, J. Lubell, and M. Pereira for fruitful discussions. The authors are also grateful to the present and former FieldTrip core developers, as well as the greater FieldTrip community, for contributing code, documentation, and expertise that have made this protocol possible. A.S. was supported by Rubicon grant 446-14-007 from NWO and Marie Sklodowska-Curie Global Fellowship 658868 from the European Union; R.v.d.M. by R01 MH095984-03S1 from the NIMH; J.-M.S. by VIDI 864-14-011 from NWO, R.T.K. by R37 NS21135 from NINDS, and R.O. by Marie Skłodowska-Curie Innovative Training Networks 641652 from the European Union.

Author information


  1. Helen Wills Neuroscience Institute, University of California, Berkeley, Berkeley, CA, USA

    • Arjen Stolk
    • , Sandon Griffin
    • , Callum Dewar
    • , Ignacio Saez
    •  & Robert T. Knight
  2. Donders Institute for Brain, Cognition, and Behaviour, Radboud University, Nijmegen, The Netherlands

    • Arjen Stolk
    • , Jan-Mathijs Schoffelen
    •  & Robert Oostenveld
  3. Department of Cognitive Science, University of California, San Diego, La Jolla, CA, USA

    • Roemer van der Meij
  4. College of Medicine, University of Illinois, Chicago, IL, USA

    • Callum Dewar
  5. Department of Neurology, University of California, Irvine, Irvine, CA, USA

    • Jack J. Lin
  6. Department of Neurology, Massachusetts General Hospital and Harvard Medical School, Boston, MA, USA

    • Giovanni Piantoni
  7. Department of Psychology, University of California, Berkeley, Berkeley, CA, USA

    • Robert T. Knight
  8. NatMEG, Karolinska Institutet, Stockholm, Sweden

    • Robert Oostenveld


  1. Search for Arjen Stolk in:

  2. Search for Sandon Griffin in:

  3. Search for Roemer van der Meij in:

  4. Search for Callum Dewar in:

  5. Search for Ignacio Saez in:

  6. Search for Jack J. Lin in:

  7. Search for Giovanni Piantoni in:

  8. Search for Jan-Mathijs Schoffelen in:

  9. Search for Robert T. Knight in:

  10. Search for Robert Oostenveld in:


A.S., S.G., R.v.d.M., J.-M.S., and R.O. developed the protocol. G.P. contributed the algorithm for brain-shift compensation. J.J.L. provided access and guidance in the data acquisition. A.S., S.G., J.-M.S., R.T.K., and R.O. wrote the paper, and R.v.d.M., C.D., I.S., G.P., and J.J.L., provided substantial editorial revisions.

Competing interests

The authors declare no competing interests.

Corresponding author

Correspondence to Arjen Stolk.

Supplementary information

  1. Supplementary Text and Figures

    Supplementary Figure 1

  2. Reporting Summary

  3. Supplementary Data 1

    Example code for a start-to-end implementation of the anatomical and functional workflow for SubjectUCI29

  4. Supplementary Data 2

    Code for the automatic DICOM series search and visualization tool, search_dicomseries.m

  5. Supplementary Data 3

    Code for the automatic electrode-labeling tool, generate_electable.m

  6. Supplementary Video 1

    Tutorial video showing the first stage of preprocessing the anatomical MRI (corresponding to Step 3)

  7. Supplementary Video 2

    Tutorial video showing the second stage of preprocessing of the anatomical MRI (corresponding to Step 4)

  8. Supplementary Video 3

    Tutorial video showing the preprocessing of the anatomical CT (corresponding to Step 11)

  9. Supplementary Video 4

    Tutorial video showing the placement of electrodes in the MRI-fused anatomical CT (corresponding to Step 17)

  10. Supplementary Video 5

    Tutorial video showing the interactive manipulation of anatomically informed graphical representations of time–frequency resolved neural data

  11. Supplementary Video 6

    Spatiotemporal dynamics of task-modulated high-frequency-band activity at surface electrodes overlaid on left parietal and temporal cortex. It can be observed that processing occurs in the temporal lobe at hearing the target tone followed by the sensorimotor system contralateral to the hand used for the button press. Warm and cold colors represent increases and decreases in high-frequency-band power, respectively

  12. Supplementary Video 7

    Spatiotemporal dynamics of epileptiform activity recorded from depth electrodes targeting the bilateral hippocampus and amygdala. It can be observed that the (interictal) epileptiform discharges first occur in the left hippocampus and amygdala and then spread to their right-hemisphere homologs during this particular episode. Warm and cold colors represent positive and negative deflections in raw signal amplitude, respectively. The size of each point cloud is scaled according to signal amplitude. This video is created using data obtained from a different subject

About this article

Publication history





By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.