Mithra: An Open-Source and Cross-Platform Visualization Toolbox for Human Intracranial Recordings

preprint OA: closed
📄 Open PDF Full text JSON View at publisher

Abstract

Intracranial electrophysiological recordings, including electrocorticography (ECoG) and stereo-EEG (sEEG), are increasingly used across research programs to study human brain function due to their high spatiotemporal resolution. Numerous tools exist for electrode localization and visualization; however, most focus on subject-level visualization and provide only partial solutions for systematic within- and across-subject analyses. It is especially important to preserve subject-specific anatomical locations while mapping electrodes to standardized spaces for analysis across multiple subjects. To address these needs, we present Mithra 1 : a toolkit for visualizing intracranial recordings, implemented in both Python and MATLAB. The toolbox enables visualization of electrodes alongside the brain’s pial surface and anatomical annotations, supports localization in common average spaces such as the MNI and FreeSurfer average brains, and maintains alignment with individual anatomy. It further allows electrode projection onto the cortical surface to generate Gaussian heatmaps representing the spatial distribution of neural activity. By integrating these capabilities into a unified framework, our toolbox provides a flexible, cross-platform solution for systematic within- and across-subject electrode visualization and analysis.
Full text 39,919 characters · extracted from preprint-html · click to expand
Mithra: An Open-Source and Cross-Platform Visualization Toolbox for Human Intracranial Recordings | bioRxiv /* */ /* */ <!-- <!-- /*! * yepnope1.5.4 * (c) WTFPL, GPLv2 */ (function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0];var j=d.createElement(s);var dl=l!='dataLayer'?'&l='+l:'';j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;j.type='text/javascript';j.async=true;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-M677548'); Skip to main content Home About Submit ALERTS / RSS Search for this keyword Advanced Search New Results Mithra: An Open-Source and Cross-Platform Visualization Toolbox for Human Intracranial Recordings Amirhossein Khalilian-Gourtani , View ORCID Profile Yasamin Esmaeili , View ORCID Profile Andrew J. Michalak , Adeen Flinker doi: https://doi.org/10.1101/2025.11.20.689539 Amirhossein Khalilian-Gourtani * New York University School of Medicine, Department of Neurology , New York, NY, USA Find this author on Google Scholar Find this author on PubMed Search for this author on this site For correspondence: amirhossein.khalilian{at}nyu.edu Yasamin Esmaeili † New York University Tandon School of Engineering, Biomedical Engineering Department , Brooklyn, NY, USA Find this author on Google Scholar Find this author on PubMed Search for this author on this site ORCID record for Yasamin Esmaeili Andrew J. Michalak * New York University School of Medicine, Department of Neurology , New York, NY, USA Find this author on Google Scholar Find this author on PubMed Search for this author on this site ORCID record for Andrew J. Michalak Adeen Flinker * New York University School of Medicine, Department of Neurology , New York, NY, USA † New York University Tandon School of Engineering, Biomedical Engineering Department , Brooklyn, NY, USA Find this author on Google Scholar Find this author on PubMed Search for this author on this site Abstract Full Text Info/History Metrics Preview PDF Abstract Intracranial electrophysiological recordings, including electrocorticography (ECoG) and stereo-EEG (sEEG), are increasingly used across research programs to study human brain function due to their high spatiotemporal resolution. Numerous tools exist for electrode localization and visualization; however, most focus on subject-level visualization and provide only partial solutions for systematic within- and across-subject analyses. It is especially important to preserve subject-specific anatomical locations while mapping electrodes to standardized spaces for analysis across multiple subjects. To address these needs, we present Mithra 1 : a toolkit for visualizing intracranial recordings, implemented in both Python and MATLAB. The toolbox enables visualization of electrodes alongside the brain’s pial surface and anatomical annotations, supports localization in common average spaces such as the MNI and FreeSurfer average brains, and maintains alignment with individual anatomy. It further allows electrode projection onto the cortical surface to generate Gaussian heatmaps representing the spatial distribution of neural activity. By integrating these capabilities into a unified framework, our toolbox provides a flexible, cross-platform solution for systematic within- and across-subject electrode visualization and analysis. 1 Introduction Intracranial recordings, including electrocorticography and stereo-electroencephalography, are increasingly used across clinical and research programs. Electrocorticography (ECoG) employs subdural grid and strip electrodes placed directly on the cortical surface, providing high spatial resolution over exposed regions of the brain, whereas stereo-electroencephalography (sEEG) uses depth electrodes inserted stereotactically to record from distributed cortical and subcortical structures, enabling superficial and deep sampling of neural activity. Both approaches are used in epilepsy monitoring to localize seizure onset zones and guide surgical planning. Epilepsy and cognition research programs increasingly use these recordings to study human brain function. Accurate visualization of intracranial electrodes is essential for interpreting electrophysiological data in the context of brain anatomy. While electrode localization is typically performed in a subject’s native anatomical space, group-level analyses often require transforming electrodes into a common average space, such as the Montreal Neurological Institute (MNI) [ 3 ] or FreeSurfer’s average brain (fsaverage) [ 5 ] coordinate systems. Although linear and nonlinear transformations can approximate coordinate locations on a template brain, the a priori knowledge of the subject-specific anatomy is lost, oftentimes leading to inaccurate localization. Existing tools provide partial solutions for this process, but none integrate subject-specific anatomy within the MNI space. We provide a projection algorithm to MNI coordinate space that maintains the within-subject anatomical locations of individual electrodes, resulting in a more accurate visualization. In recent years, there has been a growing shift toward the use of sEEG [ 1 ], driven by its ability to safely sample deep and distributed brain regions through minimally invasive implantation. However, many existing visualization tools were originally developed for ECoG and therefore provide only partial solutions for sEEG data, often lacking effective methods to visualize electrodes situated within sulci or deeper structures. To address this limitation, we provide a mapping algorithm that projects sEEG electrode coordinates onto the FreeSurfer average brain, which offers a better view of cortical folding and sulcal geometry. This enables clearer and more anatomically accurate visualization of sEEG electrodes within and across subjects. Capturing the spatial distribution of neural activity is essential for interpreting cortical dynamics. Rather than visualizing individual electrodes, we can project activity onto the cortical surface using Gaussian heatmaps. This approach provides an intuitive visualization of the spatial distribution of neural activity recorded from discrete electrode sites. By smoothing electrode values across the cortical surface, Gaussian heatmaps produce a more continuous representation of underlying neural patterns. Despite their utility, few existing electrode visualization tools incorporate this functionality. Here, we implement Gaussian heatmaps directly on the cortical surface and provide an option to constrain the smoothing kernel to respect anatomical boundaries, ensuring that spatial interpolation remains consistent with cortical parcellations and regional organization. 2. Background 2.1 Electrode Localization Tools Existing tools for localizing and visualizing intracranial electrodes have notable limitations. Table 1 summarizes several widely used software packages. Packages such as FieldTrip [ 16 ], NTools [ 20 ], and iELVis [ 8 ] provide MATLAB pipelines for coregistering postimplant CT or MRI to preimplant MRI and mapping electrodes onto anatomical surfaces, though they primarily focus on localization and offer limited visualization capabilities. IELU [ 13 ] and nipy [ 9 ] provide electrode localization functionality in Python and integrate with neuroimaging workflows such as MNE-Python [ 6 ]. RAVE [ 15 ] stands out for its interactive 3D visualization capabilities and its ability to combine neuroimaging with intracranial data, though it is primarily focused on localization. Meanwhile, SB-MEMA [ 10 ] introduced a framework for projecting ECoG activity onto cortical surfaces, but its lack of publicly available software limits adoption. Overall, while these methods collectively address most aspects of electrode localization with some visualization capabilities, no single package provides an integrated, open-source, and user-friendly solution for anatomically grounded visualization that is implemented across major programming environments. View this table: View inline View popup Download powerpoint Table 1: Overview of the existing electrode localization and visualization tools View this table: View inline View popup Download powerpoint Table 2: Summary of Common FreeSurfer Surface and Annotation Files 2.2. FreeSurfer FreeSurfer [ 5 ] is a neuroimaging software designed for analyzing and visualizing brain magnetic resonance imaging (MRI) data [ 5 ]. Many electrode localization tools use FreeSurfer for visualization and inorder to obtain anatomical annotations. We use the pial surfaces generated by FreeSurfer in our toolbox for visualization. The pial surface represents the outer boundary of the brain’s gray matter for each subject and it is extracted using the pre-implant MRI. This surface is mainly used in our visualization to show the electrode locations within the subject anatomy. Additionally, we use the spherical coordinate system provided by FreeSurfer, to transform locations between two different brains while maintaining their anatomical relevance. We use surface annotations generated by FreeSurfer to label and identify specific brain regions based on established atlases. The following list reviews the important files from the FreeSurfer ecosystem that we use in our visualization toolbox. 2.3. Ntools In this manuscript, we used NTools [ 20 ] for electrode localization. NTools localizes electrodes based on post-implant CT coregistered with pre-implant MRI. Electrode positions are identified using a semi-automatic pipeline. To assign anatomical labels, NTools leverages surface annotations from FreeSurfer in the subject’s native space. NTools provides electrode coordinates in both native subject T1 space and MNI space. For mapping to MNI space, NTools estimates a volumetric transformation from the subject space to MNI space and applies it to a 3 × 3 × 3 voxel cube centered at each electrode, recording the mean of the transformed coordinates as the final MNI location. In our visualization tools, we use these coordinates provided by NTools, both in the subject native space and the MNI space, and extend them with additional visualization capabilities. 3. Methods 3.1. Mithra We developed a set of visualization tools that provide a unified workflow for displaying cortical surfaces, intracranial electrodes, and anatomical annotations across both MATLAB and Python environments. The overall structure and capabilities are parallel between the two implementations. In MATLAB, visualizations are built primarily using trisurf–based rendering of cortical meshes, while the Python version leverages PyVista for rendering and surface manipulation. Mithra support loading and displaying subject-specific or template surfaces, rendering electrodes as sphere glyphs, and overlaying anatomical labels derived from FreeSurfer parcellations. Together, these visualization modules offer a flexible and consistent framework for exploring electrode placement and neural activity within the context of cortical anatomy. In the following sections, we review some of the important Algorithms and capabilities of our visualization toolbox. Open-source implementation is provided here: https://github.com/amirhkhalilian/Mithra . 3.2. Electrode visualization on the MNI brain When visualizing electrodes in MNI space, a key challenge is ensuring that their projected locations accurately reflect cortical anatomy. Electrode coordinates transformed to MNI space using NTools often do not align precisely with the cortical surface, sometimes appearing displaced or floating above the brain. This issue arises because NTools relies on 3D volumetric registration to map the subject’s brain to MNI space and then applies this transformation to electrode locations. Let T : ℝ 3 → ℝ 3 be the registration transform from subject space to MNI space, e m ∈ ℝ 3 the electrode coordinate in the subject’s native space, and 𝒩 ( e m ) ⊂ ℝ 3 the set of voxel centers in a 3 × 3 × 3 cube around e m . Then the MNI coordinate of electrode m is computed in NTools as the mean of the transformed cube: This transformation can result in electrodes being misaligned and positioned off the MNI pial surface. A naive approach that projects electrodes to the nearest MNI pial vertex can mislocalize electrodes onto incorrect neighboring gyri, leading to distorted anatomical and functional interpretations. To mitigate this, we propose to incorporate subjectspecific anatomical information to constrain electrode projection (see Algorithm 1). Let denote the coordinates of the i -th vertex on the MNI surface mesh. Let denote the coordinates of the m -th electrode in MNI space after the transformation from NTools, with m ∈ [1, · · ·, M ] for M total electrodes. For each electrode, the corresponding cortical region is first identified in the subject’s native space based on anatomical labels. Here we denote by a m = Atlas( e m ) the anatomical annotation index assigned to electrode m in native subject space, as determined based on the per subject cortical atlas annotation. We then restrict the search for the nearest vertex on the MNI pial surface to vertices with the same cortical annotation (in Algorithm 1 the Atlas() function refers to the annotation of vertices in MNI space). This procedure ensures that electrodes are mapped to the closest anatomically valid location, preserving spatial fidelity while maintaining consistency with standardized MNI coordinates. Algorithm 1: Electrode projection onto MNI pial surface Download figure Open in new tab We show an example of visualizing ECoG electrodes from one subject on the MNI pial surface. The electrode coordinates on the native subject pial surface adhere to the surface and are correctly located on the corresponding gyri ( Fig. 1A ; color-code for each electrode follows DKT atlas). When we visualize the MNI coordinates provided by NTools on the MNI surface, we observe that the electrodes are not adhering to the surface (see Fig. 1B , frontal view) and in some cases floating in the area between gyri and mislocalized (see blue electrode at the center of zoomed region in Fig. 1B ). A naive approach of moving the electrode to the closest vertex on MNI surface can lead to electrodes moving across the sulcus into adjacent gyri ( Fig. 1C ; blue electrode localized to pre-central gyrus in subject space moved to inferior frontal gyrus in the MNI space). By constraining the search for the closest vertex to only the ones with the same anatomical label as the electrode, the resulting electrode coordinates lie within the correct gyri surfaces ( Fig. 1D ; blue electrode moved to pre-central gyrus on the MNI surface). Download figure Open in new tab Fig. 1: Electrode projection to the MNI surface after localization. (A) ECoG electrodes localized and visualized on the subject’s pial surface, color-coded based on their location in the DKT atlas. (B) MNI coordinates provided by NTools may not align precisely with the gyri in the MNI brain and do not necessarily adhere to the surface. (C) Naive projection directly to the closest pial vertex can result in electrodes being mislocalized to neighboring gyri. (D) Our method incorporates subject-specific anatomy to ensure electrodes are projected onto the closest vertex within the correct gyrus in the MNI space. The red arrows highlight the same electrode across all panels. 3.3 Plotting stereo-EEG electrodes on FreeSurfer surfaces Mapping stereo-EEG electrodes to a common cortical surface enables consistent visualization and group-level analysis. During neurosurgical implantation, electrode trajectories are typically planned such that they sample as much cortex as possible (see Fig. 2A ). This is considered a benefit of sEEG over subdural ECoG electrodes, as sEEG electrodes have the ability to not only sample gray matter at the gyral surface but also along the gyral wall and deep within the sulcus (see Fig. 2A ). However, this poses a challenge to visualization and group-level analysis using the MNI pial surface because the areas inside the sulci are not visible on this surface. The FreeSurfer average brain surface (also referred to as fsaverage) provides an ideal target for such mappings, as the gyri and sulci banks are more visible on this surface. Download figure Open in new tab Fig. 2: Visualization of stereo-EEG electrodes. (A) Three consecutive coronal slices of the pre-operative MRI (gray scale) and the overlaid co-registered post-operative CT (heatmap scale) show the trajectory of one sEEG lead of electrodes (the images on the right show a zoomed region around the electrodes). (B-E) Eight sets of sEEG depth electrode leads are shown on the (B) native subject cortical surface, (C) FreeSurfer average brain, and (D) FreeSurfer average inflated brain, with the corresponding frontal views depicted in (E) from left to right. From each lead we only show electrodes that are sampling cortex as spheres color-coded per lead. To map sEEG electrodes to the fsaverage surface, we use the spherical coordinate system generated by FreeSurfer during extraction of the subject-specific pial surface. Algorithm 2 summarizes this procedure. For each electrode, the corresponding vertex on the subject’s pial surface is identified and mapped into the spherical coordinate system via index lookup. The closest point on the fsaverage sphere is then located, and its index is used to project the electrode onto the fsaverage cortical surface. This mapping preserves anatomical correspondence across subjects and supports visualization and group analyses on both the native and inflated fsaverage surfaces, as vertex indices are shared between them. Algorithm 2: Mapping sEEG electrodes to Freesurfer fsaverage Download figure Open in new tab First, we show an example with three consecutive slices of the pre-operative MRI, with the co-registered CT overlaid on top ( Fig.2A ). These images show the trajectory of one sEEG lead and illustrate how electrode trajectories are typically planned to sample as much cortical surface as possible. Additionally, we show the other sEEG electrodes implanted in the same participant, visualized on both the native and FreeSurfer average surfaces ( Fig.2B-D ). Here, we display only the electrodes localized to cortical regions, excluding those in white-matter and subcortical areas. The red lead in the frontal lobes corresponds to the trajectories shown in Fig.2A . We show visualization of the electrodes on the subject’s pial surface with increased transparency to better reveal the trajectories of different leads ( Fig.2B ). However, this view does not clearly show the specific gyri and sulci sampled by each electrode. By projecting the electrode locations onto the FreeSurfer average surfaces ( Fig.2C,D ), we can more effectively visualize their gyral assignments. Notably, on the FreeSurfer average surface, the red lead can be seen traversing along the cortical gyri ( Fig.2C,E ). We highlight that with the inflated surface ( Fig.2D ), we can visualize the electrodes on the surface with increased transparency as the gyral wall and areas within the sulcus are inflated to one smooth surface. 3.4. Electrode projection using Gaussian heatmaps We provide a projection method to visualize scalar weights associated with each electrode on a cortical surface mesh. Given electrode locations and their corresponding weights, we map the weights to nearby surface vertices using a Gaussian kernel centered at each electrode’s location. We propose to constrain the projection kernel to specified anatomical regions (or any other desired atlas), using parcellation annotations. We accumulate and normalize the final projected values to account for overlapping influences across electrodes. These values are then rendered on the brain surface using a PyVista plotter or a mesh surface in Python and MATLAB, respectively. The following will describes the projection method in details (see Algorithm 3). Let v i ∈ ℝ 3 denote the coordinates of the i -th vertex on a surface mesh. Let e m ∈ ℝ 3 denote the coordinates of the m -th electrode with associated weight w m , with m ∈ [1, · · ·, M ], for M total electrodes. The distance between vertex i and electrode m is d im = ∥ v i − e m ∥ 2 . The Gaussian kernel projecting the influence of electrode m to vertex i is defined as where σ controls the spatial spread of the kernel. The cumulative projected value at surface vertex i is then In normalized form, the color values are further normalized by the sum of kernel weights, where ϵ is a small tolerance to avoid division by near-zero values. Let a m = Atlas( e m ) denote the anatomical annotation index assigned to electrode m , as determined based on a cortical atlas. In NTools , for example, the anatomical region corresponding to each electrode is derived from the DKT atlas fitted to the subject-specific T1-weighted pial surface. To restrict spatial smoothing to the anatomical region associated with the electrode, we constrain the Gaussian kernel to vertices that share the same atlas annotation as the electrode. The modified kernel is defined as where ι i ( a m ) is an indicator function that equals 1 if vertex v i belongs to the same anatomical region as a m , and 0 otherwise. This formulation ensures that the smoothing kernel is both spatially and anatomically constrained, thereby preventing signal leakage across cortical boundaries. Algorithm 3: Project electrode weights onto mesh using Gaussian kernel. Download figure Open in new tab We show an example of projecting electrode weights onto the pial surface in Fig. 3 . In this example we focus on the electrodes located in the middle portion of the middle superior temporal gyrus (mSTG) ( Fig. 3A ). Each electrode has a scalar weight associated that we aim to project onto the pial surface ( Fig. 3B ). We observe that an unconstrained Gaussian kernel (as in Eq. (3.1) ) diffuses activity across the sulcus into adjacent gyri ( Fig. 3C ). In contrast, when the Gaussian kernel is constrained based on the anatomical location of each electrode (as in Eq. (3.2) ), the projection with the same σ is correctly confined to the anatomical boundaries of the region of interest. Download figure Open in new tab Fig. 3: Weighted projection to the pial surface using Gaussian heatmaps. (A) A grid of electrodes is shown on the cortical surface reconstructed using FreeSurfer’s recon-all pipeline. Cortical regions are color-coded according to the Desikan–Killiany–Tourville (DKT) atlas [ 4 ], and each electrode is represented as a black sphere. (B) Example electrode weights recorded from the middle superior temporal gyrus (mSTG), with each electrode color-coded according to its weight. (C) Projection of electrode weights onto the pial surface using a Gaussian kernel unconstrained based on anatomy and with σ = 3 mm. (D) Projection of the same weights using a Gaussian kernel with σ = 3 mm, where the kernel is constrained to the anatomical region associated with each electrode. 4. Results We present electrocorticographic (ECoG) recordings from a neurosurgical patient performing an auditory word repetition task [ 19 , 11 ]. We analyzed high-gamma broadband activity (70–150 Hz) because of its strong correlation with underlying neuronal spiking and fMRI signals [ 18 , 12 , 14 ]. To characterize the spatiotemporal dynamics of auditory processing, we examined the distribution of highgamma activity relative to baseline during the listening phase of the task ( Fig.4A ). Neural activity was averaged within 50 ms windows centered at 100, 200, and 400 ms after stimulus onset. We observed that responses first emerged in the superior temporal gyrus (STG) around 100 ms and subsequently engaged inferior frontal regions by 400 ms. Our visualization highlights both the electrodes exhibiting task-related responses and the broader cortical regions recruited over time. Download figure Open in new tab Fig. 4: Spatiotemporal distribution of neural activity during speech perception ( N = 1). The spatiotemporal distribution of neural activity compared to baseline in a representative participant is shown during the listening portion of an auditory word listening and repetition task. The neural activity in high-gamma (70-150 Hz) broadband, relative to baseline activity, is measured per electrode and time window. We show the activity on (A) subject native, (B) MNI, and (C) FreeSurfer average brain surfaces. Columns from left to right show 100, 200, and 400 msec after auditory stimulus onset. Electrodes are color-coded based on neural activity in units of ratio change from baseline and projected onto the respective surfaces with σ = 3 mm. We then applied the transformation described in Algorithm 1 to project electrodes onto the MNI surface, ensuring accurate anatomical placement, and generated corresponding Gaussian heatmap visualizations ( Fig.4B ). Similarly, we used Algorithm 2 to map electrode coordinates onto the FreeSurfer average surface and applied the same Gaussian projection ( Fig.4C ). Across all coordinate systems, we observed consistent spatial patterns of high-gamma activity, demonstrating the robustness of our projection and visualization framework. To demonstrate how our visualization framework generalizes across participants, we repeated the high-gamma broadband analysis for the same auditory word repetition task in five patients (previously published in [ 11 , 17 , 2 ]). For each participant, we projected electrode coordinates and neural activity onto both the MNI surface ( Fig. 5A ) and the FreeSurfer average surface ( Fig. 5B ) for group-level visualization of the spatiotemporal distribution. These visualizations reveal a consistent sequence of cortical engagement, with early high-gamma responses emerging in superior temporal regions and later recruitment of frontal areas. Importantly, the spatial organization of task-related activity was preserved across both coordinate systems, highlighting the robustness of our projection algorithms. This cross-participant consistency illustrates the utility of our framework for group-level intracranial electrophysiology studies. Download figure Open in new tab Fig. 5: Spatiotemporal distribution of neural activity during speech perception ( N = 5). The spatiotemporal distribution of neural activity compared to baseline across five participant is shown during the listening portion of an auditory word listening and repetition task. The neural activity in high-gamma (70-150 Hz) broadband, relative to baseline activity, is measured per electrode and time window. We show the activity on (A) MNI and (B) FreeSurfer average brain surfaces. Columns from left to right show 100, 200, and 400 msec after auditory stimulus onset. Electrodes are color-coded based on neural activity in units of ratio change from baseline and projected onto the respective surfaces with σ = 3 mm. 5. Discussion In this paper, we present a unified framework for visualizing intracranial electrodes. Our approach addresses limitations in the existing toolkits by introducing a projection algorithm that maps electrodes to the MNI cortical surface while respecting subject-specific anatomy, a mapping algorithm for sEEG electrodes onto the FreeSurfer average brain, and a projection algorithm for creating continuous spatial representations of neural activity directly on the cortical surface via Gaussian heatmaps. Our visualization toolbox provides these functionalities in both Python and MATLAB with similar workflows. Together, these components provide an integrated solution for researchers working with both ECoG and sEEG data across different coding languages. While existing tools provide robust solutions for discrete aspects of electrode localization, they often lack comprehensive, anatomically informed visualization capabilities, particularly for the increasingly prevalent sEEG recordings. By providing a projection that maintains anatomical fidelity in common average spaces, we enable more accurate cross-subject comparisons. Our toolbox offers a level of integrated functionality not currently available in a single, open-source package. This addresses the fragmentation in the field, where researchers often must chain together multiple specialized tools to achieve this visualization workflow. The growing use of intracranial recordings in research and clinical practice demands visualization tools that are as sophisticated as the data they aim to represent. Our work provides a coherent framework that bridges the gap between subject-specific anatomy and group-level analysis, while accommodating the distinct visualization needs of both ECoG and sEEG methodologies. This open-source solution fills a critical niche in the neuroscience research. We anticipate that it will facilitate more accurate visualization, clearer communication, and novel insights into human brain function derived from intracranial electrophysiology. Acknowledgments This work was supported by National Institutes of Health grants R01NS109367, R01NS115929, and R01DC018805 (A.F.) and National Science Foundation IIS-2309057. Funder Information Declared National Institutes of Health, https://ror.org/01cwqze88 , R01NS109367 , R01NS115929 , R01DC018805 U.S. National Science Foundation, https://ror.org/021nxhr62 , IIS-2309057 Footnotes ↵ 1 Open-source implementation is provided: https://github.com/amirhkhalilian/Mithra REFERENCES [1]. ↵ H. Abou-Al-Shaar , A. A. Brock , B. Kundu , D. J. Englot , and J. D. Rolston , Increased nationwide use of stereoencephalography for intracranial epilepsy electroencephalography recordings , Journal of Clinical Neuroscience , 53 ( 2018 ), pp. 132 – 134 . OpenUrl CrossRef PubMed [2]. ↵ X. Chen , R. Wang , A. Khalilian-Gourtani , L. Yu , P. Dugan , D. Friedman , W. Doyle , O. Devinsky , Y. Wang , and A. Flinker , A neural speech decoding framework leveraging deep learning and speech synthesis , Nature Machine Intelligence , 6 ( 2024 ), pp. 467 – 480 . OpenUrl [3]. ↵ S. Das , T. Glatard , C. Rogers , J. Saigle , S. Paiva , L. MacIntyre , M. Safi-Harab , M.-E. Rousseau , J. Stirling , N. Khalili-Mahani , et al. , Cyberinfrastructure for open science at the montreal neurological institute , Frontiers in neuroinformatics , 10 ( 2017 ), p. 53 . OpenUrl PubMed [4]. ↵ R. S. Desikan , F. Ségonne , B. Fischl , B. T. Quinn , B. C. Dickerson , D. Blacker , R. L. Buckner , A. M. Dale , R. P. Maguire , B. T. Hyman , et al. , An automated labeling system for subdividing the human cerebral cortex on mri scans into gyral based regions of interest , Neuroimage , 31 ( 2006 ), pp. 968 – 980 . OpenUrl CrossRef PubMed Web of Science [5]. ↵ B. Fischl , Freesurfer , Neuroimage , 62 ( 2012 ), pp. 774 – 781 . OpenUrl CrossRef PubMed Web of Science [6]. ↵ A. Gramfort , M. Luessi , E. Larson , D. A. Engemann , D. Strohmeier , C. Brodbeck , R. Goj , M. Jas , T. Brooks , L. Parkkonen , et al. , Meg and eeg data analysis with mne-python , Frontiers in Neuroinformatics , 7 ( 2013 ), p. 267 . OpenUrl [7]. A. Gramfort , M. Luessi , E. Larson , D. A. Engemann , D. Strohmeier , C. Brodbeck , R. Goj , M. Jas , T. Brooks , L. Parkkonen , et al. , Meg and eeg data analysis with mne-python , Frontiers in Neuroinformatics , 7 ( 2013 ), p. 267 . OpenUrl [8]. ↵ D. M. Groppe , S. Bickel , A. R. Dykstra , X. Wang , P. Mégevand , M. R. Mercier , F. A. Lado , A. D. Mehta , and C. J. Honey , ielvis: An open source matlab toolbox for localizing and visualizing human intracranial electrode data , Journal of neuroscience methods , 281 ( 2017 ), pp. 40 – 48 . OpenUrl CrossRef PubMed [9]. ↵ L. S. Hamilton , D. L. Chang , M. B. Lee , and E. F. Chang , Semi-automated anatomical labeling and inter-subject warping of high-density intracranial recording electrodes in electrocorticography , Frontiers in Neuroinformatics , 11 ( 2017 ), p. 62 . OpenUrl PubMed [10]. ↵ C. Kadipasaoglu , V. G. Baboyan , C. R. Conner , G. Chen , Z. S. Saad , and N. Tandon , Surface-based mixed effects multilevel analysis of grouped human electrocorticography , Neuroimage , 101 ( 2014 ), pp. 215 – 224 . OpenUrl CrossRef PubMed [11]. ↵ A. Khalilian-Gourtani , R. Wang , X. Chen , L. Yu , P. Dugan , D. Friedman , W. Doyle , O. Devinsky , Y. Wang , and A. Flinker , A corollary discharge circuit in human speech , Proceedings of the National Academy of Sciences , 121 ( 2024 ), p. e2404121121 . OpenUrl CrossRef PubMed [12]. ↵ J.-P. Lachaux , N. Axmacher , F. Mormann , E. Halgren , and N. E. Crone , High-frequency neural activity and human cognition: past, present and possible future of intracranial eeg research , Progress in neurobiology , 98 ( 2012 ), pp. 279 – 301 . PMID: 22750156 . OpenUrl CrossRef PubMed [13]. ↵ R. A. LaPlante , W. Tang , N. Peled , D. I. Vallejo , M. Borzello , D. D. Dougherty , E. N. Eskandar , A. S. Widge , S. S. Cash , and S. M. Stufflebeam , The interactive electrode localization utility: software for automatic sorting and labeling of intracranial subdural electrodes , International journal of computer assisted radiology and surgery , 12 ( 2017 ), pp. 1829 – 1837 . OpenUrl [14]. ↵ N. K. Logothetis , The underpinnings of the bold functional magnetic resonance imaging signal , Journal of Neuroscience , 23 ( 2003 ), pp. 3963 – 3971 . PMID: 12764080 . OpenUrl FREE Full Text [15]. ↵ J. F. Magnotti , Z. Wang , and M. S. Beauchamp , Rave: Comprehensive open-source software for reproducible analysis and visualization of intracranial eeg data , NeuroImage , 223 ( 2020 ), p. 117341 . OpenUrl CrossRef PubMed [16]. ↵ R. Oostenveld , P. Fries , E. Maris , and J.-M. Schoffelen , Fieldtrip: open source software for advanced analysis of meg, eeg, and invasive electrophysiological data , Computational intelligence and neuroscience , 2011 ( 2011 ), p. 156869 . OpenUrl [17]. ↵ M. Ozker , L. Yu , P. Dugan , W. Doyle , D. Friedman , O. Devinsky , and A. Flinker , Speech-induced suppression and vocal feedback sensitivity in human cortex , Elife , 13 ( 2024 ), p. RP94198 . OpenUrl PubMed [18]. ↵ S. Ray , N. E. Crone , E. Niebur , P. J. Franaszczuk , and S. S. Hsiao , Neural correlates of high-gamma oscillations (60–200 hz) in macaque local field potentials and their potential implications in electrocorticography , Journal of Neuroscience , 28 ( 2008 ), pp. 11526 – 11536 . PMID: 18987189 . OpenUrl Abstract / FREE Full Text [19]. ↵ J. Shum , L. Fanda , P. Dugan , W. K. Doyle , O. Devinsky , and A. Flinker , Neural correlates of sign language production revealed by electrocorticography , Neurology , 95 ( 2020 ), pp. e2880 – e2889 . OpenUrl CrossRef PubMed [20]. ↵ A. I. Yang , X. Wang , W. K. Doyle , E. Halgren , C. Carlson , T. L. Belcher , S. S. Cash , O. Devinsky , and T. Thesen , Localization of dense intracranial electrode arrays using magnetic resonance imaging , Neuroimage , 63 ( 2012 ), pp. 157 – 165 . OpenUrl CrossRef PubMed Web of Science View the discussion thread. Back to top Previous Next Posted November 21, 2025. Download PDF Email Thank you for your interest in spreading the word about bioRxiv. NOTE: Your email address is requested solely to identify you as the sender of this article. Your Email * Your Name * Send To * Enter multiple addresses on separate lines or separate them with commas. You are going to email the following Mithra: An Open-Source and Cross-Platform Visualization Toolbox for Human Intracranial Recordings Message Subject (Your Name) has forwarded a page to you from bioRxiv Message Body (Your Name) thought you would like to see this page from the bioRxiv website. Your Personal Message CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions. Share Mithra: An Open-Source and Cross-Platform Visualization Toolbox for Human Intracranial Recordings Amirhossein Khalilian-Gourtani , Yasamin Esmaeili , Andrew J. Michalak , Adeen Flinker bioRxiv 2025.11.20.689539; doi: https://doi.org/10.1101/2025.11.20.689539 Share This Article: Copy Citation Tools Mithra: An Open-Source and Cross-Platform Visualization Toolbox for Human Intracranial Recordings Amirhossein Khalilian-Gourtani , Yasamin Esmaeili , Andrew J. Michalak , Adeen Flinker bioRxiv 2025.11.20.689539; doi: https://doi.org/10.1101/2025.11.20.689539 Citation Manager Formats BibTeX Bookends EasyBib EndNote (tagged) EndNote 8 (xml) Medlars Mendeley Papers RefWorks Tagged Ref Manager RIS Zotero Tweet Widget Facebook Like Google Plus One Subject Area Neuroscience Subject Areas All Articles Animal Behavior and Cognition (7618) Biochemistry (17633) Bioengineering (13856) Bioinformatics (41841) Biophysics (21399) Cancer Biology (18529) Cell Biology (25422) Clinical Trials (138) Developmental Biology (13352) Ecology (19860) Epidemiology (2067) Evolutionary Biology (24282) Genetics (15582) Genomics (22462) Immunology (17700) Microbiology (40295) Molecular Biology (17140) Neuroscience (88419) Paleontology (666) Pathology (2823) Pharmacology and Toxicology (4813) Physiology (7632) Plant Biology (15107) Scientific Communication and Education (2042) Synthetic Biology (4284) Systems Biology (9808) Zoology (2267)

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2025) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00