Full text
Master Final Project Master in Neuroengineering and Rehabilitation Develop a whole brain model personalized for patients with epilepsy Author: Jimena Montealegre Sánchez Advisors: Edmundo López-Sola, Joan Francesc Alonso López Neuroelectrics May 2025
I would like to express my heartfelt gratitude to my thesis supervisor, Edmundo López, for his invaluable guidance, insightful advice, and for sharing his passion for neuroscience. I am especially thankful for the opportunity to carry out this research at Neuroelectrics. My sincere thanks also go to the entire Brain Modeling department, with special recognition to Roser, the research director. I am deeply grateful to Joan Francesc for serving as my thesis tutor and providing his invaluable insights throughout this journey. Finally, I extend my warmest thanks to my friends and family for their unwavering patience and support.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 1 ABSTRACT Epilepsy, a neurological disorder affecting millions worldwide, presents significant challenges in its drug-resistant form, where standard treatments often fail. The GALVANI project aims to address these challenges by developing personalized whole-brain models to optimize therapeutic strategies such as transcranial current stimulation and surgery. These models integrate structural, functional, and clinical data to simulate seizure dynamics and predict treatment outcomes. This thesis focuses on advancing the pipeline for whole-brain modeling by transitioning from invasive stereo-electroencephalography (SEEG) to non-invasive scalp electroencephalography (EEG). Using neural mass models (NMMs) and structural connectivity derived from diffusion MRI, the study develops a framework to personalize whole-brain models using EEG data. Key steps include generating synthetic EEG via forward modeling, comparing it to empirical EEG, and optimizing model parameters such as excitability. Validation results highlight the feasibility of capturing seizure propagation patterns using EEGbased models. In particular, topographic amplitude patterns (topographic maps) show a strong spatial correspondence between synthetic and real EEG, especially in regions identified clinically as seizure onset zones. Although functional connectivity comparisons show some qualitative similarities, further work is needed to improve their quantitative alignment. Frequency-specific analyses underscore the relevance of tailoring the model to epileptically meaningful bands, such as theta and gamma, which appear most sensitive to ictal activity. By reducing the invasiveness of data acquisition while maintaining biologically plausible seizure propagation dynamics, this work contributes to the development of clinically applicable, patientspecific simulations for epilepsy treatment. Future directions include integrating multimodal data and extending the framework to other neurological disorders. Keywords Epilepsy, Neural Mass Model, EEG, Forward Method
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 2 RESUMEN La epilepsia, un trastorno neurológico que afecta a millones de personas en todo el mundo, presenta importantes desafíos en su forma farmacorresistente, en la que los tratamientos estándar a menudo fallan. El proyecto GALVANI busca abordar estos retos mediante el desarrollo de modelos cerebrales completos personalizados que optimicen estrategias terapéuticas como la estimulación transcraneal por corriente y la cirugía. Estos modelos integran datos estructurales, funcionales y clínicos para simular la dinámica de las crisis y predecir los resultados del tratamiento. Este trabajo se centra en avanzar en la metodología de modelado cerebral completo, pasando de la estereoencefalografía invasiva (SEEG) a la electroencefalografía no invasiva de cuero cabelludo (EEG). Utilizando modelos de masas neuronales (NMMs) y conectividad estructural derivada de resonancia magnética por difusión (dMRI), se desarrolla un marco para personalizar modelos cerebrales completos usando datos de EEG. Las etapas clave incluyen la generación de EEG sintético mediante modelado directo (forward modeling), su comparación con el EEG empírico y la optimización de parámetros como la excitabilidad. Los resultados de validación muestran la viabilidad de capturar los patrones de propagación de las crisis mediante modelos basados en EEG. En particular, los mapas topográficos de amplitud muestran una fuerte correspondencia espacial entre el EEG sintético y el real, especialmente en las regiones identificadas clínicamente como zonas de inicio de la crisis. Aunque las comparaciones de conectividad funcional presentan ciertas similitudes cualitativas, se requiere trabajo adicional para mejorar su alineación cuantitativa. Los análisis específicos por banda de frecuencia subrayan la relevancia de adaptar el modelo a bandas clínicamente significativas como theta y gamma, que son especialmente sensibles a la actividad ictal. Al reducir la invasividad en la adquisición de datos manteniendo una dinámica de crisis biológicamente plausible, este trabajo contribuye al desarrollo de simulaciones clínicas personalizadas para el tratamiento de la epilepsia. Las líneas futuras incluyen la integración de datos multimodales y la extensión del marco a otros trastornos neurológicos. Palabras clave Epilepsia, modelo de masas neuronales, EEG, modelado directo
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 3 RESUM L’epilèpsia, un trastorn neurològic que afecta milions de persones arreu del món, presenta grans reptes en la seva forma farmacoresistent, en què els tractaments estàndard sovint no són efectius. El projecte GALVANI té com a objectiu afrontar aquests reptes mitjançant el desenvolupament de models personalitzats de cervell sencer per optimitzar estratègies terapèutiques com l’estimulació transcranial per corrent i la cirurgia. Aquests models integren dades estructurals, funcionals i clíniques per simular la dinàmica de les crisis i predir els resultats del tractament. Aquesta tesi se centra en avançar la metodologia de modelatge cerebral complet fent la transició de la estèreoencefalografia invasiva (SEEG) a l’electroencefalografia (EEG) no invasiva de cuir cabellut. Utilitzant models de masses neuronals (NMMs) i connectivitat estructural derivada d’imatges de ressonància magnètica per difusió (dMRI), s’ha desenvolupat un marc per personalitzar models de cervell sencer amb dades d’EEG. Els passos clau inclouen la generació d’EEG sintètic mitjançant modelatge directe (forward modeling), la seva comparació amb EEG empíric i l’optimització de paràmetres com l’excitabilitat. Els resultats de validació demostren la viabilitat de capturar patrons de propagació de les crisis mitjançant models basats en EEG. En particular, els mapes topogràfics d’amplitud mostren una forta correspondència espacial entre l’EEG sintètic i el real, especialment en les regions clínicament identificades com a zones d’inici de crisi. Tot i que les comparacions de connectivitat funcional mostren certes similituds qualitatives, calen millores per aconseguir una millor alineació quantitativa. Les anàlisis específiques per bandes de freqüència reforcen la importància d’adaptar el model a bandes significatives des del punt de vista epilèptic, com les bandes theta i gamma, especialment sensibles a l’activitat ictal. Aquest treball contribueix al desenvolupament de simulacions clíniques personalitzades per al tractament de l’epilèpsia, reduint la invasivitat en l’adquisició de dades i mantenint una dinàmica de propagació realista. Les línies futures inclouen la integració de dades multimodals i l’ampliació del marc a altres trastorns neurològics. Paraules clau Epilèpsia, model de masses neuronals, EEG, modelatge directe
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 4 CONTENTS ABSTRACT ................................................................................................................................. 1 GLOSSARY ................................................................................................................................ 6 LIST OF FIGURES ..................................................................................................................... 8 LIST OF TABLES ...................................................................................................................... 10 1.PREFACE .............................................................................................................................. 11 1.1. Origin of the project ........................................................................................................ 11 1.2. Motivation ....................................................................................................................... 11 1.3. Objectives ....................................................................................................................... 11 1.4. Requirements ................................................................................................................ 12 2. INTRODUCTION .................................................................................................................. 12 2.1. Background .................................................................................................................... 12 2.1.1. The GALVANI Project............................................................................................... 12 2.1.2. Epilepsy ................................................................................................................... 13 2.1.3. Simulation of Personalized Brain Models ................................................................. 16 2.2. Literature Review ............................................................................................................ 17 3. METHODOLOGY .................................................................................................................. 21 4. RESULTS ............................................................................................................................. 41 4.1. Data Preprocessing and Processing ............................................................................... 41 4.2. Evaluation of Signal Features and Connectivity Metrics .................................................. 47 4.2.1. Amplitude Envelope and Low Pass ............................................................................. 47 4.2.2. Connectivity Metrics Evaluation ............................................................................... 48 4.2.3. Topographic maps ................................................................................................... 50 4.2.4. Frequency Band Selection and Spectral Analysis .................................................... 50 4.3 Comparative Analysis between Synthetic and Empirical EEG ......................................... 52 4.4 Outcomes of Parameter Optimization .............................................................................. 56 4.5 Summary of Limitations and Ongoing Efforts ................................................................... 60 5. DISCUSSION ........................................................................................................................ 60 6. CONCLUSSIONS ................................................................................................................. 62 7. PLANNING ........................................................................................................................... 64 8. ECONOMIC ASSESSMENT ...................................................................................................... 65 9. ENVIRONMENTAL ASSESSMENT ............................................................................................. 66
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 5 10. SOCIAL AND GENDER EQUALITY ASSESSMENT ..................................................................... 68 BIBLIOGRAPHY ....................................................................................................................... 69 APPENDICES ........................................................................................................................... 72 Appendix A. SEEG Electrode Implantation Overview ......................................................... 72 Appendix B. Anatomical Localization of the Epileptogenic Zone ........................................ 73 Appendix C. EEG Electrode Names and Layout ................................................................ 73 Appendix D. Clinical and SEEG Data of the Second Subject Used for Comparative Analysis .......................................................................................................................................... 74 Appendix E: Overview of the Personalized Whole-Brain Modeling Pipeline (Lopez-Sola et al., 2025) ............................................................................................................................ 74 Appendix F. Data Preprocessing and Processing .............................................................. 76 Appendix G. Genetic Algorithm Parameters ......................................................................... 78 Appendix H: Genetic Algorithm Strategies for Cortical Parameter Optimization ..................... 79
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 6 GLOSSARY This glossary defines the key technical terms and concepts used throughout this Master's Thesis Project. o Amplitude Envelope: The instantaneous magnitude of a signal, obtained by applying the Hilbert transform. It is used to study slow amplitude fluctuations in EEG signals. o ARC File: A file that defines the personalized brain model architecture, specifying the excitability parameters of the nodes and the structural connectivity between regions. o CSD (Current Source Density): An estimate of the density of electrical current generated by neuronal sources, used as an intermediate step for simulating EEG signals. o dMRI (Diffusion Magnetic Resonance Imaging): A neuroimaging technique that captures the diffusion of water molecules in brain tissue, allowing the reconstruction of white matter fiber pathways and structural connectomes. o EEG (Electroencephalography): A technique for recording the brain’s electrical activity via electrodes placed on the scalp. o Electrode Space: The measurement space where EEG signals are recorded at the scalp electrodes, without reconstructing the underlying source activity. o FEM (Finite Element Method): A numerical method used to solve the EEG forward problem, modeling the conduction of electrical signals through different head tissues (scalp, skull, CSF, brain). o Forward Model: The mathematical model that relates neural sources inside the brain to the potentials measured on the scalp electrodes, usually computed using methods such as FEM. o Functional Connectivity (FC): A measure of the synchronization or functional relationships between brain regions, often evaluated using EEG or SEEG signals. o Genetic Algorithm (GA): An optimization method inspired by biological evolution, used to adjust brain model parameters by comparing synthetic and empirical EEG data. o Hilbert Transform: A mathematical transform used to compute the amplitude envelope of a signal, crucial for EEG signal feature extraction. o Inverse Method: A computational technique used to estimate the cortical source activity from EEG signals recorded at the scalp (moving from electrode space to source space). o MRI (Magnetic Resonance Imaging): A neuroimaging technique providing high-resolution anatomical images of the brain. o Neural Mass Model (NMM): A mathematical model simulating the average activity of populations of neurons within a brain region. o PCC (Pearson Correlation Coefficient): A statistical measure of linear correlation between two datasets. It is used to compare empirical and synthetic signals in this work. o SEEG (Stereo-Electroencephalography): An invasive method for recording electrical brain activity using electrodes implanted within brain tissue. o Source Space: The reconstructed space that represents the estimated cortical origins of EEG signals.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 13 iii. Personalizing these protocols using hybrid brain models (HBMs) based on clinical data. iv. Clinically validating the personalized treatments through patient trials Contribution to GALVANI This work contributes to the GALVANI project by developing a pipeline that utilizes non-invasive EEG data to personalize whole-brain models. The contribution involves: o Processing empirical EEG ictal data from GALVANI patients. o Validating the personalized models by comparing synthetic and real EEG data. o Replacing or complementing SEEG data with EEG for the personalization of models. o Adjusting key model parameters, such as excitability and global coupling, using optimization algorithms. The aim is to demonstrate that EEG-based personalization offers a noninvasive and precise solution for simulating seizure dynamics and evaluating personalized treatments in patients with drug-resistant focal epilepsy. 2.1.2. Epilepsy Definition and Global Impact Epilepsy is a chronic neurological disorder characterized by recurrent and unprovoked seizures, resulting from abnormal electrical activity in the brain. It affects approximately 50 million people worldwide, making it one of the most common neurological conditions globally, according to the World Health Organization (WHO). The prevalence of epilepsy is estimated at 4 to 10 cases per 1,000 people, with higher rates observed in lowand middle-income countries due to limited access to healthcare and increased exposure to risk factors such as head injuries and infections. Pharmacoresistant Epilepsy Approximately 30% of patients with epilepsy are considered pharmacoresistant, meaning their seizures do not respond to at least two appropriately chosen and administered antiseizure medications (ASMs). This condition, known as drugresistant epilepsy (DRE), significantly reduces the quality of life and increases the risk of comorbidities, including depression, anxiety, and cognitive impairment.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 14 Current Treatments a. Antiseizure Medications (ASMs): ASMs are the first-line treatment for epilepsy, aiming to suppress seizures by modulating neuronal excitability. Common drugs include carbamazepine, valproate, and levetiracetam. While effective for many, long-term use can lead to side effects, including fatigue, dizziness, and mood changes. b. Surgical Interventions: For patients with focal epilepsy, surgical resection of the epileptogenic zone (EZ) may offer a curative approach. This method is most effective in well-localized epileptogenic areas but carries risks such as neurological deficits. c. Neurostimulation Therapies: Neurostimulation methods include: • Vagus Nerve Stimulation (VNS): Implantable devices that deliver electrical pulses to the vagus nerve, modulating brain activity. • Deep Brain Stimulation (DBS): Electrodes implanted in specific brain regions to regulate seizure activity. • Responsive Neurostimulation (RNS): Closed-loop systems that detect and suppress abnormal brain activity in real-time. 1. Transcranial Electrical Stimulation (tES): Transcranial electrical stimulation is a non-invasive neuromodulation technique that uses weak electrical currents applied to the scalp to modulate cortical excitability. Its subtypes include: ▪ Transcranial Direct Current Stimulation (tDCS): Applies a constant current to either increase (anodal tDCS) or decrease (cathodal tDCS) cortical excitability. ▪ Transcranial Alternating Current Stimulation (tACS): Uses sinusoidal currents to entrain brain oscillations at specific frequencies. ▪ Transcranial Random Noise Stimulation (tRNS): Applies randomly varying currents to influence neuronal plasticity. The Role of tES in Epilepsy Transcranial electrical stimulation (tES) has emerged as a promising neuromodulatory technique for the treatment of drug-resistant epilepsy (DRE). Unlike invasive methods such as deep brain stimulation (DBS) or vagus nerve stimulation (VNS), tES is non-invasive, safe, and well-tolerated. It involves the application of low-intensity electrical currents (<2 mA) to modulate cortical excitability through electrodes placed on the scalp.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 15 The two primary forms of tES are: 1. Transcranial Direct Current Stimulation (tDCS): • Uses a constant current to modulate neural activity. • Cathodal stimulation over the epileptogenic zone inhibits cortical excitability, while anodal stimulation is excitatory. • Clinical trials have shown reductions in seizure frequency, with effects lasting for weeks after repeated sessions. 2. Transcranial Alternating Current Stimulation (tACS): • Applies sinusoidal currents to entrain brain oscillations. • Although less studied, preliminary findings suggest potential for suppressing epileptiform discharges. Mechanisms of Action • Hyperpolarization and depolarization: Depending on current direction, neurons become less or more excitable. • Network effects: Beyond local stimulation, tES influences largescale brain networks, reducing abnormal synchrony within epileptogenic networks. Clinical and Computational Insights Clinical studies have demonstrated the efficacy of cathodal tDCS in reducing interictal epileptiform discharges and seizure frequency. Computational models complement these findings by simulating electric field distributions and optimizing stimulation parameters to maximize therapeutic effects while minimizing undesired activation.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 16 Figure 1 Effects of tES on Neural Activity and Networks [3]. Illustration of the mechanisms of transcranial electrical stimulation, including tDCS and tACS. The figure shows electrode placement, current flow through the brain, and the resulting effects on neuronal excitability and network synchronization. Future Challenges Despite advancements, several challenges remain: - Identifying optimal stimulation protocols and parameters for individual patients. - Understanding long-term effects and potential neuroplastic changes induced by tES. - Integrating tES into standard clinical workflows as a complement or alternative to current treatments. 2.1.3. Simulation of Personalized Brain Models The use of computational models to simulate brain activity has become an increasingly powerful approach in neuroscience and clinical research. These models aim to reproduce large-scale brain dynamics by mathematically representing the interactions between different brain regions. One of the most promising developments in this field is the emergence of personalized brain models, which incorporate subjectspecific anatomical and physiological data to simulate how an individual brain behaves under healthy or pathological conditions.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 17 In the context of neurological disorders, such as epilepsy, personalized simulations offer a novel way to understand disease mechanisms and support clinical decision-making. Unlike traditional diagnostic tools, brain models provide a dynamic and patient-specific view of how seizures originate and propagate across the brain's network. They also make it possible to test interventions virtually, offering a safe and controlled environment to explore the potential outcomes of different therapeutic strategies. These simulations are built using a combination of neuroimaging data (e.g., MRI, dMRI) and electrophysiological recordings (e.g., EEG or SEEG), allowing researchers to reconstruct both the structure and function of the brain. Once the model is constructed, computational methods can be used to simulate brain activity and compare it with real data. Through this iterative process, the model parameters can be adjusted to align with the patient’s condition, leading to highly individualized insights. As the field evolves, brain modeling is becoming an essential component in the movement toward precision medicine, enabling the design of treatments that are tailored not only to the type of pathology, but to the unique neural architecture of each patient. 2.2. Literature Review In recent years, computational modeling has become an increasingly valuable tool in the study and treatment of epilepsy, particularly for understanding seizure dynamics and optimizing presurgical planning. These approaches typically rely on whole-brain models composed of neural mass models (NMMs) personalized using patient-specific data. Most studies have utilized invasive recordings, such as stereo electroencephalography (SEEG), due to their high spatial precision. However, recent efforts have sought to adapt these pipelines to scalp EEG, which presents challenges in terms of signal quality, spatial resolution, and source localization. This review explores the current state of the art in inverse and forward modeling, brain connectivity analysis, neural mass modeling, optimization algorithms, and the role of frequency bands, aiming to provide a comprehensive context for the methodological contributions of this work. Inverse and Forward Modeling A central step in EEG-based brain modeling is the estimation of cortical source activity. This is addressed through inverse modeling, which reconstructs brain activity from the scalp-recorded signals. In [4],the authors use eLORETA, a linear inverse method that computes approximately 8,004 sources to generate a detailed
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 18 three-dimensional model of cortical dynamics. Due to computational constraints, the study proposes a reduction of the source space using the Desikan-Killiany atlas, resulting in 15 anatomically relevant regions of interest (ROIs). While this reduction improves efficiency, the model retains enough spatial detail to simulate large-scale brain dynamics. Beamforming is another inverse method that offers high spatial resolution, particularly when used with high-density EEG (HD-EEG). By constructing adaptive spatial filters, beamforming enhances the accuracy of source localization and, when combined with Independent Component Analysis (ICA), improves the separation of overlapping neural sources. These methods are explored in [5], which emphasizes their capacity to increase the accuracy of functional mapping in epilepsy. Forward modeling, on the other hand, deals with projecting simulated cortical activity onto the scalp. Several forward models are described in the literature. The Finite Element Method (FEM), as described in [6], accounts for the complex geometry and anisotropic conductivity of brain tissues, providing highly accurate projections. The Boundary Element Method (BEM), used in [4] [7], simplifies the head model by focusing on boundary surfaces, offering a good balance between computational load and anatomical precision. Other approaches, such as reciprocal methods and concentric spherical approximations, are discussed in [4] [8], as fast but less anatomically accurate alternatives, appropriate for exploratory or resource-constrained applications. Each method has its own application niche. FEM is particularly suited for patientspecific SEEG models that require fine-grained accuracy, while BEM and spherical methods are more compatible with non-invasive EEG applications where computational efficiency is prioritized. High-density EEG (HD-EEG) plays a vital role in enhancing the spatial resolution of inverse modeling techniques. As detailed in [9], increasing the number of electrodes improves sampling of the scalp potential and enhances the ability to resolve closely spaced sources. This makes HD-EEG a valuable bridge between traditional EEG and invasive methods like SEEG. When used alongside ICA and beamforming, HD-EEG significantly improves the fidelity of source space estimations, which is crucial for reliable modeling. Structural and Functional Connectivity Once the neural activity is projected into the source or electrode space, the next step involves constructing connectivity matrices that describe interactions between different brain regions. Structural connectivity is defined by the number and strength of white matter tracts linking different parcels and is typically extracted from diffusion MRI (dMRI). Functional connectivity, in contrast, is based on the statistical dependencies between neural signals. Various metrics are used to estimate these dependencies.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 19 Phase-based metrics such as Phase Locking Value (PLV) [4], Phase Lag Index (PLI) [5], and coherence [9] capture synchronous oscillations between regions, while amplitude-based metrics like Amplitude Envelope Correlation (AEC) [10] and Pearson Correlation Coefficient (PCC) [8] assess co-fluctuations in signal intensity. Time-lagged interactions can also be measured using cross-correlation, as described in [7]. To ensure the robustness of these connectivity estimates, studies such as [4] recommend the use of surrogate data to establish statistical significance thresholds. This approach filters spurious connections that may arise due to noise or volume conduction, improving the interpretability of functional networks. Advanced analytical techniques further extend functional connectivity analysis. Directed connectivity metrics such as Granger Causality, Directed Transfer Function (DTF), and Partial Directed Coherence (PDC) are used to infer the directionality of information flow between brain regions [5]. Graph theoretical approaches also play an important role, offering network-level descriptors like betweenness centrality to identify nodes that are critical for seizure propagation and network synchronization. Neural Mass Models (NMMs) Whole-brain computational models are built by assigning neural mass models to the regions defined in the parcellation. These models simulate the collective behavior of neuronal populations and are key to reproducing observed brain dynamics. Various types of NMMs have been proposed in the literature. The Jansen-Rit model [11] simulates alpha rhythms and represents interactions between pyramidal cells and inhibitory interneurons. The Wendling model [8], an extension of Jansen-Rit, adds additional inhibitory feedback loops to capture the dynamics of epileptic discharges. The Theta model [4] conceptualizes each node as a phase oscillator, making it suitable for analyzing ictogenicity. The Laminar Neural Mass Model (LaNMM) [12] [10] incorporates a layered cortical structure to simulate both alpha and gamma band activity. Finally, the López-Sola model [12] [8] introduces chloride accumulation mechanisms to simulate ictogenesis and seizure propagation, offering a biophysically grounded alternative to classical NMMs. Optimization Algorithms Personalization of the whole-brain model is achieved through parameter optimization. Several optimization strategies have been adopted through literature. Genetic Algorithms (GA) use evolutionary techniques including crossover, mutation, and selection to identify optimal parameter sets. Particle Swarm
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 20 Optimization (PSO) [5] mimics the behavior of swarming animals and excels at exploring high-dimensional spaces. Other methods include Simulated Annealing [8], which uses probabilistic sampling to avoid local minimum, and gradient descent techniques, which provide efficient fine-tuning. Bayesian Optimization is also gaining attention for its ability to incorporate prior knowledge and uncertainty in the optimization process. These techniques have been used to minimize loss functions based on signal similarity, functional connectivity distance, or topographic correlation. Frequency Bands in Epilepsy Modeling EEG signals are typically analyzed across canonical frequency bands, each associated with different physiological and pathological processes. In [9], delta (0.5–4 Hz) and theta (4–8 Hz) activity are shown to dominate during the early stages of seizures, while alpha (8–12 Hz) rhythms tend to be suppressed. Beta (13–30 Hz) and gamma (>30 Hz) bands are often associated with hyperexcitability and synchronization near the seizure onset zone. Functional connectivity dynamics also vary across frequency bands. This has led to the development of multifrequency analysis approaches, where functional connectivity is computed independently for each band using metrics such as PLV, coherence, and AEC. These band-specific matrices are then used to guide optimization and validate the models across different dynamical regimes. The integration of multifrequency features improves model generalizability and enhances the identification of epileptic networks. Whole-Brain Models in Epilepsy Recent advances in epilepsy modeling emphasize personalized whole-brain approaches. The Virtual Epileptic Patient (VEP) represents a prominent framework, providing patient-specific brain atlases and personalized large-scale models that simulate seizure initiation and propagation [13] [14] [15].The VEP utilizes structural connectivity derived from dMRI and integrates clinical SEEG data to personalize model parameters. It has demonstrated utility in predicting epilepsy surgery outcomes, identifying seizure onset zones, and guiding therapeutic interventions such as targeted neurostimulation [16]. Jirsa et al. (2017) initially introduced the VEP, establishing foundational methods for constructing individualized brain networks capable of simulating patient-specific seizure dynamics [14]. Subsequent refinements integrated probabilistic frameworks (Bayesian Virtual Epileptic Patient) to better capture uncertainty in epileptogenic zone localization and improve predictive accuracy [13]. Additional studies employing similar personalized whole-brain models have examined structural network characteristics, connectivity disruptions, and specific hypotheses related to epilepsy surgery planning.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 21 These frameworks have primarily relied on invasive SEEG due to superior spatial precision. However, recent attempts increasingly seek to adapt whole-brain modeling to scalp EEG, addressing practical limitations of invasive approaches. Such EEG-based modeling has employed inverse methods, advanced signal processing techniques, and optimization algorithms to overcome inherent challenges related to limited spatial resolution and source localization uncertainty. Summary and Motivation In summary, literature provides a solid foundation for building whole-brain models of epilepsy using structural and functional data. However, most existing approaches rely on source-reconstructed EEG or invasive SEEG, both of which introduce assumptions and clinical limitations. This thesis proposes an alternative pipeline that performs model fitting directly in the electrode space using standard scalp EEG recordings. By avoiding the inverse modeling step and combining signal processing techniques with whole-brain simulations, this approach aims to enable a more accessible and non-invasive framework for personalized modeling in clinical settings. 3. METHODOLOGY This section describes the methodological framework developed to personalize whole-brain computational models using non-invasive EEG data, with the objective of replicating seizure propagation in patients diagnosed with drug-resistant epilepsy. The approach builds upon existing modeling pipelines initially developed using stereo-electroencephalography (SEEG), adapting them to scalp EEG signals. This adaptation not only broadens the applicability of the method to non-invasive clinical settings but also introduces new challenges related to signal resolution and spatial coverage. The methodology is organized in two main blocks. First, we present the tools, datasets, and computational models used in the study. Then, we describe in detail the pipeline developed for EEG-based personalization of whole-brain models. 3.1. Tools and Resources A fundamental component of the methodology used in this study involves leveraging established tools, resources, and computational pipelines. The effectiveness and accuracy of our results depend significantly on these existing frameworks and the robustness of available software and data-processing workflows. 3.1.1. Patient Data and Neuroimaging Resources
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 22 The development of this project required access to comprehensive multimodal datasets from a single patient diagnosed with drug-resistant focal epilepsy. These datasets included: Clinical annotations, particularly the precise localization of the epileptogenic zone (EZ), which was provided by the clinical team. According to their assessment, the EZ was located in the left occipital cortex, specifically in parcels 65 and 69 of the Virtual Epileptic Patient (VEP) atlas. The anatomical parcellation from the VEP atlas with the epileptogenic parcels 65 and 69 specifically marked is illustrated in Appendix B. Neuroimaging data, including: High-resolution T1-weighted MRI for anatomical reconstruction and parcellation and Diffusion MRI (dMRI) for the estimation of structural connectivity via tractography. Electrophysiological recordings, which were essential for model fitting and validation: Stereo-electroencephalography (SEEG): Depth electrodes were implanted in targeted brain regions, particularly around the left occipital lobe. Grey matter contacts confirmed implantation near clinically suspected EZ regions. A detailed listing of SEEG contact coordinates and anatomical labels is provided in Appendix A. Scalp EEG: High-density EEG was recorded using a 64-channel cap (10–10 international system) at a sampling frequency of 1024 Hz. The full list of channels and metadata is provided in Appendix C. In addition to the subject described above, a brain model from another subject is used for comparison. Data from this new subject are shown in Appendix D. 3.1.2. Whole Brain Model Architecture The whole-brain model (WBM) used in this project is a personalized computational framework developed within the Galvani project for simulating seizure propagation in patients with drug-resistant epilepsy. This model is built from individual patient data and integrates anatomical, structural, and functional information to reproduce realistic large-scale brain dynamics. Patient-specific magnetic resonance imaging (MRI) is used to generate a custom cortical surface model, which is then parcellated into 162 anatomically and functionally relevant regions using the Virtual Epileptic Patient (VEP) atlas. This atlas divides the cortex into 73 parcels per hemisphere, plus 8 subcortical regions per hemisphere. The parcellation supports precise anatomical mapping and allows consistent electrode-toparcel assignments.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 29 Both EEG datasets undergo identical processing steps: band pass filtering, feature extraction and low pass filtering. To ensure temporal consistency, a 30-second window is selected for analysis in both EEG datasets. This window spans from 10 seconds before seizure onset to 20 seconds after onset, allowing the capture of pre-ictal, ictal, and post-ictal dynamics. 3.2.2. Feature Extraction and Functional Connectivity Metrics To extract relevant information from both empirical and synthetic EEG signals, various To extract relevant information from both empirical and synthetic EEG signals, various temporal and spectral features were initially explored. Although multiple options were considered for capturing neural dynamics, the Amplitude Envelope, derived via the Hilbert Transform, was ultimately selected as the most suitable feature for subsequent model evaluation and comparison. This decision was supported by both the empirical results obtained and recommendations from relevant literature. The Amplitude Envelope captures the instantaneous magnitude of oscillatory activity and provides a smooth, time-resolved representation of signal fluctuations. This feature proved particularly effective in identifying the spatial distribution of epileptiform activity and enabled robust comparisons between empirical and simulated EEG signals in the electrode space. Hilbert Transform and Amplitude Envelope Extraction: The analytic signal 𝑧(𝑡)is computed from a real-valued EEG time series 𝑥(𝑡) (real-valued EEG signal) using the Hilbert transform 𝐻(𝑥(𝑡)) (Hilbert transform), as follows: 𝑧(𝑡)=𝑥(𝑡)+𝑖𝐻[𝑥(𝑡)] (2) The Amplitude Envelope 𝐴(𝑡) is then obtained as the magnitude of the analytic signal: 𝐴(𝑡)=|𝑧(𝑡)|=√𝑥(𝑡)2+𝐻(𝑥(𝑡))2 (3) The feature was extracted after filtering the signals to the theta band (4–10 Hz), which is often associated with ictal and pre-ictal dynamics in focal epilepsy [6]. The envelope preserves both instantaneous amplitude and phase information and is particularly suitable for identifying propagating seizure patterns. In our pipeline, the envelope is further lowpass filtered (0.1–1 Hz) to isolate slow cortical modulations, aligning with observations in previous epilepsy studies and prior work in the GALVANI project. Functional Connectivity Metrics:
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 30 i. Pearson Correlation Coefficient (PCC): Measures linear dependencies between two signals: 𝜑𝑥𝑦=𝑐𝑜𝑣(𝑥,𝑦) 𝜎𝑥𝜎𝑦 (4) It is particularly effective in evaluating amplitude-based synchrony. ii. Cross-Correlation (CC): Evaluates the similarity between two signals as a function of time lag: 𝑅𝑥𝑦(𝜏)=∑𝑥(𝑡)𝑦(𝑡+𝜏) (5) This is useful for identifying delays in propagation. iii. Coherence: Measures of frequency-dependent correlation between signals: 𝐶𝑥𝑦(𝑓)=|𝑆𝑥𝑦(𝑓)|2 𝑆𝑥𝑥(𝑓)𝑆𝑦𝑦(𝑓) (6) It reflects the degree of phase and amplitude coupling across frequencies. iv. Phase Locking Value (PLV): Captures phase synchronization across trials or time: 𝑃𝐿𝑉=|1𝑁∑𝑒𝑖(𝜃𝑥(𝑛)−𝜃𝑦(𝑛) 𝑁 𝑛=1 |(7) Higher values indicate consistent phase differences. Other metrics such as imaginary coherence and phase lag index have also been tested but are not shown because they were not considered relevant. To quantify the spatial similarity between empirical and synthetic topographic maps, the following techniques were applied: i. Global Map Dissimilarity (GMD): Standardize each vector by centering and scaling to unit 𝐿2norm [22]: 𝑢′=𝑢−𝑢 ‖𝑢−𝑢‖2 𝑣′=𝑣−𝑣 ‖𝑣−𝑣‖2 (8)
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 31 Compute dissimilarity: 𝐺𝑀𝐷(𝑢,𝑣)= √1𝑁∑(𝑢𝑖′−𝑣𝑖′)2 𝑁 𝑖=1 , 0≤𝐺𝑀𝐷≤2 (9) ii. Spatial Pearson Correlation: Flatten the interpolated values into vectors of length and compute: 𝜌𝑖𝑚𝑔=𝑐𝑜𝑟𝑟({𝑢𝑖}𝑖=1 𝑀,{𝑣𝑖}𝑖=1 𝑀)(10) iii. Root Mean Square Error (RMSE): quantifies the average amplitude difference between empirical and synthetic topographic maps: 𝑅𝑀𝑆𝐸=√1 𝑀∑(𝑢𝑗−𝑣𝑗)2 𝑀 𝑗=1 (11) Where 𝑢𝑗 and 𝑣𝑗 are the interpolated values at each scalp location and MMM is the number of valid pixels. Lower RMSE indicates closer amplitude match, making it complementary to correlation-based metrics. iv. Cluster-wise Metrics: Partition electrodes into predefined regions of interest (clusters) For each cluster C, extract sub-vectors 𝑢𝑐, 𝑣𝑐 and compute the different metrics. Together, these features and metrics provide a robust framework for quantifying the temporal, spectral, and spatial structure of epileptiform dynamics in both empirical and simulated EEG data. Frequency Bands and Spectral Analysis A crucial component of EEG analysis is the identification and interpretation of specific frequency bands, as different neural processes—and particularly epileptiform dynamics— are preferentially expressed in distinct spectral ranges. EEG signals are commonly decomposed into canonical frequency bands:
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 32 • Delta (0.5–4 Hz): Often associated with deep sleep stages and slow-wave activity. In epilepsy, increased delta activity may be observed interictally. • Theta (4–8 Hz): Frequently linked to drowsiness and cognitive processing. Notably, this band has shown relevance in ictal and pre-ictal phases of focal epilepsy. • Alpha (8–12 Hz): Typically represents relaxed wakefulness and is often suppressed during seizures. • Beta (13–30 Hz): Associated with motor activity and alertness. Abnormal beta power may emerge in epileptic networks. • Gamma (>30 Hz): High-frequency oscillations (HFOs) in this band, especially 80– 150 Hz, are often considered biomarkers of epileptogenic zones. The analysis of EEG activity across these bands can reveal both local and network-level alterations in brain dynamics. In this work, special emphasis is placed on the theta band (4–10 Hz), which was empirically and bibliographically validated as the most representative for seizure propagation in our case study. Spectral Analysis Techniques: i. Power Spectral Density (PSD): Already described in Section 4.2, PSD reveals how power is distributed across frequencies. It is used to compare energy levels in specific bands between empirical and synthetic EEG signals. ii. Spectrograms: These represent the evolution of signal power over both time and frequency using short-time Fourier transforms (STFT) iii. Band Power Estimation: The total power within each canonical band is computed by integrating the PSD over the corresponding frequency interval. This allows comparison of band-specific power distributions across different brain states. Together, these techniques provide a comprehensive spectral characterization of EEG dynamics. Their integration into the modeling pipeline allows a multi-band validation of synthetic EEG outputs and supports the identification of frequency-dependent abnormalities typical of epileptic networks. 3.2.3. Comparison Between Synthetic and Empirical EEG The comparison between synthetic and empirical EEG is conducted using two complementary strategies: i. Topographic comparison: EEG amplitude envelopes are visualized as cortical activation maps (topographic maps), either dynamically over time or as averages across the selected window. Qualitatively, this allows the observation of spatial
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 33 activation patterns and their spread, aiding visual identification of focal onset and propagation. Quantitatively, the spatial correlation between topographic maps is computed using Pearson correlation. Additionally, the mean amplitude vector (one value per electrode) is extracted from each EEG type and compared using Pearson correlation to evaluate global topographic similarity. ii. Functional connectivity comparison: Functional connectivity matrices are computed from both datasets using multiple metrics: Pearson correlation, crosscorrelation, coherence, imaginary coherence, and Phase Locking Value (PLV). These matrices are compared visually to identify similarities in network structure and clustering patterns. Quantitatively, matrix-to-matrix correlations are computed using Pearson correlation of the upper triangular elements to assess the alignment between empirical and synthetic connectivity. Together, these analyses provide a robust framework for assessing both spatial and network-level correspondence between model-generated EEG signals and real patient data. The outcomes of these comparisons are discussed in the Results section. The results of these comparisons are presented in the Results section. The outcome of this comparison, quantified using features such as topographic amplitude and functional connectivity, provides the objective function for the optimization algorithms. Without establishing this comparison step, there would be no reference metric to guide parameter fitting. On the other hand, this comparison also acts as a validation tool. Since the reference model has already been fitted using SEEG data, we expect it to replicate the spatiotemporal dynamics of seizure propagation. If the synthetic EEG generated from this model aligns well with the real EEG of the same subject—both in terms of spatial distribution (topographic maps) and network structure (functional connectivity matrices)—it provides strong evidence that the model is realistic and physiologically meaningful. It is also important to emphasize that while the long-term goal is to perform model personalization solely from scalp EEG data, the initial model is limited to the areas covered by SEEG electrodes. In our case, SEEG recordings were obtained primarily from occipital regions, based on prior clinical knowledge regarding the seizure focus. This means that only those brain parcels with implanted electrodes were originally fitted. As a result, regions without SEEG coverage—such as the central cortex—retain default excitability parameters and are not accurately modeled. To address this limitation, the current work proposes using EEG data to complement SEEG and improve model accuracy across the entire cortex. Initially, this is done by refining the SEEG-based model using EEG-derived features. In future work, this approach could be extended to fit models exclusively from non-invasive EEG, which would dramatically expand the clinical applicability of whole-brain modeling. Throughout the comparative analysis between empirical and synthetic EEG signals, we incorporated a validation step using additional comparisons. Specifically, empirical functional connectivity matrices and topographic distributions were compared not only
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 34 with the subject-specific synthetic EEG data but also with synthetic EEG data from another subject and with randomly generated EEG matrices. This validation served as a baseline to contextualize and interpret the significance of the computed Pearson correlation coefficients. For example, a moderate Pearson correlation value of 0.4 between empirical and subject-specific synthetic connectivity matrices might initially appear low. However, if comparisons with another subject's synthetic connectivity yield correlation values near zero (e.g., 0.01), this original 0.4 correlation gains significance. Conversely, if a seemingly high correlation (e.g., 0.8) is similarly achieved with synthetic data from an unrelated subject, the interpretative value of the metric might be reconsidered. This step provided a contextually grounded benchmark, reinforcing confidence in our comparative analyses and aiding in interpreting the quantitative metrics obtained. 3.2.4. Parameter Optimization Strategies In this section, we describe in detail the parameter optimization strategies implemented in this work. Initially, the primary objective of the project was to develop methods capable of fitting and personalizing model parameters directly and exclusively from non-invasive EEG data. However, as the research progressed, it became evident that an intermediate step would be beneficial. Rather than immediately replacing SEEG data, we first explored using EEG data to complement and enhance the existing SEEG-based model. The main reason for this approach is that SEEG provides precise and localized recordings of cortical electrical activity, but its spatial coverage is inherently limited to areas where electrodes are implanted. In our particular case, SEEG electrodes were primarily placed in occipital regions, guided by prior clinical knowledge about the seizure focus. Consequently, only brain parcels directly associated with these electrodes were initially fitted, leaving other cortical regions—such as the central cortex—with default excitability values that might not accurately reflect the underlying physiology. To address this limitation in spatial coverage, EEG data—which non-invasively covers the entire cortical surface—was introduced as a complementary source of information. This allowed us to refine and improve the initial SEEG-based model, achieving a more accurate and comprehensive personalization across previously unfitted cortical regions. Once this hybrid fitting approach is validated, future research could aim to personalize whole-brain models exclusively from EEG, significantly broadening the model’s clinical applicability. The following subsections detail the specific optimization techniques and algorithms employed to achieve this parameter refinement. ❖ Mask-based Optimization Approach in Source Space
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 35 The first optimization strategy implemented in this study utilizes a mask-based approach within the source space. The general aim is to identify and refine the excitability parameters (𝑊𝑒𝑥𝑐) of specific cortical parcels by quantifying differences between the empirical EEG data and the synthetic EEG signals generated by the model. Step 1: Inverse Modeling of Empirical EEG Initially, we need to obtain source-space signals from the empirical EEG recorded in electrode space. To achieve this, we employed inverse methods, specifically the Minimum Norm Estimate (MNE) and Standardized Low Resolution Brain Electromagnetic Tomography (sLORETA). Both approaches rely on previously computed forward modeling (leadfield) solutions and the known locations of electrodes and cortical parcels (as defined by the Virtual Epileptic Patient, VEP, atlas with 162 parcels). Minimum Norm Estimate (MNE): MNE estimates the source activity by minimizing the L2-norm of the source currents while accounting for the measured electrode data, according to the equation: 𝑋𝑀𝑁𝐸=𝐿𝑇(𝐿𝐿𝑇+𝜆𝐶𝑛)−1𝑌 (12) Where: o 𝑋𝑀𝑁𝐸 are the estimated source currents (source-space signals). o Y is the EEG data in electrode space. o L is the leadfield matrix. o λ is a regularization parameter that balances between data fidelity and source complexity. o Cn is the noise covariance matrix. Standardized Low Resolution Brain Electromagnetic Tomography (sLORETA): sLORETA is a variation of MNE, which standardizes the current source estimates by the variance of the estimates. This improves localization accuracy by ensuring standardized spatial resolution across the cortex: 𝑋𝑠𝐿𝑂𝑅𝐸𝑇𝐴,𝑖=𝑋𝑀𝑁𝐸,𝑖 √[𝐿𝑇(𝐿𝐿𝑇+𝜆𝐶𝑛)−1𝐿]𝑖𝑖 (13) In both methods, the previously calculated leadfield matrix L, electrode locations, and cortical parcels from the VEP atlas are used. After applying these inverse methods, we obtain 162 time series representing neural activity for each cortical parcel. Step 2: Calculation of the Difference Mask
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 36 Once empirical EEG signals have been projected into source space (162 parcels), both the empirical and synthetic source-space signals are individually normalized (scaling values between 0 and 1) before computing their difference. The difference mask for each parcel I is then calculated using the following formula: 𝑀𝑎𝑠𝑘𝑖=||𝑋𝑒𝑚𝑝𝑖𝑟𝑖𝑐𝑎𝑙,𝑖 𝑛𝑜𝑟𝑚 − 𝑋𝑠𝑦𝑛𝑡ℎ𝑒𝑡𝑖𝑐,𝑖 𝑛𝑜𝑟𝑚 || (14) This yields a normalized mask value between 0 and 1 for each cortical parcel: o A mask value close to 0 indicates strong similarity between empirical and synthetic signals for that parcel, suggesting that no further adjustment of excitability is required. o Conversely, a mask value close to 1 highlight substantial difference, suggesting that parcel excitability parameters (𝑊𝑒𝑥𝑐) require adjustment to achieve better model alignment with empirical data. Step 3: Adjusting Parcel Excitability Parameters To adjust the excitability parameters (𝑊𝑒𝑥𝑐) based on the mask, we apply the following formula for each parcel iii: 𝑊𝑖=𝑊𝑖,𝑜+𝛼·𝑀𝑎𝑠𝑘𝑖 , 𝑊𝑖,0=3 (15) Where: o 𝑊𝑖,0 represents the original excitability parameter value for parcel i, which is initialized to 3 (representing a physiologically healthy state). o 𝛼 is a global scaling parameter, ranging between 0 and 7, used to modulate the degree of excitability adjustment according to the mask. o Importantly, the excitability parameters previously adjusted using SEEG recordings are never modified, ensuring consistency in areas where clinical data already exist. Only parcels not covered by SEEG recordings are subject to this optimization process. Step 4: Iterative Parameter Optimization The optimization procedure systematically tests multiple α\alphaα values between 0 and 7. For each α\alphaα: i. A new excitability configuration (𝑊𝑒𝑥𝑐) is computed according to the mask-based formula above.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 37 ii. The new cortical excitability parameters are introduced into a new ARC (architecture) file, defining the personalized whole-brain model structure. iii. The whole-brain model is re-simulated using the updated ARC configuration. iv. From the resulting simulation, a new synthetic EEG is extracted. v. The new synthetic EEG is quantitatively compared with the empirical EEG using Pearson correlation, evaluating how well the adjusted model aligns with the real patient data. After completing these steps for each α\alphaα, we obtain a quantitative measure of model performance (correlation values between synthetic and empirical EEGs) as a function of the scaling parameter α\alphaα. This produces a correlation curve illustrating the relationship between α\alphaα values and EEG fitting accuracy, from which we identify the optimal value of α\alphaα that maximizes similarity between simulated and empirical EEG signals. The results of this optimization process, specifically the correlation curves and the identified optimal value for α\alphaα, are presented and discussed in detail in the Results section of this thesis. ❖ Manual Excitability Adjustment Guided by Visual and LiteratureBased Analysis Another optimization approach explored in this study was the direct adjustment of cortical parcel excitability (𝑊𝑒𝑥𝑐) parameters guided primarily by visual inspection and literature-supported analysis, independently from the previously described maskbased approach. This strategy, termed here as "manual" adjustment, involved systematically increasing the excitability of specific cortical parcels identified as requiring refinement. Importantly, the term "manual" refers specifically to the decision-making process underlying parcel selection and the excitability values assigned. While the modification of parameters was executed programmatically through custom-written code (i.e., the ARC files were not manually edited directly), the determination of which parcels to modify, and the specific excitability increments applied (primarily tested at fixed values such as 5 or 7 for practicality), were based on human judgment rather than automated algorithms. The parcel selection process followed two main criteria: o Literature-Based Identification:
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 38 Parcels associated with cortical regions identified through a comprehensive literature review as particularly relevant for seizure propagation or epileptogenic activity. o Visual Comparative Analysis: Parcels corresponding to cortical areas visually identified as showing substantial discrepancies between empirical and synthetic EEG topographic maps (topographic maps), suggesting insufficient or unrealistic simulated neural activity in comparison with the observed empirical data. After identifying candidate parcels through these criteria, we proceeded with the iterative, code-based modification procedure as follows: i. Parameter adjustment (code-based): Excitability parameters (𝑊𝑒𝑥𝑐) of selected parcels were systematically increased from the original baseline of 3 to predetermined testing values (typically 5 or 7). ii. Whole-brain model re-simulation: After each adjustment, a new ARC architecture file was generated programmatically to reflect these parameter updates. The revised model was subsequently simulated to generate a new synthetic EEG signal. iii. Visual and quantitative evaluation: The new synthetic EEG signals were compared to empirical EEG data through visual inspection of cortical topographic maps and quantitatively assessed by calculating Pearson correlation coefficients. The results of this evaluation were used to guide further adjustments iteratively. While inherently less automated compared to fully algorithmic optimization methods, this approach allowed for the utilization of expert anatomical and physiological insights, which can sometimes be challenging to capture fully through automated techniques. It provided targeted optimization focused explicitly on visually and clinically relevant cortical areas, complementing other automated optimization strategies employed in this work. ❖ Genetic Algorithm-Based Optimization An additional optimization approach explored in this work involves the use of genetic algorithms (GAs), which are population-based optimization techniques inspired by evolutionary processes. The main objective of this GA-based optimization was to maximize the correlation between synthetic and empirical EEG signals within the electrode space. This approach is distinct and independent from the previously described mask-based and manual approaches.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 45 A A B
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 46 Figure 10. Empirical vs Synthetic EEG comparison. (A) EEG signals showing brief, irregular empirical seizures contrasted with prolonged, synchronous synthetic seizures. (B) Envelope signals post-processing, highlighting empirical (left) and synthetic (right) differences in amplitude distribution and seizure duration. (C) Synthetic signals without noise. Figure 11. A (left) Empirical EEG signals (post-processing, envelope, and low-pass filtering), highlighting shorter, bellshaped seizure patterns. B (right) Synthetic EEG signals processed similarly, showing prolonged plateau-shaped seizure activity, clearly illustrating the difference in temporal seizure patterns between empirical and synthetic signals. This discrepancy in seizure duration and morphology introduces additional challenges in subsequent correlation-based analyses. EMP R CA 42 S NT ET C A B C
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 47 4.2. Evaluation of Signal Features and Connectivity Metrics 4.2.1. Am lit de E velo e a d Low Pass This section illustrates an example of amplitude envelope extraction using the Hilbert transform and subsequent 0.1 Hz low-pass filtering. Figure 12. Amplitude Envelope and Low pass in the signal filtered between 4 and 10 Hz of one electrode of Synthetic EEG. Figure 13. Amplitude Envelope and Low pass in the signal filtered between 4 and 10 Hz of one electrode of Empirical EEG
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 48 4.2.2. Connectivity Metrics Evaluation To evaluate connectivity metrics, empirical EEG data was analyzed through multiple connectivity measures before and after amplitude envelope extraction and low-pass filtering. Empirical Data: Figure 14. Empirical EEG functional connectivity matrices after filtering in 4-10 Hz band and before envelope extraction, including cross-correlation, Pearson correlation, coherence, and phase locking value (PLV). Coherence visually demonstrates clearer cluster delineation and less saturation. Figure 15. Empirical EEG functional connectivity matrices after envelope extraction and low pass filter, reinforcing coherence as the optimal metric due to clearer cluster visibility and reduced noise. Synthetic Data: Cross Correlation Pearson Correlation Coherence P V Cross Correlation Pearson Correlation Coherence P V
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 49 Figure 16. Synthetic EEG connectivity matrices (cross-correlation, Pearson correlation, coherence, PLV), clearly show coherence as the most suitable metric due to less saturation and clearer cluster delineation. Coherence particularly highlights occipital clusters matching clinical epileptogenic areas. Influence of Noise in Synthetic EEG: Figure 17. A (Left): Comparison of synthetic EEG connectivity matrices (cross-correlation) before and after adding noise. Significant improvement after noise addition, reducing unrealistic high synchrony across channels. B (Right): Graphical illustration of highand low-amplitude synthetic EEG channels before(blue) and after noise addition (red), showing noise preserving epileptogenic high-amplitude activity while effectively reducing synchrony in low-amplitude signals. Cross Correlation Pearson Correlation Coherence P V With noiseWith noise With noise With noise With noise Solution Add Noise Reduce correlation with the low-amplitude nodes t maintains the correlation with the high-amplitude nodes A B
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 50 4.2.3. Topographic maps Figure 18. The spatial distribution of cortical brain activity during seizure propagation is shown for both empirical and synthetic cases. Differences in seizure duration and localization are observed. In the figure above, the temporal evolution of the spatial distribution of the signal is presented using topographic maps, along with the corresponding synthetic or empirical EEG signals. For the empirical signals, due to the shorter duration of the seizure, it can be observed how the focus of cortical activity appears and subsequently disappears. In contrast, for the synthetic signals, the activity emerges but does not disappear within the analyzed time window. Furthermore, in the synthetic signals, the focus of activity remains localized mainly in the left occipital region, whereas in the empirical signals, in addition to this occipital activity, a secondary high-amplitude activation can also be identified in the central cortical regions. 4.2.4. Frequency Band Selection and Spectral Analysis A crucial component of EEG analysis is the identification and interpretation of specific frequency bands, as different neural processes—and particularly epileptiform dynamics—are preferentially expressed in distinct spectral ranges. For this study, the frequency band from 4 to 10 Hz (extended theta band) was selected for signal processing and analysis, a choice supported by complementary approaches. Literature review highlights specific EEG frequency bands related to epileptic dynamics; delta band (1–4 Hz) is often associated with widespread seizure propagation, while the theta band (4– 8 Hz) is predominantly linked to focal seizure activity. Gamma band activity (>30 Hz), in contrast, is typically associated with focal epileptogenic zone localization rather than propagation. Considering the study's focus on seizure propagation rather than solely localization, the literature recommends selecting frequencies between delta and theta bands. The decision to select the theta band (4–10 Hz) was also strongly supported by direct spectral analysis. Computing the Power Spectral Density (PSD) of the EEG signals consistently revealed a prominent peak within the theta frequency range, particularly in channels located over 55 Seizure Window Theta Band 4 10 z Amplitude Envelope ilbert 0.1 z low pass lter 35 EMP R CA EEG S NT ET C EEG
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 51 epileptogenic areas. This empirical finding confirmed that the maximum power of epileptiform activity lies precisely in the selected frequency band. Together, the support from existing literature on frequency-specific seizure dynamics and the empirical evidence from PSD analysis strongly justified our choice of working within the 4–10 Hz frequency range for all subsequent processing and connectivity analyses Figure 19. Spectral analysis supporting frequency band selection. (A) Power spectral density plot highlighting highest power within the 4–10 Hz band in key electrodes. (B) Anatomical representation from the Virtual Epileptic Patient (VEP) atlas showing epileptogenic parcels in red and propagation parcels in yellow, corresponding to regions with significant spectral power. A B
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 52 Figure 20. Power Spectral Density (PSD) analysis of EEG signals from an electrode placed over the epileptogenic region. A clear peak in signal power is observed within the 4–10 Hz (extended theta) frequency band, confirming its clinical relevance and suitability for further analysis. 4.3 Comparative Analysis between Synthetic and Empirical EEG The following section presents an analysis of the metrics detailed above. First, the two correlation matrices representing functional connectivity are compared. Figure 21 displays the coherence metrics for the processed EEG data, which has been filtered, subjected to Hilbert transform, and had its amplitude envelope extracted and filtered at 0.1 Hz. Figure 21. Empirical and Synthetic Functional Connectivity Matrices using Coherence. Both matrices exhibit highly similar geometries and structures. They appear to show the same clusters, particularly the one located in the bottom right, associated with occipital and parietal regions. This is consistent with the clinical information and the spatial distribution representation shown in the topographic map, indicating that this is the area where the epileptic seizure originates and propagates. The empirical matrix also reveals another cluster associated with electrodes in 44 Synthetic Data Empirical Data The visual inspection of correlation matrices confirms pattern similarity Cluster shifts in real vs. synthetic data.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 53 the central cortex, which aligns perfectly with the second area of high activity depicted in the empirical topographic map. However, similar to the topographic map, this region where the epileptic activity seems to be propagating is absent in the synthetic matrix. Another notable observation in the matrices is that in the case of synthetic signals, most, if not all, are highly synchronized. Consequently, signals with sufficiently high amplitudes to overcome added noise will show high correlations in the matrix, while those with low amplitudes will be significantly affected by noise and exhibit low correlation. This explains why occipital electrodes and those heavily influenced by seizure propagation regions appear red in the synthetic matrix. This is not the case in the empirical data, where signals are heterogeneous and asynchronous, especially those from channels located near the epileptic focus. During a seizure, an abnormal synchronization of a large number of neurons occurs, resulting in excessive rhythmic activity. However, this activity may have an initial desynchronization in certain brain areas, and in addition to rhythmic activity, spikes (sharp waves) and slow waves can be observed. In the empirical matrix, the O1 channel, which shows high correlation in the synthetic matrix, exhibits practically zero correlation. This is because slow waves are predominantly observed in this channel. This significant difference in the correlation matrix for electrodes directly associated with the epileptic focus suggests that fitting the model using functional connectivity will be challenging. Following the visual analysis of the matrices, a quantitative analysis using Pearson's Correlation Coefficient (PCC) was performed. The PCC value between the synthetic and empirical matrices is approximately 0.1. Considering that 0 represents no correlation and 1 represents maximum correlation, 0.1 is a very low value. The differences between the two matrices, which could contribute to this low value, have been previously mentioned. Another important difference is that clusters in the synthetic matrix appear more smoothed, indicating a more uniform distribution of networks or regions with higher or lower connectivity. In contrast, the empirical matrix is more heterogeneous, appearing noisier, without a large red region but rather a mixture of red and white areas. To reduce the resolution of the empirical matrix, different techniques such as a Gaussian filter, node clustering techniques, and resolution reduction with eigenvectors were employed. These techniques improved the PCC, although not substantially. As explained in previous sections, calculating the PCC for a single subject is insufficient to determine the significance of the value. Therefore, a brain model of another patient with a different architecture (ARC file) was simulated. The cortical simulation and activity in the source space were generated, and the synthetic EEG was computed. The functional correlation matrix was calculated following the same steps as with the original subject, and the Pearson coefficient was computed between this matrix and the empirical matrix of the original subject. In this case, the value was significantly lower, around 0.04, indicating that the previously obtained value of 0.1 is not as low as initially perceived. The same procedure was applied to a completely random matrix, yielding a Pearson value close to zero, as expected. Figure 22 allows for a visual comparison of the functional connectivity correlation matrices using coherence and the topographic maps for the empirical EEG of the original subject, the synthetic EEG of the original subject, and the synthetic EEG of the new subject. This visual analysis reveals that the functional connectivity that might
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 54 coincide between both subjects is due to some activity in the right temporal part in the empirical data, which is the region where the epileptic focus is in the other subject. Figure 22. Correlation matrices using Coherence and topographic maps of empirical data and synthetic data of both subjects. Quantitative correlation was not only calculated between the matrices but also extracted as the Pearson coefficient between the vectors containing the means of each channel, which is what is visualized in the topographic map. The PCC between matrices measures the similarity between functional connectivity patterns, while the PCC between topographic maps measures the similarity between the distribution of amplitudes in the EEG. The PCC values between the mean vectors are significantly higher than those between the matrices, which is reasonable given that these are signals in the electrode space. Table 1 shows the PCC results in both cases: SUBJECT 1 SUBJECT 2 Mean Amplitude 0.6438 - 0.0375 FC Matrix 0.1062 0.041 Table 1. Comparison Results between synthetic mean amplitude vectors of both subjects with the empirical vector and results of PCC with FC matrices. The table indicates that the best metric for comparing both synthetic and empirical data is the amplitude of the signals themselves, rather than functional connectivity. Before definitively selecting topographic maps as the metric to fit the model, other techniques besides PCC were Synthetic New Subject 2 Empirical riginal Subject EEG Real WBM Dipole activity Forward Method EEG Synthetic E 2 E 1 - 0.03750.6438 Mean Amplitude CAR 0.0410.1062FC Matrix 0.02120.7214 Mean Amplitude C 0.5360.248FC Matrix Synthetic riginal Subject 1
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 61 model's ability to replicate seizure dynamics at a global level. Additionally, differences were identified between the synthetic and empirical signals that posed initial challenges, such as discrepancies in seizure duration, signal morphology, and synchronization between channels. However, it was found that appropriate processing, including the extraction of relevant features and filtering in specific frequency bands (such as the theta band), allowed these differences to be managed for subsequent analyses. The next critical step in the methodology was the comparison between the empirical and synthetic EEG data. This process was approached through two main avenues. The first involved using correlation matrices to evaluate functional connectivity, in this case, between EEG electrodes. A significant challenge here lies in analysing functional connectivity in electrode space, where phenomena such as volume conduction and noise affect the signal. This implies that the functional connectivity matrices obtained in electrode space are not as optimal or directly interpretable as those obtained in source space. Despite this limitation, the visualized matrices showed notable qualitative agreement, replicating the cluster and network structure observed in the empirical data. However, quantitatively, the correlation values obtained between the matrices were not sufficiently high to allow for a robust model fitting based on this metric in electrode space. The second avenue for comparison was the use of the spatial distribution of signals, represented by topographic maps. This approach proved to be much more promising. Qualitatively, the synthetic topographic maps generated from the model were able to convincingly replicate the generation of the epileptic seizure and its initial propagation through the occipital area, in agreement with the clinical and SEEG electrode localization. However, visual comparison also revealed a significant discrepancy: while the empirical EEG showed high-amplitude activity in a central cortical region (suggesting propagation to this area), this activity was absent in the synthetic topographic map. Quantitatively, the Pearson correlation coefficient between the empirical and synthetic topographic maps yielded very good values, confirming that this metric was suitable for evaluating spatial similarity. Given the limitations encountered with functional connectivity matrices and the favourable results obtained with topographic maps, it was decided that the comparison of spatial distributions would be the primary metric to guide parameter fitting. The absence of simulated activity in the central cortical region that was not previously fitted with SEEG led us to propose a crucial intermediate step before addressing the fitting of a completely new model with only EEG: refitting the existing model (previously fitted with SEEG) using scalp EEG data. The objective was to adjust the cortical parcels that had not been covered by SEEG electrodes so that the model could replicate the propagation of epileptic activity throughout the entire cortex, resulting in a fully fitted model. Once this is achieved, the strategy for fitting a model from scratch using only EEG would be similar. For parameter fitting, different techniques were explored. An initial proposal involved using a mask derived from the comparison in source space after applying an inverse method to the empirical EEG. Although the inverse method allowed obtaining signals in source space where epileptic foci and propagation zones could be distinguished, the subtle differences in shape and amplitude
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 62 between the empirical and synthetic signals in this space were not clear enough to allow for an effective model fitting using this mask, and the results were not satisfactory. Nevertheless, this approach is considered a promising line of work for future projects, suggesting the need for optimizations in the inverse method or specific post-processing of the signals in source space. The main method and finally chosen for parameter fitting was the genetic algorithm, using the correlation in the spatial distribution (topographic maps) as the objective function. This approach yielded promising results, enabling the model to generate simulated activity in the central cortical area that did not appear before. However, a significant limitation that affected the complete development of this stage was the high computational and temporal cost of the genetic algorithm. This limited the number of simulation generations and the exploration of a wider range of possible excitability values, preventing the complete optimization of the process within the project timeline. Although the activity in the target region was successfully replicated, some activity, albeit of lower amplitude, was also observed in other unexpected regions, indicating the need for further refinement of the fitting. Summarizing the general conclusions, the capability of the pre-fitted brain model with SEEG to simulate seizure generation and initial propagation is validated, as evidenced qualitatively in the connectivity matrices and more clearly in the topographic maps. Functional connectivity matrices in electrode space, although qualitatively consistent, were not optimal for quantitative fitting due to the influences of electrode space. On the other hand, topographic maps proved to be a robust metric both qualitatively and quantitatively for comparison and fitting. The strategy of refitting the areas not covered by SEEG using EEG and a genetic algorithm guided by topographic maps proved to be a viable and promising intermediate step towards achieving a fully fitted model. Despite the computational limitations that prevented complete optimization at this stage, the preliminary results with the genetic algorithm are encouraging, demonstrating the ability to generate the expected activity in previously unfitted areas. As this project continues beyond the TFM submission, the next steps will focus on perfecting the genetic algorithm, possibly exploring other metrics and addressing the computational limitation to achieve a more precise and specific fitting. Once the model is successfully refitted using EEG, the ultimate goal will be to address the fitting of a brain model from scratch, based exclusively on EEG data, which would consolidate the proposed non-invasive methodology. The possibility of exploring inverse modelling techniques and functional connectivity matrix-based fitting in source space in greater depth in the future is also considered, given their intrinsic potential. Expanding the study to multiple subjects will be crucial to validate the robustness and generality of the proposed pipeline. 6. CONCLUSSIONS This thesis successfully advanced the personalization of whole-brain models for epilepsy by developing and validating a methodology based on non-invasive scalp EEG data. This work
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 63 represents a significant step towards overcoming the limitations of invasive SEEG-based approaches, enhancing clinical accessibility and the potential to model seizure dynamics across the entire cortex. A key achievement was the identification of the amplitude envelope, extracted via the Hilbert transform within the theta band (4-10 Hz), as a robust and clinically relevant metric for comparing empirical and synthetic EEG. While initial explorations with functional connectivity metrics faced challenges in electrode space due to volume conduction, topographic maps derived from amplitude envelopes demonstrated strong spatial correspondence and proved effective for guiding model fitting in this study. The investigation into parameter optimization techniques highlighted the genetic algorithm as the most promising approach. Despite computational constraints limiting its full exploration, preliminary results successfully demonstrated the algorithm's ability to induce simulated epileptic activity propagation in central cortical regions not covered by the initial SEEG-based fitting, aligning with empirical observations and addressing a critical limitation of the previous modeling framework. This research provides a solid foundation for fully non-invasive EEG-based personalization of whole-brain models. The methodological framework developed has broader clinical implications, particularly for patients who cannot undergo invasive monitoring. Future research will build upon these findings by focusing on refining the genetic algorithm through increased computational resources and exploring alternative optimization strategies. Expanding the pipeline's validation to multiple patient datasets is crucial to assess its robustness and generalizability. The ultimate goal remains the development of a reliable methodology for personalizing whole-brain models using exclusively non-invasive EEG data, paving the way for improved presurgical evaluation and personalized therapeutic interventions in epilepsy.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 64 7. PLANNING The timeline structure was divided into several key phases: October – November 2024: Literature review and familiarization with patient data, code repositories, and brain model architecture. December 2024 – January 2025: Preprocessing of empirical EEG and generation of synthetic EEG using forward modelling. January – February 2025: Comparison of empirical and synthetic data using functional connectivity metrics in electrode space. February – March 2025: Comparison based on topographic amplitude distributions (theta band), confirming their suitability for model fitting. March – April 2025: Parameter optimization using genetic algorithms, exploring different strategies and consolidating results. May 2025: Ongoing work on model personalization and algorithm refinement. June 2025: Application of the pipeline to non-SEEG-fitted models, exploring full EEG-only personalization. The following figure illustrates this timeline visually: Figure 27 Project Timeline
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 65 This structure allowed for a methodical approach to the various aspects of the project, from background review to implementation and evaluation of the proposed methodologies, establishing a strong basis for future research. 8. ECONOMIC ASSESSMENT This section provides a general assessment of the costs involved in developing this project as if it were to be outsourced or replicated as a service. The analysis includes labour costs software tools computational resources and infrastructure usage. 1. Perso el ost The project was carried out by a biomedical engineering intern over a period of approximately 7 mo ths ctober 2024 – May 2025 with an average wor load of 20 ho rs er week. Although the internship compensation was €10/ho r which is typical for a student placement a more realistic rate for a professional biomedical engineer might be higher depending on the expertise and location. owever for this estimation we will stic to the actual intern rate • Ho rs worked 20 hours/wee × 28 wee s 560 hours • Ho rly rate €10/hour • otal erso el cost €5,600 2. oftware a d ools • Pytho ro rammi la a e pen-source and free → €0 • MNE-Pytho , N mPy, ciPy, a d c stom Ne roelectrics tools All open-source or internally developed → €0 • Ne roelectrics modeli latform nternal tools used under the internship agreement → €0 3. I frastr ct re a d Electricity • Perso al com ter sa e average power consumption of 60W used 4 hours/day 5 days/wee over 28 wee s → Approx. 33.6 k h with an estimated cost of €0.20/k h in Spain o Electricity cost 33.6 Wh × €0.20 ≈ €6.72 • Hardware de reciatio PC use over 7 months assumed minimal for short-term academic usage → Ne li ible 4. Pre-existi I frastr ct re a d Pi eli es
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 66 • The whole-brain modeling pipeline inverse and forward modeling tools and patient-speci c data MR dMR SEEG EEG were already available within the Neuroelectrics ecosystem. These are considered pre-existing company assets and were accessed at no additional cost during the internship. otal Estimated ost: ate ory ost (E R) Personnel nternship €5 600 Software Tools €0 nfrastructure & Electricity €7 Pre-existing Pipelines & Data €0 Data €5 606.72 Table 4. Economic assessment table. 9. ENVIRONMENTAL ASSESSMENT Although the execution of this project did not involve the use of physical materials or produce waste in the traditional sense, it did require considerable use of computational resources, which inherently entails electricity consumption and thus carbon emissions. Electricity Consumption Throughout the development of this project, a personal computer was used approximately 4 hours per day, 5 days a week, over the course of 7 months. Assuming a conservative average power usage of 60W, the estimated total energy consumption is as follows: • Daily usage: 4 hours × 60 W = 0.24 kWh/day • Weekly usage: 0.24 kWh/day × 5 days = 1.2 kWh/week • Total usage over 28 weeks: 1.2 kWh/week × 28 weeks ≈ 33.6 kWh Using the Spanish government calculator for carbon emissions based on national energy production, this translates to an approximate emission of: • 33.6 kWh → ~6.8 kg CO₂ emitted This emission is relatively low, and no additional travel or material resources were required, minimizing the overall environmental footprint. Transportation Emissions (Commuting) The project involved regular commuting to the workplace in Barcelona from October 2024 to April 2025. Commuting primarily involved public bus transportation, with an estimated travel time of 40 minutes per one-way trip and an approximate distance of 6 km per trip. Based on a typical work pattern, bus travel occurred approximately four days per week for the outbound journey and three days per week for the return journey (with one or two return journeys per week being made by
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 67 walking). Considering the project duration (approximately 7 months or 28 weeks, accounting for holidays), the estimated number of bus trips is: • Estimated working weeks: ∼24 weeks (7 months excluding holidays/breaks) • Bus trips per week: 4 (outbound) + 3 (return) = 7 trips • Total estimated bus trips: 7 trips/week × 24 weeks = 168 trips • Estimated distance per trip: ∼6 km • Total estimated distance by bus: 168 trips × 6 km/trip = 1008 km Using a representative emission factor for urban public bus transport, estimated at around 80 grams of CO₂ per passenger-kilometer (0.08 kg CO₂/pkm) based on data from relevant environmental and transportation authorities in Spain, the total estimated carbon emissions from bus travel are: • Total CO₂ emissions from bus: 1008 km × 0.08 kg CO₂/km ≈ 80.6 kg CO₂ This analysis indicates that transportation, even by public bus, represents a more significant portion of the project's direct carbon footprint compared to the energy consumption from the personal computer used for computational tasks, although the total emission from commuting is lower than initially estimated with the previous distance assumption. Use of Artificial Intelligence and Large-Scale Computing n addition to personal computing the project also involved the use of arti cial intelligence systems. Speci cally generative language models were selected for summarisation and code debugging. The use was concentrated on • ChatGPT GPT-4/ o-series ≈ 100 queries. Peer-reviewed and industry studies report that a single ChatGPT-class query emits anywhere between 0.382 g C ₂e lower-bound empirical estimate and 4.32 g C ₂e upperbound lifecycle estimate [22]. Multiplying those factors by the number of prompts gives a conservative interval • ower boundary 0.382 g 100 × 0.382 g ≈ 0.0382 g C ₂e • pper boundary 4.32 g 100 × 4.32 g ≈ 0.432 g C ₂e This 0.0382 –0.432 g range is intentionally wide actual emissions vary with the model version data-centre efficiency and the grid’s carbon mix at the exact time of each query. ower-bound studies amortise model training across billions of queries while upper-bound blog estimates assume a fossil-heavy power supply—hence the spread.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 68 Even at the top end the thesis’s footprint is roughly that of a 2 m trip by car. oo ing ahead A wor loads may double data-centre electricity demand by 2030 but hyperscalers are also ramping up renewables and advanced cooling. Continued mindful use of Ms will eep future research footprints modest. 10. SOCIAL AND GENDER EQUALITY ASSESSMENT This project was developed using highly sensitive clinical data from a single patient, whose gender identity is withheld to preserve privacy. Nevertheless, the methodological approach —based on personalized brain modelling from EEG and SEEG data— is entirely neutral and does not incorporate any biases related to gender, race, culture, or socioeconomic status. The algorithms and pipelines designed can be equally applied to any patient, regardless of their gender identity or social background. Moreover, the use of non-invasive EEG technology increases accessibility for vulnerable populations, including patients who, due to medical or economic reasons, cannot undergo invasive procedures such as SEEG. The development of this methodology directly supports the Sustainable Development Goals (SDGs): SDG 3: Good Health and Well-Being, by promoting more precise, personalized, and less invasive treatments for people living with epilepsy. SDG 10: Reduced Inequalities, by facilitating access to advanced diagnostic and treatment technologies for traditionally underserved populations. In summary, this work has been designed from an inclusive perspective, ensuring that scientific advances can benefit all individuals fairly and without discrimination.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 69 BIBLIOGRAPHY [1] [Online]. Available: https://www.galvani-lab.eu/. [2] Wendling, F., Ruffini, G., & Bartolomei, F., “GALVANI: Controlling epileptic brain networks with computationally optimized weak electric fields [Research proposal, Part B1].,” ERC Synergy Grant, Inserm, Neuroelectrics, Aix Marseille Université, Francia, España y Francia, 2018. [3] ]. J. S. Gomes, “Transcranial current stimulation in epilepsy: A systematic review of the fundamental and clinical aspects,” Frontiers in Neuroscience, vol. 16, no. 909421, 2022. [4] M. A. Lopes, “Computational Modelling in Source Space from Scalp EEG to Inform Presurgical Evaluation of Epilepsy,” Clinical Neurophysiology, 2020. [5] P. v. Mierlo, “Functional Brain Connectivity from EEG in Epilepsy: Seizure Prediction and Epileptogenic Focus Localization,” Progress in Neurobiology, 2014. [6] J. Cases Gendra, “A Novel Biophysical Whole-Brain Model Explains Power Spectrum Alterations Under Serotonergic Psychedelics,” 2024. [7] E. L.-S. Borja Mercadal, “Towards a mesoscale physical modeling framework for stereotactic-EEG recordings,” 2023. [8] ,. G. R. E. L.-S. F. Jan C. Gendra, “A Novel Biophysical Whole-Brain Model Explains Power Spectrum Alterations Under Serotonergic Psychedelics Using Multimodal Neuroimaging”. [9] J. Wirsich, “Concurrent EEGand fMRI-derived functional connectomes exhibit linked dynamics,” 2020. [10] E. Lopez-Sola, B. Mercadal, E. Lleal, R. Salvador, F. Bartolomei, F. Wendling and G. Ruffini, “Personalized Whole-Brain Models of Seizure Propagation,” biorXiv (preprint), 2025. [11] B. H. a. R. V. G. Jansen, “Electroencephalogram and visual evoked,” Biological Cybernetics , vol. 73, p. 357–366, 1995. [12] E. Lopez-Sola, “A personalizable autonomous neural mass model of epileptic seizures,” 2022. [13] M. Hashemi, “The Bayesian Virtual Epileptic Patient: A probabilistic framework,” NeuroImage 217, 2020.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 70 [14] V. K. Jirsa, “The virtual epileptic patient: individualized whole-brain models of epilepsy spread,” Neuroimage 145 , pp. 377 - 388, 2017. [15] H. E. Wang, Journal of neuroscience methods 348, 2021. [16] M. Goodfellow, “Estimation of brain network ictogenicity predicts outcome from epilepsy surgery,” Scientific reports 6.1, 2016. [17] R. Sanchez-Todo, “A physical neural mass model framework for the analysis of oscillatory generators from laminar electrophysiological recordings,” NeuroImage 270, 2023. [18] H. E. Wang, “VEP atlas: An anatomic and functional human brain atlas dedicated to epilepsy patients,” J. Neurosci. Methods, vol. 348, 2021. [19] D. M. S. S.-T. J. Casas, “EEG-informed personalization of whole-brain models in focal epilepsy,” 2024. [20] G. Ruffini, “EEG Forward Modeling and Source Localization: Theory and Applications,” 2015. [21] A. S.-L. G. D. S. Sánchez-Todo, “Whole-brain modeling of seizure propagation using realistic connectivity and hybrid models,” Frontiers in Computational Neuroscience, vol. 17, 2023. [22] D. &. S. W. Lehmann, “Reference-free identification of components of checkerboard-evoked potential fields,” Electroencephalography and Clinical Neurophysiology, 48(6), 609–621., 1980. [23] Z. B. A. C. S. H. R. &. S. E. P. Wang, “ Image quality assessment: From error visibility to structural similarity.,” IEEE Transactions on Image Processing, 13(4), 600–612., 2004. [24] E. Lopez-Sola, “Personalized Whole-Brain Models of Seizure Propagation,” Barcelona, 2025. [25] J. H. Holland, “Adaptation in Natural and Artificial Systems,” Cambridge, MA, USA: MIT Press, 1992. [26] D. E. Goldberg, “Genetic Algorithms in Search, Optimization, and Machine Learning,” 1989. [27] M. Mitchell, “An Introduction to Genetic Algorithms,” Cambridge, MA, USA: MIT Press, 1998. [28] M. Goodfellow, “Estimation of brain network ictogenicity predicts outcome from epilepsy surgery,” Scientific Reports, vol. 6, 2016. [29] S. M. Villalon, “EpiTools, A software suite for presurgical brain mapping in epilepsy: Intracerebral EEG,” J. Neurosci. Methods, 2018.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 77 The following gures show brain activity before and after the seizure. Figure F2. The upper figure shows the activity before the seizure and the lower figure shows the activity during the seizure.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 78 The following gures show the signal after processing Figure F3. On the left is shown the filtered signal from 4 to 10 Hz in blue and the Hilbert envelope amplitude in red, the figure on the right shows a 30-second time window centered on the seizure onset and filtered at 0.1 Hz (dashed red line). Appendix G. Genetic Algorithm Parameters This Appendix provides a concise, yet detailed overview of the genetic algorithm (GA) design used for optimizing cortical excitability parameters (W) in the personalized whole-brain model. Overview of Genetic Algorithm Genetic algorithms are optimization techniques inspired by biological evolution principles [25] [26]. They involve iteratively refining a set of candidate solutions (population) through operations like selection, crossover (recombination), and mutation to converge toward an optimal or near-optimal solution. In the context of this study, the GA aimed to maximize the spatial correlation (Pearson correlation coefficient calculated from topographic images) between synthetic EEG topographic maps and empirical EEG maps, by adjusting cortical excitability parameters in selected brain parcels [27]. GA Parameters and Configuration The table below summarizes the parameters, and their initial values used in this project: PARAMETER VA E Population Size 20 Mutation Rate 0.2 Crossover 0.5 Number of Generation 10 Table 5 Genetic Algorithm Design
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 79 Population Size refers to the number of candidate solutions generated and evaluated at each generation. A larger population size allows greater exploration of the parameter space but increases computational demand. Mutation Rate represents the probability of randomly altering elements within each candidate solution. Mutation introduces variability and helps the algorithm explore diverse areas of the parameter space preventing premature convergence. Crossover Rate determines the probability of combining elements from two parent solutions to produce offspring [26]. A higher crossover rate encourages mixing of promising traits facilitating convergence toward optimal solutions. Number of Generations indicates how many iterative cycles of selection crossover and mutation are performed. More generations generally result in improved solutions as the algorithm iteratively re nes its search. o sideratio s a d t re Im roveme ts Due to computational constraints the algorithm employed relatively conservative values for population size and number of generations. Speci cally only 10 generations were feasible within the current computational resources. Nonetheless preliminary results showed signi cant improvements in spatial correlation. For future iterations substantial performance improvements could be achieved by increasing the computational resources thereby allowing o ncreasing the number of generations from 10 to at least 50 enhancing the convergence and accuracy of the optimized solutions. o Expanding population size to increase the diversity of candidate solutions further reducing the li elihood of local minimum and improving global search capabilities. Such adjustments would signi cantly enhance the algorithm's capability to ne-tune cortical excitability parameters and more accurately replicate empirical EEG distributions. Appendix Genetic Algorithm Strategies for Cortical Parameter ptimization This appendix presents the computational strategies and evaluation metrics used in the implementation of several genetic algorithms (GAs) to optimize the cortical excitability parameters (W) in the patient-specific brain model. The core objective across all methods was to improve the spatial resemblance between the synthetic EEG and the empirical EEG, particularly regarding the topographic distribution of activity. H.1 Overview of Genetic Algorithm Implementation Each genetic algorithm was structured around a standard evolutionary process:
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 80 • Initialization: A population of individuals (parameter sets of excitability W values) was randomly generated, with a subset fixed to baseline excitability (W=3) and the remainder assigned random values within a realistic physiological range (3–8). • Evaluation: Each individual was evaluated using a fitness function, which measured the similarity between synthetic and empirical EEG data using various spatial metrics. • Selection and Reproduction: The best-performing individuals (top_k) were retained, and new individuals were created through crossover and mutation operations. • Iteration: The process was repeated for a fixed number of generations. A penalty term (L1-regularization) was optionally included in each fitness function to discourage excessive deviations from the healthy baseline excitability (W=3). H.2 Pearson-Based Optimization Techniques The Pearson correlation was explored through three different configurations: H.2.1 Pearson Correlation on Mean Amplitude Vectors This early method computed the Pearson correlation between the 1D vectors of average amplitude across EEG channels. It provided a quick global metric but proved insufficient for capturing topographic structure. Results often showed improvement in occipital amplitude patterns but failed to detect central activity propagation. H.2.2 Pearson Correlation on Interpolated Topographic Maps (Full Image) This technique interpolated the empirical and synthetic EEG values over a 2D head model grid and calculated the Pearson correlation between the resulting images. This approach captured the full spatial distribution of brain activity. It produced the best results, with visual and quantitative improvements in both occipital and central regions (e.g., r = 0.34 → 0.50). Fitness function: 𝑓(𝑤)=𝜌𝑖𝑚𝑔− 𝐿1 (19) Where: • 𝜌𝑖𝑚𝑔 is the Pearson correlation between the flattened pixel vectors of both topomaps. • 𝐿1 is a regularization term explained below. H.2.3 Central Cluster Pearson Correlation
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 81 Here, the Pearson correlation was calculated using only a predefined central region of interest (C1, CP1, C2, CP2, C3, CP3, C4, CP4). This localized metric enabled a better focus on epileptic propagation in motor areas. Fitness function: 𝑓(𝑤)=𝜌𝑐𝑒𝑛𝑡𝑟𝑎𝑙− 𝐿1 (20) Figure H1. Topographic maps of synthetic EEG with the new models are shown after modifying the excitability parameters of the ARC file using this GA. Various GA results are shown, demonstrating how the algorithm evolves. Pearson Values (r) : (A) r = 0.7530, (B) r =0.7595, (C) r = 0.7582, (D) r = 0.7615. The images of the topographic map of the original synthetic EEG and the real EEG are shown Figure H2. On the left, Figure A, the topographic map of the original synthetic EEG is shown and, on the left, Figure B, the empirical one is shown. H.3 RMSE-Based Optimization This method minimized the Root Mean Square Error (RMSE) between the full interpolated topographic maps. RMSE directly quantified the average magnitude of pixel-wise differences, providing a scale-sensitive and intuitive measure. Results showed a consistent and smooth improvement of the global map alignment (e.g., RMSE from ~4.0 → ~3.8), though less expressive in localized activity changes compared to Pearson. A B
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 82 Fitness function: 𝑓(𝑤)=−𝑅𝑀𝑆𝐸(𝑢,𝑣)−𝐿1 (21) Where u and v are the interpolated values of the synthetic and empirical EEG maps, respectively. Figure H3. Topographic maps of synthetic EEG with the new models are shown after modifying the excitability parameters of the ARC file using this GA. Various GA results are shown, demonstrating how the algorithm evolves. Root Mean Square Error Values (r) : (A) RMSE: 4.3536, (B) RMSE: 3.9855, (C) RMSE: 3.9825, (D) RMSE= 3.6094. H.4 GMD-Based Multi-Objective Optimization The final strategy utilized Global Map Dissimilarity (GMD), a normalized spatial dissimilarity measure computed after subtracting the mean and normalizing amplitude distributions. It was applied independently to two brain regions: • Central cluster: C1, CP1, C2, CP2, etc. • Occipital cluster: O1, PO3, OZ, POZ, O2, etc. A multi-objective genetic algorithm was employed to jointly optimize the inverse GMD (1 - GMD) in both regions. Solutions were evaluated using Pareto dominance. Fitness function: 𝑓(𝑤)=[1−𝐺𝑀𝐷𝑐𝑒𝑛𝑡𝑟𝑎𝑙,1−𝐺𝑀𝐷𝑜𝑐𝑐𝑖𝑝𝑖𝑡𝑎𝑙] (22) The GA returned a Pareto front of solutions, balancing both objectives.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 83 Figure 28 Topographic map of the synthetic EEG after optimization using GA using GMD as the evaluation method. The figure shows one of the possible solutions, the rest being no better than this one. In this case, the following combination is used: GMD Cluster Central = 0.9752, Occipital = 0.9745 H.5. Regularization Term (L1 penalty) All fitness functions incorporated an L1 penalty to prevent extreme increases in excitability values across the brain: Formula: 𝐿1=( 1 𝑁+1)∑|𝑊𝑖−𝑊ℎ𝑒𝑎𝑙𝑡ℎ𝑦|∗𝜆 (23) Where: • N is the number of parcels being optimized. • 𝑊𝑖 is the excitability of parcel i. • 𝑊ℎ𝑒𝑎𝑙𝑡ℎ𝑦 is the baseline excitability (W = 3). • λ is the regularization coefficient, set to 0.01 in all experiments. Another potential similarity metric is the Structural Similarity Index Measure (SSIM), commonly used in image analysis to evaluate perceived structural similarity between two images. SSIM considers luminance, contrast, and structural information, providing a perceptually motivated score between –1 and 1. Although SSIM was not implemented in the present work, it remains a promising candidate for future studies. Its application to EEG topographic maps could offer a complementary perspective, potentially improving the sensitivity of optimization algorithms to subtle spatial features. Each strategy offered distinct advantages and revealed different aspects of synthetic EEG quality. Pearson on the full topographic map emerged as the most effective single-objective strategy.
Development of EEG-Based Whole-Brain Models for Simulating Seizure Dynamics 84