STIED: A deep learning model for the SpatioTemporal detection of focal Interictal Epileptiform Discharges with MEG | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Article STIED: A deep learning model for the SpatioTemporal detection of focal Interictal Epileptiform Discharges with MEG Raquel Fernández-Martín, Alfonso Gijón, Odile Feys, Elodie Juvené, and 4 more This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-5974529/v1 This work is licensed under a CC BY 4.0 License Status: Published Journal Publication published 01 Jul, 2025 Read the published version in Scientific Reports → Version 1 posted 6 You are reading this latest preprint version Abstract Magnetoencephalography (MEG) allows the non-invasive detection of interictal epileptiform discharges (IEDs). Clinical MEG analysis in epileptic patients traditionally relies on the visual identification of IEDs, which is time consuming and partially subjective. Automatic, data-driven detection methods exist but show limited performance. Still, the rise of deep learning (DL)—with its ability to reproduce human-like abilities—could revolutionize clinical MEG practice. Here, we developed and validated STIED, a simple yet powerful supervised DL algorithm combining two convolutional neural networks with temporal (1D time-course) and spatial (2D topography) features of MEG signals inspired from current clinical guidelines. Our DL model enabled a successful identification of IEDs in patients suffering from focal epilepsy with frequent and high amplitude spikes (FE group), with high-performance metrics—accuracy, specificity, and sensitivity all exceeding 85%—when learning from spatiotemporal features of IEDs. This performance can be attributed to our handling of input data, which mimics established clinical MEG practice. Reverse engineering further revealed that STIED encodes fine spatiotemporal features of IEDs rather than their mere amplitude. The model trained on the FE group also showed promising results when applied to a separate group of presurgical patients with different types of refractory focal epilepsy, though further work is needed to distinguish IEDs from physiological transients. This proof-of-concept study represents a first step towards the use of STIED and DL algorithms in the routine clinical MEG evaluation of epilepsy. Health sciences/Neurology/Neurological disorders/Epilepsy Biological sciences/Neuroscience/Computational neuroscience/Learning algorithms Biological sciences/Neuroscience/Computational neuroscience/Network models Health sciences/Diseases/Neurological disorders/Epilepsy Automatic interictal epileptiform discharges detection Convolutional Neural Networks Deep Learning Epilepsy Magnetoencephalography. Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 I. INTRODUCTION Epilepsy is a disorder of the brain characterized by an enduring predisposition to generate epileptic seizure [ 1 ]. It affects people of all ages and has neurobiological, cognitive, psychological and social consequences. While pharmacological treatments work successfully in most patients, approximately one-third of them suffer from refractory (i.e., drug-resistant) epilepsy [ 2 ]. These patients are possible epilepsy surgery candidates and must therefore undergo a presurgical evaluation aiming at delineating as precisely as possible the epileptogenic zone. Magnetoencephalography (MEG) contributes to this evaluation, mainly by allowing the non-invasive detection and localization of interictal epileptiform discharges (IEDs)—subclinical events occurring between seizures [ 3 ], [ 4 ]— which help to localize the epileptogenic zone [ 5 ], [ 6 ]. Clinical MEG analysis of patients with epilepsy traditionally relies on the visual identification of IEDs by an experienced clinical magnetoencephalographer, who inspects both IED sensor time courses and spatial topographies along with their source localization, usually by equivalent current dipole (ECD) modeling [ 7 ], [ 8 ]. This approach is highly time consuming (on average 8 hours per patient [ 9 ]) and partially subjective (notwithstanding existing guidelines [ 10 ]). The development of efficient data-driven, automatic approaches to IED detection would represent a major advance in clinical MEG practice. Several proposals based on unsupervised algorithms have been explored, e.g., Independent Component Analysis (ICA) and Hidden Markov Modeling (HMM), with limitations regarding detection specificity or full automation [ 11 ]–[ 17 ]. In the last years, supervised deep learning (DL) algorithms emerged as novel automatic approaches [ 18 ]–[ 21 ]. These methods are mainly based on convolutional neural networks (CNNs) extracting temporal features of IED waveforms from MEG signals, and then supplemented with somewhat ad-hoc techniques for the subsequent spatial localization of epileptic events, e.g., splitting sensor channels into different brain regions [ 18 ], [ 21 ], classification and segmentation networks [ 19 ], or graph convolutional networks [ 20 ]. While promising, none of these approaches performed well enough to be incorporated into routine clinical MEG practice. Here, we hypothesized that a reliable, high-performance DL algorithm should combine both temporal (spiking waveform) and spatial (dipolar magnetic pattern) features used by clinical magnetoencephalographers to visually identify and select epileptiform discharges in MEG signals [ 10 ]. For that purpose, we designed STIED, a simple but powerful DL algorithm for the SpatioTemporal detection of focal IEDs. We trained and validated STIED models in a cohort of 10 school-aged children with focal epilepsy (FE) selected based on frequent, high-amplitude, and isolated IEDs arising mainly from the perisylvian areas to which MEG is highly sensitive [ 22 ]. These cases thus provide an excellent first case study to benchmark DL models. The sample size was not an issue here as we used a Leave-One-Out Cross-Validation (LOOCV) approach to estimate the performance of the model when used on new patient data. This approach is particularly appropriate for small datasets, especially when model accuracy is more important than the computational cost of training [ 23 ]. To test our hypothesis, we compared the performances of three CNN algorithms: a temporal model (1D-CNN applied to a MEG waveform) encoding temporal features only, a spatial model (2D-CNN applied to a magnetic field pattern) encoding spatial features only, and a spatiotemporal model integrating both aspects simultaneously. We show that all models lead to high-performance IED detection metrics (accuracy, specificity and sensitivity)—with the spatiotemporal model being the most effective—thanks to the combined encoding of IED amplitude with temporal waveform morphology and spatial dipolar magnetic pattern. As further proof of concept, we provide a preliminary test of the generalizability of the spatiotemporal model directly on 12 presurgical patients with refractory focal epilepsy (RFE), i.e., the typical clinical target of MEG diagnostic evaluation in epilepsy. II. METHODS A. Participants and data acquisition Data acquisition Participants underwent MEG scanning during a seizure-free wakeful rest of at least 5 minutes in sitting position with their eyes open for the FE group, and one hour of recording in supine position to trigger sleep for the RFE group (see [ 24 ] for details on the clinical MEG protocol). Data were recorded using a whole-scalp-covering MEG system (Neuromag Triux; MEGIN, Helsinki, Finland; 0.1–330 Hz band-pass, 1 kHz sampling rate) installed in a lightweight magnetically shielded room (Maxshield, MEGIN; see [ 25 ] for details). The 306-channel sensor array combines 102 magnetometers and 204 planar gradiometers. Head movements were tracked by four coils whose position relative to fiducials (nasion and tragi) was digitized beforehand (Fastrack, Polhemus, Colchester, Vermont, USA), along with at least 300 face and scalp points for co-registration with a structural brain 3D T1-weighted magnetic resonance image (MRI) (Intera, Philips, The Netherlands). B. MEG data preparation The overall pipeline is illustrated in Fig. 1 (upper panels A, B and C). MEG preprocessing We followed standard denoising steps of MEG data, i.e., signal space separation to correct for environmental magnetic interferences and head movements (Maxfilter v2.2.14, MEGIN, with default parameters [ 26 ]), and ICA (FastICA, [ 27 ]) of band-filtered data (0.5–45 Hz) to remove physiological artifacts (eye blinks and cardiac activity) [ 28 ]. The resulting data were further band-filtered between 4 and 30 Hz and temporally segmented into 200 ms-long non-overlapping windows. This length was chosen to enable full inclusion of isolated IEDs, whose typical duration range from 50 to 100 ms [ 29 ]. Spatial/temporal feature extraction Input data for training/testing of subsequent DL models was extracted from each window by applying principal component analysis (PCA) separately to the 204 planar gradiometer signals and to the 102 magnetometer signals. In each case, a principal component (PC) is associated with a magnetic topography that encodes its spatial distribution across sensors (magnetometers, size 102 channels \(\:\times\:\) 1; gradiometers, 204 channels \(\:\times\:\) 1) and a waveform that encodes how this magnetic pattern evolves in time within the window (size 1 \(\:\times\:\) 200 time samples). Here, we elected to focus on the time course of the first PC of gradiometers, i.e., the combination of all 204 gradiometer signals that explained the largest fraction of temporal variance in the window, and on the spatial topography of the first PC of magnetometers, i.e., the magnetic field pattern that explained the largest fraction of spatial variance within the window. The latter topographies were then converted into 2D images by a fourth order polynomial interpolation over a 60 \(\:\times\:\) 60 pixel grid using the open-source software FieldTrip [ 30 ]. This splitting of gradiometers/magnetometers to extract temporal/spatial features broadly reproduces the visual IED identification procedure typically followed by our clinical magnetoencephalographers; the higher signal-to-noise ratio of gradiometers yields a cleaner visualization of MEG time courses[ 10 ], [ 31 ] (notwithstanding lesser sensitivity to deep IED activity in, e.g., mesiotemporal epilepsy [ 32 ]) whereas magnetometers show higher sensitivity to dipolar magnetic patterns[ 33 ] (as well as to deep IEDs [ 32 ]). Extracting a single waveform or image per window also allowed to reduce the size and redundancy of input data, the size and complexity of our DL network models, and the computational load of model training. Since this data reduction could miss potentially relevant, low-variance IED features included in higher-order PCs, we also used second PCs as inputs to DL models and checked whether they bear predictive power for IED detection. Each of these PC data were further standardized per subject. Machine learning preprocessing of training data (FE group) The windowed data associated to FE patients was further prepared for model training. Each window was labeled according to a binary classification ('Spike'/'Non-spike') depending on whether or not it contains an annotated VDS-IED [ 17 ] (see Fig. 1 , panel D). Over the resulting labeled dataset, we performed a threefold data augmentation. First, each 'Spike' window was shifted 15 times to the past and future by 7 ms steps, hence allowing to train our DL models independently of the precise IED timing within a window. The number of 30 replicas per 'Spike' window was determined through trial and error to optimize the performance. Then, we randomly removed 'Non-spike' windows to achieve a balanced training dataset. Second, we further augmented the dataset spatially by rotating magnetic topographical images four times at 90-degree intervals, so as to train our DL model independently of the precise IED dipole position and orientation. Last, we added sign-inverted data given the sign ambiguity of PCA [ 27 ]. The resulting training dataset size was 200 time samples \(\:\times\:\) N T = 30000 windows for the temporal model and 60 \(\:\times\:\) 60 pixels \(\:\times\:\) N S = 75000 windows for the spatial model. The spatiotemporal model was trained on the same N S windows than the spatial one, leading to a dataset size of 200 \(\:\times\:\) N S waveforms and 60 \(\:\times\:\) 60 pixels \(\:\times\:\) N S images where some images were associated to the same waveform. C. Model architectures The architecture of our three DL models is illustrated in Figs. 2 – 4 . All these models were implemented using the Tensorflow library [ 35 ] and run on a laptop equipped with an AMD Ryzen 7 5800H processor, 40 GB RAM memory and NVIDIA GeForce RTX 3060 graphic card. Of note, non-trainable hyperparameters were chosen by exploring the space generated by the combination of different number of CNN layers (1, 2, or 3), CNN filters (8, 16, 32, or 64), dense layers (1, 2, or 4), and dense-layer neurons (8, 16, 32, 64). Temporal model (1D-CNN) In the temporal model, the gradiometric PC waveform of a window is passed through three successive blocks made of a 1D convolutional layer followed by dropout and maxpooling layers (Fig. 2 ). The output was then flattened and fed to a two-layer decision block. Each convolutional layer has a different number of filters (16, 32, 64), a leaky rectified linear unit (ReLU) as activation function, and subsequent dropout layer (probability value 0.5) to prevent overfitting and maxpooling layer (pooling size 2) for downsampling. The decision block was composed of a dense layer with 16 neurons and ReLU activation functions, followed by a single neuron with sigmoid activation function providing a probability between 0 and 1 for a window to contain a spike. The final binary yes/no (‘Spike’/’Non-spike’) decision was based on a non-trainable probability threshold set to 0.5. Spatial model (2D-CNN) The model design to analyze spatial features was the same as for the temporal model, except that the inputs consisted here in images of magnetometric PC field pattern, so all convolutional layers were 2D (Fig. 3 ). Spatiotemporal model (STIED) To incorporate both temporal and spatial features in a genuinely spatiotemporal IED detection, we designed a model architecture that processes temporal and spatial inputs in parallel using the same 1D-CNN (Fig. 2 ) and 2D-CNN (Fig. 3 ) up to the first dense layer of their decision block. The feature vectors from the outputs of the temporal and spatial dense layers were downsampled (0.5 dropout), combined using weighted concatenation with one trainable scalar weight for the temporal features ( \(\:{w}_{t}\) ) and one for the spatial features ( \(\:{w}_{s}=1-{w}_{t}\) ), and finally fed to the exact same decision block than the one used in the temporal model described above (Fig. 4 ). Normalized and maximum amplitude models : Since IEDs are primarily high-amplitude events, we sought to examine whether our STIED models are merely driven by the gross amplitude of IEDs or if they learn subtler features. To do so, we isolated the effect of amplitude from other features by considering both classifiers independent of amplitude and classifiers that depend solely on amplitude. For amplitude-independent IED detection, we applied the same 1D-CNN, 2D-CNN, and STIED architectures on input data after amplitude normalization (NormAmplitude models). Normalization consisted in window-by-window division of data by the maximum amplitude (i.e., maximum amplitude of gradiometric PC waveform within the window for temporal features, maximum amplitude of magnetometric PC topography for spatial features). The specific importance of amplitude in IED detection, independently of other morphological features, was assessed using a simple deep learning classification model based on a multilayer perceptron (MaxAmplitude models). The input data for this model consisted in the maximum amplitude used for data normalization in NormAmplitude models. The perceptron was trained to determine the probability that a given window contained a spike, thereby enabling binary classification (probability threshold 0.5) based solely on amplitude. As above, three versions of the MaxAmplitude models were considered: a temporal one (using the maximum amplitude of gradiometric PC waveform), a spatial one (using maximum amplitude of magnetometric PC topography), and a spatio-temporal one (incorporating both maximum amplitudes as inputs). Each perceptron consisted in one hidden layer of 8 neurons (temporal and spatial models) or two hidden layers of 16 neurons (spatiotemporal model) with ReLU activation function and followed by an output layer of a single neuron with sigmoid activation function to produce a probability-like output. D. Training and performance evaluation Model training Model training was performed using an Adam optimizer algorithm with a batch size of 128 windows, binary cross-entropy as loss function, and a reduced learning rate when loss stopped improving. As preliminary sanity check, we trained our STIED models by randomly extracting 80% of the entire dataset for training and using the remaining 20% for testing. We did not observe overfitting and determined that 150 epochs/training steps were enough to reach a learning plateau in all models. For model performance evaluation, given that our dataset was composed of 10 patients, we performed a 10-fold repeated LOOCV wherein all windows of 9 out of 10 subjects were used for training, and all windows of the remaining subject for testing. This allowed to evaluate model performance in a clinically oriented setup (i.e., generalizability to the inclusion of new patients with similar epilepsy) and inter-individual variability of performance metrics. Performance metrics (FE group) For each cross-validation iterate, we compared model window classification (yes/no) to the actual presence of VDS-IEDs (‘Spikes’/‘Non-Spike’) using accuracy, specificity, and sensitivity according to the standard expressions $$\:accuracy=\frac{TP+TN}{TP+TN+FP+FN}\:\cdot\:\:100\%,\:specificity=\frac{TN}{TN+FP}\:\cdot\:\:100\%,\:\text{a}\text{n}\text{d}\:\:sensitivity=\frac{TP}{TP+FN}\:\cdot\:\:100\%\:.$$ Comparison with unsupervised IED detection algorithms (FE group) Previous work developed automated IED detection algorithm based on unsupervised machine learning algorithms such as ICA and HMM [ 11 ]–[ 17 ]. We sought to assess the added-value of our supervised DL approach by comparing its performance metrics with similar metrics derived from both the ICA and the amplitude HMM of MEG signals described in[ 17 ] and tested on the same dataset of FE patients. IED localization of predicted IEDs (RFE group) As a final and more exploratory analysis, we examined the performance of our STIED model, trained in our FE group, on different patients with RFE. This provides a drastic test of model generalizability since this dataset differed in the type of epilepsy (RFE instead of FE), population (both children and adults instead of children only), and recording paradigm (sleep recordings instead of wakeful rest). This also allows to showcase a practical way to use STIED in new patients, and how to extract IED localization using further post-processing (since our deep learning classifiers only predict the presence or absence of IEDs within a window, without specifying its precise timing or localization). Specifically, the timing of each predicted IED was extracted as the highest-amplitude peak within the corresponding window (according to STIED). The brain source generator of each predicted IED was then localized as the global maximum of brain activity at the corresponding timing, imaged on patients' MRI using noise-standardized Minimum Norm Estimation (see [ 34 ] for implementation details). To give a sense of clustering of predicted IED location, we created an IED density map by binarizing each IED brain image (value 1 in a 5-mm voxel around the global maximum, zero elsewhere) and averaging them over all predictions in the patient so as to measure the fraction of IEDs predicted at this voxel (i.e., a voxel at 100% concentrates all predicted IEDs, whereas IEDs are spread over large areas in a map with low values). Although VDS-IEDs were not marked temporally as they were in the FE patients, we had access to the localization of VDS-IED brain sources reconstructed by a clinical magnetoencephalographer (X.D.T.) using ECD modeling, to which we compared our density map of STIED predictions. Of note, the lack of temporal annotations did not allow us to go beyond this qualitative comparison of localizations and evaluate quantitatively detection performance in RFE patients. III. RESULTS We now report the detection performance of these supervised DL models and analyze the impact of using temporal, spatial, or spatiotemporal features. We also explore the validity of our data reduction, assess the relevance of IED amplitude and IED morphology in STIED and compare its performance to unsupervised detection algorithms (ICA and HMM). Then, we test the possible generalizability of STIED to another, unlabeled dataset of patients with RFE. A. Detection performance of STIED in SeLECTS The performance metrics for the three DL model types (temporal 1D-CNN, spatial 2D-CNN, spatiotemporal STIED) are summarized in TABLE 2 for balanced and unbalanced test data. Impact of model type Classification accuracy and specificity were consistently large whatever the model type, both for balanced and unbalanced test data (accuracy > 85%, specificity > 93%; mean over 10 cross-validation iterates), with no significant effect of model type (p > 0.12). So, all three DL models were equivalent in their ability to correctly predict VDS-IEDs. Sensitivity was on average larger for the temporal and spatiotemporal models (> 84%) than for the spatial model (75%), though this observation was not statistically significant due to large inter-subject variability in sensitivity (p > 0.26). This suggests that temporal features of IED waveforms are most useful to avoid false detections. Despite the absence of statistical effects, combining spatiotemporal features maximized all three performance metrics in the realistic setup of unbalanced test data (TABLE 2), indicating a slight but possible superiority of the STIED model, on which we shall focus hereafter. Interestingly, the trained weights \(\:{w}_{t}\) and \(\:{w}_{s}\) were both close to 0.5, showing that while STIED did not perform significantly better than the temporal 1D-CNN model, it effectively used both temporal and spatial features in its decision process. Balanced vs. unbalanced metrics The observation of similar performance metrics from balanced and unbalanced test data (TABLE 2) further advocates for the robustness of our DL algorithms. Specifically, the identical sensitivities (combined with consistently large specificities) indicate that all three models identified the same IEDs regardless of the amount of data without VDS-IEDs. In other words, DL model performance did not depend on IED frequency of the test patient. This conclusion was further supported by the absence of correlations between performance metrics and number of VDS-IEDs (Spearman correlation, |r 0.36). Impact of data reduction The first PC used for data reduction explained significantly more data variance than the second PC of same windowed data ( t test on window covariance eigenvalues, p < 3e-6), but this does not preclude that the latter contains useful IED features. Figure 5 a compares performance metrics (unbalanced test data) for our three DL models applied to the first vs. second PC. All metrics were significantly smaller when using the second PC in STIED (p < 0.01), with a particularly strong drop in mean sensitivity of 52%. The drop in accuracy and sensitivity were similarly significant in the temporal and spatial models (p 0.11). Thus, the second PC contains remnant, low-variance features of IEDs excluded by our data reduction procedure, though these features are less effective at IED detection and are poorly specific to IEDs. Comparison with unsupervised classifications TABLE 3 compares performance metrics of STIED (unbalanced test data) to those of two unsupervised detection algorithms (ICA and HMM) developed in a previous work and tested on the same dataset [ 17 ]. All approaches showed similar sensitivities (p = 0.67), but STIED was significantly more specific to IEDs than both supervised methods (< 55%; p < 2e-9). This merely reflects the expected fact that the supervised DL algorithm learns from VDS-IEDs and thus follows closely the clinical magnetoencephalographer’s decision. B. Generalizability of FE-group-trained STIED to RFE patients As a final step, we sought to evaluate the performance of our STIED model, trained in our FE group, on 12 patients with RFE. Perhaps unsurprisingly, results were mitigated with only 2 patients reproducing exactly the location of IED events, 9 patients in which additional non-epileptiform events were detected besides the accurate location of VDS-IEDs, and 1 patient in which a cluster of VDS-IEDs was missed altogether. Figure 6 illustrates these results by comparing the density map of predicted IEDs (Fig. 6 , left) and ECD localization of VDS-IEDs (Fig. 6 , right) in three patients. Figure 6 a is representative of the successful cases where STIED co-localizes IEDs with VDS-IEDs. Both approaches were consistent with multifocal independent irritative zones, with the most active being posterior to the left frontal lesion. Figure 6 b illustrates a case of partial success. Clinical analysis reported few VDS-IEDs, which were accurately identified by the STIED model. Nonetheless, Rolandic spikes in the centrotemporal area and sleep-related events in the occipital areas were also wrongly predicted, likely indicative of physiological transients [ 10 ], [ 36 ]. Figure 6 c illustrates a case of mitigated success. Clinical assessment revealed two active, independent irritative zones located at the left opercular/periinsular and ventral occipital regions, which might be part of a common epileptogenic network, but STIED missed the ventral occipital cluster of VDS-IEDs. We conclude that, while STIED trained on FE patients learned IED features that generalize to all patients with RFE, other types of epileptiform activities were not recognized (such as polymorphic waveform), while some forms of physiological activity were falsely detected. IV. DISCUSSION The development of fully automated tools for the detection and localization of IEDs is a long-standing goal in the field of clinical epilepsy. Here, we introduced STIED, a simple yet effective DL solution for IED automatic detection in clinical MEG recordings. This is part of the global momentum that “artificial intelligence” bears in technology, not the least in medical fields—including neuroscience [ 37 ], [ 38 ] and clinical epilepsy [ 39 ]. In fact, STIED is not the first attempt in applying supervised DL to the evaluation of epilepsy with MEG ([ 18 ]–[ 21 ]). Here, we aimed to design a computationally reasonable architecture that encodes both temporal and spatial features in a way analogous to how clinical magnetoencephalographers analyze their clinical MEG recordings [ 10 ]. This allowed us to train our STIED model with high sensitivity and specificity, despite a relatively small training dataset, at least in the context of our FE group. We focused here on patients with FE, mainly SeLECTS, because their high IED amplitude and frequency yielded a relatively large count of IED events in a limited duration of MEG signals, which admittedly may have contributed to the efficient training of STIED at small dataset size. Interestingly, our results suggest that, after training, detection performance does not depend closely on IED frequency and thus could generalize to epileptic patients with scarcer interictal events. This contrasts with previous recent studies [ 18 ]–[ 20 ] proposing DL-based IED detection, which showed a substantial drop in sensitivity to less than 50% when assessed with unbalanced compared to balanced test data [ 20 ]. While authors overcame this issue ad-hoc by adjusting the probability threshold at the end of their decision blocks (using a thresholding moving strategy to enhance performance [ 18 ]–[ 20 ]), one advantage of our DL models is that they showed high sensitivity without such adjustment. Still, the generalizability of our current version of STIED to other types of epilepsy such as RFE was partial, presumably because it does not capture sufficiently the variety of IED field patterns and waveform morphologies (which may be different in deep medial temporal epilepsy [ 40 ] or change as the type of epilepsy evolves with age [ 41 ]). This being said, this paper provides proof of concept for the effectiveness of the STIED model architecture. Future updates of STIED with a larger and more diverse training dataset are necessary to fully validate this DL solution and to widen its range of applicability. STIED could also be an efficient and fast approach to assess the spike-wave index (i.e., fraction of recording time showing spike-and-wave activity [ 42 ]), a key diagnostic element for some pediatric epileptic conditions (reaching up to 85% in our training dataset [ 43 ]). The STIED architecture is the result of several trials not reported here. Regarding artificial neural network design, we quickly settled for a quite classical setup that combines 1D-CNN as done in previous works to analyze temporal signals [ 44 ], 2D-CNN typical of spatial image processing [ 45 ], and dense layers with sigmoid final neuron for classification. The number and size of layers were varied to maximize performance while minimizing complexity. In this endeavor, the identification of CNN inputs with relevant low-dimensional features amongst high-dimensional MEG data, proved key. We did so using a data reduction based on PCA that loosely follows what is done during clinical MEG visual analysis, i.e., extract IED waveform signals from gradiometers and images of IED dipolar patterns from magnetometers. This likely explains why STIED could learn from, and closely agree with, clinical magnetoencephalographers. One possible caveat of this procedure is that PCA can be dominated by large-amplitude transients such as electronic noise or physiological artefacts (e.g., ocular and cardiac magnetic fields) in time windows where they occur. This would likely be detrimental to STIED detection performance, at least for IED events simultaneous to noise artefacts. However, this possible issue was mitigated here altogether by MEG signal denoising prior to model training and testing. Another caveat of this data reduction was the exclusion of MEG features specific of, though poorly sensitive to, IEDs. Critically, it might also miss deep epileptiform activity, which would be subdominant in MEG recordings [ 32 ]. This limitation could be alleviated in future updates of STIED that would allow inputting multiple PCs, though at the moment the right number to use remains unclear. On the other hand, this strong data reduction allowed to train and run the model on affordable hardware, with high performance despite reasonable training times (about 4 hours for 10 subjects with 5-min MEG recordings) and small processing time of new data (less than 30 seconds for 1 hour MEG recording). This means that STIED can detect IEDs similarly to clinical magnetoencephalographers, about 300 time faster—again at least within our FE group. Beyond sheer performance, we sought to partially reverse engineer the STIED model and investigate what features of MEG signals drive IED detection. Generally speaking, reaching a full interpretation of model decisions remains a difficult and fundamental issue in the field of DL. The scope of our interpretability analysis here was relatively restricted and focused specifically on the impact of amplitude and input data type (temporal, spatial, or spatiotemporal). A surprising finding is that the amplitude of IED waveforms—at first sight a primary gross characteristic of epileptiform activity—was not critical in the STIED decision process. In fact, IED amplitude alone was poorly specific of visually identified epileptiform activity. Interestingly, a similarly low specificity was found in unsupervised algorithms based on ICA and HMM, for which arguments were given for the hypothesis that false positive events actually correspond to genuine but small-amplitude IEDs unidentified by clinical MEG evaluation [ 17 ]. This illustrates a possible advantage of unsupervised models. On the other hand, STIED yielded a fully automated decision, whereas both ICA and HMM were semi-automated. Further, whether such small-amplitude events, unidentified by STIED too, represent IEDs or clinically irrelevant physiological events, remains to be fully clarified. In the current state of knowledge, a conservative approach may be warranted for clinical applications so STIED likely represents the best data-driven approach so far. In the future, it will be interesting to compare the outcome of STIED and unsupervised algorithms in other types of IED recordings, such as the ICA of MEG based on optically pumped magnetometers [ 46 ] or the HMM of stereo-electroencephalography data [ 47 ]. Our reverse engineering analysis also revealed that, while STIED does rely on both its spatial and temporal inputs (as we intended), the spatial features of IED magnetic topography bring at most a subtle added value to detection performance, compared with the temporal morphology of IEDs. In hindsight, this is likely because IED spiking waveforms are automatically accompanied with dipolar magnetic field patterns, so the latter do not add independent information to the former. Indeed, epileptiform spikes originate from bursts of hyperexcitable neurons within focal neural populations. In neocortical epilepsies (as was the case in our training group), focal excitation leads to post-synaptic current flows along apical dendrites of pyramidal neurons that are necessarily dipolar [ 48 ]. More generally, all sharp electrophysiological events—not only IEDs but also physiological transients typically occurring in Rolandic, supramarginal, and occipital areas[ 10 ], [ 36 ] as well as transient oscillatory bursts emerging in brain functional networks [ 49 ]–[ 51 ]—are focal and thus dipolar. Spatial features thus hardly distinguish sharp physiological events from IEDs, which presumably explains the poorer performance of the spatial DL model. Another, more technical implication is that data augmentation by rotation of topographical patterns should not be overdone. While we initially reasoned (following standard image recognition processing) that such rotations would improve model generalizability across patients by allowing more diverse IED localizations, during our trial phase we found that coarse 90-degree rotations used here worked better than finer rotations (e.g., at 12 degrees, the sensitivity of the spatial DL model tended to increase slightly, but specificity dropped significantly, p < 0.03). Associating IEDs with too many dipolar patterns presumably renders DL models oversensitive to sharp physiological events. This aspect will require further consideration when updating STIED with a larger training dataset. On the other hand, including spatial features might help against false detections of spike-like artefacts that may arise in MEG signals with atypical dipolar patterns. The problem of physiological confounds was somewhat alleviated by the inclusion of temporal features, yet physiological transients with spiking waveform morphology remain a critical challenge to overcome [ 10 ], [ 36 ] as they are detrimental to detection specificity. This was illustrated by the high rate of false detections, together with the accurate location of VDS-IEDs, when applying our current version of STIED to sleep recordings of 9 out 12 patients with RFE. Some physiological transients typically emerge during drowsiness and sleep [ 28 ], so a critical next step might be to include sleep recordings of healthy controls to help STIED learn to distinguish them from epileptiform activity. V. CONCLUSION In sum, we provided proof of concept that STIED is a promising DL solution for the automated detection of IEDs in focal epilepsy, though further validation is necessary before envisaging deployment in clinical routine. In future work, we intend to update the current version with a large-scale training dataset of labelled MEG recordings in patients with different types of epilepsies, including sleep recordings to discriminate physiological spikes. If expected improvements in model generalizability and detection specificity are confirmed, this would establish STIED as an invaluable tool to assist clinical magnetoencephalographers in getting a fast and accurate clinical evaluation of epilepsy from MEG recordings. Declarations Data availability The datasets generated and/or analysed during the current study are not publicly available but are available from the corresponding author on reasonable request. Data and codes will be made available on request after approval by institutional authorities (Hôpital Universitaire de Bruxelles and Université Libre de Bruxelles). Acknowledgments This work was supported by the Fonds Erasme (Brussels, Belgium; Research Convention: « Les Voies du Savoir»). Odile Feys is supported by the Fonds pour la Formation à la Recherche dans l’Industrie et l’Agriculture (FRIA, Fonds de la Recherche Scientifique (FRS-FNRS), Brussels, Belgium). Xavier De Tiège is Clinical Researcher at the FRS-FNRS (Brussels, Belgium). The MEG project at the Hôpital Universitaire de Bruxelles is financially supported by the Fonds Erasme. Author contribution Raquel Fernández-Martín (R.F.M.) and Alfonso Gijón (A.G.) contributed to the conceptualization, methodology, design and implementation of the algorithm, software, formal analysis, investigation, validation, visualization and writing (original draft, review and editing); Odile Feys (O.F.) contributed to data acquisition, clinical data analysis (localization of IEDs) and writing (review); Elodie Juvené (E.J.) contributed to data acquisition and writing (review); Alec Aeby (A.A.) contributed to writing (review) and resources; Charline Urbain (C.U.) contributed to writing (review) and resources; Xavier De Tiège (X.D.T.) contributed to conceptualization, data acquisition and clinical data analysis (localization of IEDs), supervision, writing (review), resources and funding; Vincent Wens (V.W.) contributed to conceptualization, methodology, investigation, validation, supervision and writing (original draft, review and editing). Competing interests The authors declare no competing interests. Consent for publication All authors have read the manuscript and consent to publish. Additional information Correspondence and requests for materials should be addressed to R.F.M. and A.G. References Fisher, R. S. et al. ILAE Official Report: A practical clinical definition of epilepsy. Epilepsia 55 (4), 475–482 (2014). Picot, M. C., Baldy-Moulinier, M., Daurès, J. P., Dujols, P. & Crespel, A. The prevalence of epilepsy and pharmacoresistant epilepsy in adults: A population-based study in a Western European country, Epilepsia , vol. 49, no. 7, pp. 1230–1238, Jul. (2008). Kirsch, H. E., Robinson, S. E., Mantle, M. & Nagarajan, S. Automated localization of magnetoencephalographic interictal spikes by adaptive spatial filtering, Clinical Neurophysiology , vol. 117, no. 10, pp. 2264–2271, Oct. (2006). Kural, M. A. et al. Criteria for defining interictal epileptiform discharges in EEG: A clinical validation study. Neurology 94 (20), e2139–e2147 (May 2020). Panigrahi, M. & Jayalakshmi, S. Presurgical evaluation of epilepsy, J Pediatr Neurosci , vol. 3, no. 1 SUPPL., pp. 74–81, (2008). Feys, O., De, X. & Tiège From cryogenic to on-scalp magnetoencephalography for the evaluation of paediatric epilepsy, Dev Med Child Neurol , Jul. (2023). Bagic, A. I., Knowlton, R. C., Rose, D. F. & Ebersole, J. S. American Clinical Magnetoencephalography Society Clinical Practice Guideline 1 (Recording and Analysis of Spontaneous Cerebral Activity*, 2011). Ebersole, J. S. Magnetoencephalography/Magnetic Source Imaging in the Assessment of Patients with Epilepsy, (1997). De Tiège, X., Lundqvist, D., Beniczky, S., Seri, S. & Paetau, R. Current clinical magnetoencephalography practice across Europe: Are we closer to use MEG as an established clinical tool? Seizure 50 , 53–59 (Aug. 2017). Laohathai, C. et al. Practical Fundamentals of Clinical MEG Interpretation in Epilepsy. Front. Neurol. , 12 . Frontiers Media S.A., 14-Oct-2021. Malinowska, U. et al. Interictal networks in Magnetoencephalography. Hum. Brain Mapp. 35 (6), 2789–2805 (2014). Pizzo, F. et al. Deep brain activities can be detected with magnetoencephalography, Nat Commun , vol. 10, no. 1, Dec. (2019). Ossadtchi, A. et al. Automated interictal spike detection and source localization in magnetoencephalography using independent components analysis and spatio-temporal clustering. Clin. Neurophysiol. 115 (3), 508–522 (2004). Ossadtchi, A., Mosher, J. C., Sutherling, W. W., Greenblatt, R. E. & Leahy, R. M. Hidden Markov modelling of spike propagation from interictal MEG data, Phys Med Biol , vol. 50, no. 14, pp. 3447–3469, Jul. (2005). Seedat, Z. A. et al. Mapping Interictal activity in epilepsy using a hidden Markov model: A magnetoencephalography study. Hum. Brain Mapp. , (2022). Ye, S., Bagić, A. & He, B. Disentanglement of Resting State Brain Networks for Localizing Epileptogenic Zone in Focal Epilepsy, preprint , (2022). Fernández-Martín, R. et al. Towards the automated detection of interictal epileptiform discharges with magnetoencephalography, J Neurosci Methods , vol. 403, Mar. (2024). Zheng, L. et al. EMS-Net: A Deep Learning Method for Autodetecting Epileptic Magnetoencephalography Spikes, IEEE Trans Med Imaging , vol. 39, no. 6, pp. 1833–1844, Jun. (2020). Hirano, R. et al. Fully-Automated Spike Detection and Dipole Analysis of Epileptic MEG Using Deep Learning, IEEE Trans Med Imaging , vol. 41, no. 10, pp. 2879–2890, Oct. (2022). Mouches, P. et al. Time CNN and Graph Convolution Network for Epileptic Spike Detection in MEG Data. Oct (2023). Zheng, L. et al. An artificial intelligence–based pipeline for automated detection and localisation of epileptic sources from magnetoencephalography. J. Neural Eng. 20 (4), 046036 (Aug. 2023). Feys, O. et al. Diagnostic and therapeutic approaches in refractory insular epilepsy, Epilepsia , Jun. (2023). Bickel, P. et al. Springer Series in Statistics. De Tiège, X. et al. Clinical added value of magnetic source imaging in the presurgical evaluation of refractory focal epilepsy. J. Neurol. Neurosurg. Psychiatry . 83 (4), 417–423 (2012). De Tiège, X. et al. Recording epileptic activity with MEG in a light-weight magnetic shield, Epilepsy Res , vol. 82, no. 2–3, pp. 227–231, Dec. (2008). Taulu, S., Simola, J. & Kajola, M. Applications of the signal space separation method, IEEE Transactions on Signal Processing , vol. 53, no. 9, pp. 3359–3372, Sep. (2005). Hyvärinen, A., Karhunen, J. & Oja, E. Independent Component Analysis, (2001). Vigário, R. N. Independent component approach to the analysis of EEG and MEG signals. Acta Polytech. Scand. 47 (101), 589–593 (1999). Mathematics and Computing Series. Khalid, M. I. et al. Epileptic MEG Spikes Detection Using Amplitude Thresholding and Dynamic Time Warping. IEEE Access. 5 , 11658–11667 (2017). Oostenveld, R., Fries, P., Maris, E. & Schoffelen, J. M. FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data, Comput Intell Neurosci , vol. 2011. (2011). Hari, R. & Puce, A. MEG - EEG Primer . (2023). Enatsu, R. et al. Usefulness of MEG magnetometer for spike detection in patients with mesial temporal epileptic focus, Neuroimage , vol. 41, no. 4, pp. 1206–1219, Jul. (2008). Wens, V. Exploring the limits of MEG spatial resolution with multipolar expansions, Neuroimage , vol. 270, Apr. (2023). Wens, V. et al. A geometric correction scheme for spatial leakage effects in MEG/EEG seed-based functional connectivity mapping, Hum Brain Mapp , vol. 36, no. 11, pp. 4604–4621, Nov. (2015). Abadi, M. et al. TensorFlow: (2015). Large-Scale Machine Learning on Heterogeneous Systems. Rampp, S. et al. Normal Variants in Magnetoencephalography, Journal of Clinical Neurophysiology , vol. 37, no. 6. Lippincott Williams and Wilkins, pp. 518–536, 01-Nov-2020. Badrulhisham, F., Pogatzki-Zahn, E., Segelcke, D., Spisak, T. & Vollert, J. Machine learning and artificial intelligence in neuroscience: A primer for researchers, Brain Behav Immun , vol. 115, pp. 470–479, Jan. (2024). Marblestone, A. H., Wayne, G. & Kording, K. P. Toward an integration of deep learning and neuroscience, Front Comput Neurosci , vol. 10, no. SEP, Sep. (2016). Lucas, A., Revell, A. & Davis, K. A. Artificial intelligence in epilepsy — applications and pathways to the clinic. Nat. Rev. Neurol. 20 (6), 319–336 (2024). Feys, O. et al. On-Scalp Magnetoencephalography Based On Optically Pumped Magnetometers Can Detect Mesial Temporal Lobe Epileptiform Discharges, Ann Neurol , vol. 95, no. 3, pp. 620–622, Mar. (2024). Feys, O. et al. On-scalp magnetoencephalography for the diagnostic evaluation of epilepsy during infancy, Clinical Neurophysiology , vol. 155. Elsevier Ireland Ltd, pp. 29–31, 01-Nov-2023. Aeby, A. et al. A qualitative awake EEG score for the diagnosis of continuous spike and waves during sleep (CSWS) syndrome in self-limited focal epilepsy (SFE): A case-control study. Seizure 84 , 34–39 (Jan. 2021). Feys, O. et al. May, and X. De Tiège, On-Scalp Optically Pumped Magnetometers versus Cryogenic Magnetoencephalography for Diagnostic Evaluation of Epilepsy in School-aged Children. Radiology , (2022). Kiranyaz, S. et al. 1D convolutional neural networks and applications: A survey, Mech Syst Signal Process , vol. 151, Apr. (2021). Li, Z., Liu, F., Yang, W., Peng, S. & Zhou, J. A Survey of Convolutional Neural Networks: Analysis, Applications, and Prospects. IEEE Trans. Neural Netw. Learn. Syst. 33 (12), 6999–7019 (2022). Feys, O. et al. and X. De Tiège, Tri-axial rubidium and helium optically pumped magnetometers for on-scalp magnetoencephalography recording of interictal epileptiform discharges: a case study, Front Neurosci , vol. 17, (2023). Feys, O. et al. Delayed effective connectivity characterizes the epileptogenic zone during stereo-EEG. Clin. Neurophysiol. 158 , 59–68 (Feb. 2024). Hamalainen, M., Hari, R., Ilmoniemi, R. J., Knuutila, J. & Lounasmaa, O. V. Magnetoencephalography theory, instrumentation, and applications to noninvasive studies of the working human brain, (1993). Hari, R. & Salmelin, R. Human cortical oscillations: a neuromagnetic view through the skull. Trends Neurosci. , (1997). van Ede, F., Quinn, A. J., Woolrich, M. W. & Nobre, A. C. Neural Oscillations: Sustained Rhythms or Transient Burst-Events? Trends in Neurosciences , vol. 41, no. 7. Elsevier Ltd, pp. 415–417, 01-Jul-2018. Coquelet, N. et al. Microstates and power envelope hidden Markov modeling probe bursting brain activity at different timescales, Neuroimage , vol. 247, Feb. (2022). Additional Declarations No competing interests reported. Cite Share Download PDF Status: Published Journal Publication published 01 Jul, 2025 Read the published version in Scientific Reports → Version 1 posted Editorial decision: Accepted 22 May, 2025 Reviews received at journal 07 May, 2025 Reviewers agreed at journal 28 Apr, 2025 Reviewers invited by journal 28 Apr, 2025 Submission checks completed at journal 18 Apr, 2025 First submitted to journal 04 Apr, 2025 You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-5974529","acceptedTermsAndConditions":true,"allowDirectSubmit":false,"archivedVersions":[],"articleType":"Article","associatedPublications":[],"authors":[{"id":449270583,"identity":"160b0360-e248-43c6-9145-93159cc682f6","order_by":0,"name":"Raquel Fernández-Martín","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABL0lEQVRIie3QMUvDQBTA8QcHcbk0m1w40a/wJBARi/kqkUCyRAkUQgaRTHGpzvFbVATnlANdzs6CbkImh0IXwaJeGxQlqeDmcP8p5Pjx7h2ATvdvS8BqPozPPwibsEaBrCQIdv6DVAgOkL8RgIN8Bdk5FddsisAsfjeeJWnfg3VRz6bJYzQSZkWSrEU2ZJjapSL2+VHAy0lIgIdOWWF9OBI9n5SyRRjELqcIJygpcrMQBnDfUbsIRSgSs2gT69nlczXFk9R5NYt3CjyaLUiES/LWJkxNUeszpNRVUyoGPF5O8RuSd5B6sDtExpik7h6dBGjweAASxfaF2kWUNx0XCy7vX7I+s4bUeaDpvmfx6Aqyudjq3Z6Nn5LjjmdWt1q8wlfG97OqCzREp9PpdL/0AUqNW5KaESusAAAAAElFTkSuQmCC","orcid":"","institution":"Université Libre de Bruxelles","correspondingAuthor":true,"prefix":"","firstName":"Raquel","middleName":"","lastName":"Fernández-Martín","suffix":""},{"id":449270584,"identity":"f641f9d0-f736-4edf-8c3a-2aeea0004aa1","order_by":1,"name":"Alfonso Gijón","email":"","orcid":"","institution":"University of Córdoba","correspondingAuthor":false,"prefix":"","firstName":"Alfonso","middleName":"","lastName":"Gijón","suffix":""},{"id":449270587,"identity":"0a219735-16ac-48a1-a459-7b7a2cd8a214","order_by":2,"name":"Odile Feys","email":"","orcid":"","institution":"Université Libre de Bruxelles","correspondingAuthor":false,"prefix":"","firstName":"Odile","middleName":"","lastName":"Feys","suffix":""},{"id":449270589,"identity":"8f8efc7c-a474-461e-802d-f97aaf5a8837","order_by":3,"name":"Elodie Juvené","email":"","orcid":"","institution":"Université Libre de Bruxelles","correspondingAuthor":false,"prefix":"","firstName":"Elodie","middleName":"","lastName":"Juvené","suffix":""},{"id":449270591,"identity":"757fa615-4dab-4fa1-9a31-b42ce9c2d155","order_by":4,"name":"Alec Aeby","email":"","orcid":"","institution":"Université Libre de Bruxelles","correspondingAuthor":false,"prefix":"","firstName":"Alec","middleName":"","lastName":"Aeby","suffix":""},{"id":449270592,"identity":"f52fb530-cd6c-4b23-b495-c8cb0b107955","order_by":5,"name":"Charline Urbain","email":"","orcid":"","institution":"Université Libre de Bruxelles","correspondingAuthor":false,"prefix":"","firstName":"Charline","middleName":"","lastName":"Urbain","suffix":""},{"id":449270594,"identity":"a6253721-1b26-436a-8658-564302e074bb","order_by":6,"name":"Xavier De Tiège","email":"","orcid":"","institution":"Université Libre de Bruxelles","correspondingAuthor":false,"prefix":"","firstName":"Xavier","middleName":"","lastName":"De Tiège","suffix":""},{"id":449270595,"identity":"80fdc60d-dc4c-48ec-82be-0498803947c0","order_by":7,"name":"Vincent Wens","email":"","orcid":"","institution":"Université Libre de Bruxelles","correspondingAuthor":false,"prefix":"","firstName":"Vincent","middleName":"","lastName":"Wens","suffix":""}],"badges":[],"createdAt":"2025-02-06 14:53:08","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-5974529/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-5974529/v1","draftVersion":[],"editorialEvents":[{"content":"https://doi.org/10.1038/s41598-025-03880-1","type":"published","date":"2025-07-01T15:57:41+00:00"}],"editorialNote":"","failedWorkflow":false,"files":[{"id":82067354,"identity":"dac91c46-5a96-4cd5-8f86-96d0fe91f17c","added_by":"auto","created_at":"2025-05-06 12:44:55","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":8731245,"visible":true,"origin":"","legend":"\u003cp\u003eSchematic representation of the overall deep learning approach. A. Raw MEG data. B. MEG preprocessing. C. Machine learning (ML) preprocessing. D. Training and testing steps conducted to develop the three DL models (temporal, spatial, spatiotemporal) following the LOOCV design. E. Prediction step in new raw MEG data, resulting in a binary yes/no (spike/non-spike) prediction for the patient data left out in the LOOCV design.\u003c/p\u003e","description":"","filename":"image1.png","url":"https://assets-eu.researchsquare.com/files/rs-5974529/v1/1dc06217fb255a205b71c75b.png"},{"id":82066296,"identity":"33b52889-710d-4fef-9769-9d0d11632de4","added_by":"auto","created_at":"2025-05-06 12:36:55","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":2239182,"visible":true,"origin":"","legend":"\u003cp\u003eTemporal model architecture (1D-CNN). The input corresponds to the gradiometric waveform of a time window. The architecture includes three temporal CNNs (1D-Conv, followed by dropout and maxpooling) and a decision block (flattening and two dense layers).\u003c/p\u003e","description":"","filename":"image2.png","url":"https://assets-eu.researchsquare.com/files/rs-5974529/v1/da8a6047cf4b66b7ab2c42b7.png"},{"id":82066286,"identity":"d960bf80-3291-4382-a747-be632c5b2ff3","added_by":"auto","created_at":"2025-05-06 12:36:55","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":2159254,"visible":true,"origin":"","legend":"\u003cp\u003eSpatial model architecture (2D-CNN). The input corresponds to the magnetometric field topography of a time window. The architecture includes three spatial CNNs (2D-Conv, followed by dropout and maxpooling) and a decision block (flattening, and two dense layers).\u003c/p\u003e","description":"","filename":"image3.png","url":"https://assets-eu.researchsquare.com/files/rs-5974529/v1/4d37f0da2d25425ec53a3c80.png"},{"id":82066304,"identity":"6bfaa8d7-d40b-4d34-b744-eb191ac9e612","added_by":"auto","created_at":"2025-05-06 12:36:56","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":6456384,"visible":true,"origin":"","legend":"\u003cp\u003eSpatiotemporal model (STIED): The input corresponds to both the gradiometric waveform and the magnetometric topography of a time window. The architecture incorporates both 1D-CNN and 2D-CNN up to their dense layer, an extra dropout, a weighted concatenation with trainable weights (\u003cem\u003eW\u003c/em\u003e\u003csub\u003et\u003c/sub\u003e and \u003cem\u003eW\u003c/em\u003e\u003csub\u003e\u003cem\u003es\u003c/em\u003e\u003c/sub\u003e), and a common decision block (two dense layers).\u003c/p\u003e","description":"","filename":"image4.png","url":"https://assets-eu.researchsquare.com/files/rs-5974529/v1/84e20e5265229a0c67189704.png"},{"id":82066309,"identity":"2041c896-3475-4213-ae79-b00da1c18833","added_by":"auto","created_at":"2025-05-06 12:36:56","extension":"png","order_by":5,"title":"Figure 5","display":"","copyAsset":false,"role":"figure","size":4286731,"visible":true,"origin":"","legend":"\u003cp\u003e(a)\u003cem\u003e \u003c/em\u003eDetection performance of the temporal, spatial and spatiotemporal models obtained from 1st-PC (purple) vs. 2nd-PC (yellow). (b) Detection performance of the three DL Full models (purple; top, 1D-CNN; middle, 2D-CNN; bottom, STIED) compared with NormAmplitude models encoding morphological and/or topographical IED features independently of their amplitude (green), and with MaxAmplitude models encoding the amplitude feature only (orange). All performance metrics are based on unbalanced test data. Bar plots show mean values across 10-fold LOOCV, and vertical bars show standard errors. “*” indicates statistical significance (ANOVA, post-hoc t tests).\u003c/p\u003e","description":"","filename":"image5.png","url":"https://assets-eu.researchsquare.com/files/rs-5974529/v1/0615930361598aca73f81401.png"},{"id":82066327,"identity":"4da9b6c1-80c9-4f20-bd8d-2407b9511ccc","added_by":"auto","created_at":"2025-05-06 12:36:56","extension":"png","order_by":6,"title":"Figure 6","display":"","copyAsset":false,"role":"figure","size":18070390,"visible":true,"origin":"","legend":"\u003cp\u003eLocalization of STIED predictions and VDS-IEDs in selected RFE patients.\u003cstrong\u003e \u003c/strong\u003eLeft panel: Density maps of IEDs predicted by STIED, representing the fraction of IEDs predicted at each voxel. Color scales are adjusted to maximal fraction in patient. Right panel: ECD localization of VDS-IEDs. Each white dot indicates the dipole localization of one IED detected by visual analysis of MEG signals. (a) Successful example of coincident localization (blue squares). (b) Partially successful example where non-epileptiform events (green squares) are detected, such as Rolandic and sleep physiological transients. (c) Mitigated example where a cluster of VDS-IEDs is missed (orange squares) in the left-occipital part. All MRIs are in neurological convention.\u003c/p\u003e","description":"","filename":"image6.png","url":"https://assets-eu.researchsquare.com/files/rs-5974529/v1/beacc03cf4b499e9abe7659f.png"},{"id":86180261,"identity":"df01f32b-c4ab-46d7-b3b5-39f5db5579a8","added_by":"auto","created_at":"2025-07-07 16:21:47","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":40676586,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-5974529/v1/e02860b0-c7c3-495b-b4a0-a94cd356ff65.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"STIED: A deep learning model for the SpatioTemporal detection of focal Interictal Epileptiform Discharges with MEG","fulltext":[{"header":"I. INTRODUCTION","content":"\u003cp\u003eEpilepsy is a disorder of the brain characterized by an enduring predisposition to generate epileptic seizure [\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e]. It affects people of all ages and has neurobiological, cognitive, psychological and social consequences. While pharmacological treatments work successfully in most patients, approximately one-third of them suffer from refractory (i.e., drug-resistant) epilepsy [\u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e]. These patients are possible epilepsy surgery candidates and must therefore undergo a presurgical evaluation aiming at delineating as precisely as possible the epileptogenic zone.\u003c/p\u003e \u003cp\u003eMagnetoencephalography (MEG) contributes to this evaluation, mainly by allowing the non-invasive detection and localization of interictal epileptiform discharges (IEDs)\u0026mdash;subclinical events occurring between seizures [\u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e3\u003c/span\u003e], [\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e]\u0026mdash; which help to localize the epileptogenic zone [\u003cspan citationid=\"CR5\" class=\"CitationRef\"\u003e5\u003c/span\u003e], [\u003cspan citationid=\"CR6\" class=\"CitationRef\"\u003e6\u003c/span\u003e]. Clinical MEG analysis of patients with epilepsy traditionally relies on the visual identification of IEDs by an experienced clinical magnetoencephalographer, who inspects both IED sensor time courses and spatial topographies along with their source localization, usually by equivalent current dipole (ECD) modeling [\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e], [\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e]. This approach is highly time consuming (on average 8 hours per patient [\u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e]) and partially subjective (notwithstanding existing guidelines [\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e]). The development of efficient data-driven, automatic approaches to IED detection would represent a major advance in clinical MEG practice. Several proposals based on unsupervised algorithms have been explored, e.g., Independent Component Analysis (ICA) and Hidden Markov Modeling (HMM), with limitations regarding detection specificity or full automation [\u003cspan additionalcitationids=\"CR12 CR13 CR14 CR15 CR16\" citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e]\u0026ndash;[\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eIn the last years, supervised deep learning (DL) algorithms emerged as novel automatic approaches [\u003cspan additionalcitationids=\"CR19 CR20\" citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e]\u0026ndash;[\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e]. These methods are mainly based on convolutional neural networks (CNNs) extracting temporal features of IED waveforms from MEG signals, and then supplemented with somewhat \u003cem\u003ead-hoc\u003c/em\u003e techniques for the subsequent spatial localization of epileptic events, e.g., splitting sensor channels into different brain regions [\u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e], [\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e], classification and segmentation networks [\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e], or graph convolutional networks [\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e]. While promising, none of these approaches performed well enough to be incorporated into routine clinical MEG practice.\u003c/p\u003e \u003cp\u003eHere, we hypothesized that a reliable, high-performance DL algorithm should combine both temporal (spiking waveform) and spatial (dipolar magnetic pattern) features used by clinical magnetoencephalographers to visually identify and select epileptiform discharges in MEG signals [\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e]. For that purpose, we designed STIED, a simple but powerful DL algorithm for the SpatioTemporal detection of focal IEDs. We trained and validated STIED models in a cohort of 10 school-aged children with focal epilepsy (FE) selected based on frequent, high-amplitude, and isolated IEDs arising mainly from the perisylvian areas to which MEG is highly sensitive [\u003cspan citationid=\"CR22\" class=\"CitationRef\"\u003e22\u003c/span\u003e]. These cases thus provide an excellent first case study to benchmark DL models. The sample size was not an issue here as we used a Leave-One-Out Cross-Validation (LOOCV) approach to estimate the performance of the model when used on new patient data. This approach is particularly appropriate for small datasets, especially when model accuracy is more important than the computational cost of training [\u003cspan citationid=\"CR23\" class=\"CitationRef\"\u003e23\u003c/span\u003e]. To test our hypothesis, we compared the performances of three CNN algorithms: a temporal model (1D-CNN applied to a MEG waveform) encoding temporal features only, a spatial model (2D-CNN applied to a magnetic field pattern) encoding spatial features only, and a spatiotemporal model integrating both aspects simultaneously. We show that all models lead to high-performance IED detection metrics (accuracy, specificity and sensitivity)\u0026mdash;with the spatiotemporal model being the most effective\u0026mdash;thanks to the combined encoding of IED amplitude with temporal waveform morphology and spatial dipolar magnetic pattern. As further proof of concept, we provide a preliminary test of the generalizability of the spatiotemporal model directly on 12 presurgical patients with refractory focal epilepsy (RFE), i.e., the typical clinical target of MEG diagnostic evaluation in epilepsy.\u003c/p\u003e"},{"header":"II.\tMETHODS","content":"\u003cp\u003eA. \u003cem\u003eParticipants and data acquisition\u003c/em\u003e\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eData acquisition\u003c/strong\u003e \u003cp\u003eParticipants underwent MEG scanning during a seizure-free wakeful rest of at least 5 minutes in sitting position with their eyes open for the FE group, and one hour of recording in supine position to trigger sleep for the RFE group (see [\u003cspan citationid=\"CR24\" class=\"CitationRef\"\u003e24\u003c/span\u003e] for details on the clinical MEG protocol). Data were recorded using a whole-scalp-covering MEG system (Neuromag Triux; MEGIN, Helsinki, Finland; 0.1\u0026ndash;330 Hz band-pass, 1 kHz sampling rate) installed in a lightweight magnetically shielded room (Maxshield, MEGIN; see [\u003cspan citationid=\"CR25\" class=\"CitationRef\"\u003e25\u003c/span\u003e] for details). The 306-channel sensor array combines 102 magnetometers and 204 planar gradiometers. Head movements were tracked by four coils whose position relative to fiducials (nasion and tragi) was digitized beforehand (Fastrack, Polhemus, Colchester, Vermont, USA), along with at least 300 face and scalp points for co-registration with a structural brain 3D T1-weighted magnetic resonance image (MRI) (Intera, Philips, The Netherlands).\u003c/p\u003e \u003c/p\u003e \u003cp\u003eB. \u003cem\u003eMEG data preparation\u003c/em\u003e\u003c/p\u003e \u003cp\u003eThe overall pipeline is illustrated in Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003e (upper panels A, B and C).\u003c/p\u003e \u003cp\u003e \u003cstrong\u003eMEG preprocessing\u003c/strong\u003e \u003cp\u003eWe followed standard denoising steps of MEG data, i.e., signal space separation to correct for environmental magnetic interferences and head movements (Maxfilter v2.2.14, MEGIN, with default parameters [\u003cspan citationid=\"CR26\" class=\"CitationRef\"\u003e26\u003c/span\u003e]), and ICA (FastICA, [\u003cspan citationid=\"CR27\" class=\"CitationRef\"\u003e27\u003c/span\u003e]) of band-filtered data (0.5\u0026ndash;45 Hz) to remove physiological artifacts (eye blinks and cardiac activity) [\u003cspan citationid=\"CR28\" class=\"CitationRef\"\u003e28\u003c/span\u003e]. The resulting data were further band-filtered between 4 and 30 Hz and temporally segmented into 200 ms-long non-overlapping windows. This length was chosen to enable full inclusion of isolated IEDs, whose typical duration range from 50 to 100 ms [\u003cspan citationid=\"CR29\" class=\"CitationRef\"\u003e29\u003c/span\u003e].\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eSpatial/temporal feature extraction\u003c/strong\u003e \u003cp\u003eInput data for training/testing of subsequent DL models was extracted from each window by applying principal component analysis (PCA) separately to the 204 planar gradiometer signals and to the 102 magnetometer signals. In each case, a principal component (PC) is associated with a magnetic topography that encodes its spatial distribution across sensors (magnetometers, size 102 channels \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e 1; gradiometers, 204 channels \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e 1) and a waveform that encodes how this magnetic pattern evolves in time within the window (size 1 \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e 200 time samples). Here, we elected to focus on the time course of the first PC of gradiometers, i.e., the combination of all 204 gradiometer signals that explained the largest fraction of temporal variance in the window, and on the spatial topography of the first PC of magnetometers, i.e., the magnetic field pattern that explained the largest fraction of spatial variance within the window. The latter topographies were then converted into 2D images by a fourth order polynomial interpolation over a 60 \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e 60 pixel grid using the open-source software FieldTrip [\u003cspan citationid=\"CR30\" class=\"CitationRef\"\u003e30\u003c/span\u003e]. This splitting of gradiometers/magnetometers to extract temporal/spatial features broadly reproduces the visual IED identification procedure typically followed by our clinical magnetoencephalographers; the higher signal-to-noise ratio of gradiometers yields a cleaner visualization of MEG time courses[\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e], [\u003cspan citationid=\"CR31\" class=\"CitationRef\"\u003e31\u003c/span\u003e] (notwithstanding lesser sensitivity to deep IED activity in, e.g., mesiotemporal epilepsy [\u003cspan citationid=\"CR32\" class=\"CitationRef\"\u003e32\u003c/span\u003e]) whereas magnetometers show higher sensitivity to dipolar magnetic patterns[\u003cspan citationid=\"CR33\" class=\"CitationRef\"\u003e33\u003c/span\u003e] (as well as to deep IEDs [\u003cspan citationid=\"CR32\" class=\"CitationRef\"\u003e32\u003c/span\u003e]). Extracting a single waveform or image per window also allowed to reduce the size and redundancy of input data, the size and complexity of our DL network models, and the computational load of model training. Since this data reduction could miss potentially relevant, low-variance IED features included in higher-order PCs, we also used second PCs as inputs to DL models and checked whether they bear predictive power for IED detection. Each of these PC data were further standardized per subject.\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eMachine learning preprocessing of training data (FE group)\u003c/strong\u003e \u003cp\u003eThe windowed data associated to FE patients was further prepared for model training. Each window was labeled according to a binary classification ('Spike'/'Non-spike') depending on whether or not it contains an annotated VDS-IED [\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e] (see Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003e, panel D). Over the resulting labeled dataset, we performed a threefold data augmentation. First, each 'Spike' window was shifted 15 times to the past and future by 7 ms steps, hence allowing to train our DL models independently of the precise IED timing within a window. The number of 30 replicas per 'Spike' window was determined through trial and error to optimize the performance. Then, we randomly removed 'Non-spike' windows to achieve a balanced training dataset. Second, we further augmented the dataset spatially by rotating magnetic topographical images four times at 90-degree intervals, so as to train our DL model independently of the precise IED dipole position and orientation. Last, we added sign-inverted data given the sign ambiguity of PCA [\u003cspan citationid=\"CR27\" class=\"CitationRef\"\u003e27\u003c/span\u003e]. The resulting training dataset size was 200 time samples \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e N\u003csub\u003eT\u003c/sub\u003e = 30000 windows for the temporal model and 60 \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e 60 pixels \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e N\u003csub\u003eS\u003c/sub\u003e = 75000 windows for the spatial model. The spatiotemporal model was trained on the same N\u003csub\u003eS\u003c/sub\u003e windows than the spatial one, leading to a dataset size of 200 \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e N\u003csub\u003eS\u003c/sub\u003e waveforms and 60 \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e 60 pixels \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\times\\:\\)\u003c/span\u003e\u003c/span\u003e N\u003csub\u003eS\u003c/sub\u003e images where some images were associated to the same waveform.\u003c/p\u003e \u003c/p\u003e \u003cp\u003eC. \u003cem\u003eModel architectures\u003c/em\u003e\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eThe architecture of our three DL models is illustrated in Figs.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003e\u0026ndash;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003e. All these models were implemented using the Tensorflow library [\u003cspan citationid=\"CR35\" class=\"CitationRef\"\u003e35\u003c/span\u003e] and run on a laptop equipped with an AMD Ryzen 7 5800H processor, 40 GB RAM memory and NVIDIA GeForce RTX 3060 graphic card. Of note, non-trainable hyperparameters were chosen by exploring the space generated by the combination of different number of CNN layers (1, 2, or 3), CNN filters (8, 16, 32, or 64), dense layers (1, 2, or 4), and dense-layer neurons (8, 16, 32, 64).\u003c/p\u003e \u003cp\u003e \u003cstrong\u003eTemporal model (1D-CNN)\u003c/strong\u003e \u003cp\u003eIn the temporal model, the gradiometric PC waveform of a window is passed through three successive blocks made of a 1D convolutional layer followed by dropout and maxpooling layers (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003e). The output was then flattened and fed to a two-layer decision block. Each convolutional layer has a different number of filters (16, 32, 64), a leaky rectified linear unit (ReLU) as activation function, and subsequent dropout layer (probability value 0.5) to prevent overfitting and maxpooling layer (pooling size 2) for downsampling. The decision block was composed of a dense layer with 16 neurons and ReLU activation functions, followed by a single neuron with sigmoid activation function providing a probability between 0 and 1 for a window to contain a spike. The final binary yes/no (\u0026lsquo;Spike\u0026rsquo;/\u0026rsquo;Non-spike\u0026rsquo;) decision was based on a non-trainable probability threshold set to 0.5.\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eSpatial model (2D-CNN)\u003c/strong\u003e \u003cp\u003eThe model design to analyze spatial features was the same as for the temporal model, except that the inputs consisted here in images of magnetometric PC field pattern, so all convolutional layers were 2D (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003e).\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eSpatiotemporal model (STIED)\u003c/strong\u003e \u003cp\u003eTo incorporate both temporal and spatial features in a genuinely spatiotemporal IED detection, we designed a model architecture that processes temporal and spatial inputs in parallel using the same 1D-CNN (Fig.\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003e) and 2D-CNN (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003e) up to the first dense layer of their decision block. The feature vectors from the outputs of the temporal and spatial dense layers were downsampled (0.5 dropout), combined using weighted concatenation with one trainable scalar weight for the temporal features (\u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{w}_{t}\\)\u003c/span\u003e\u003c/span\u003e) and one for the spatial features (\u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{w}_{s}=1-{w}_{t}\\)\u003c/span\u003e\u003c/span\u003e), and finally fed to the exact same decision block than the one used in the temporal model described above (Fig.\u0026nbsp;\u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003e).\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cem\u003eNormalized and maximum amplitude models\u003c/em\u003e: Since IEDs are primarily high-amplitude events, we sought to examine whether our STIED models are merely driven by the gross amplitude of IEDs or if they learn subtler features. To do so, we isolated the effect of amplitude from other features by considering both classifiers independent of amplitude and classifiers that depend solely on amplitude. For amplitude-independent IED detection, we applied the same 1D-CNN, 2D-CNN, and STIED architectures on input data after amplitude normalization (NormAmplitude models). Normalization consisted in window-by-window division of data by the maximum amplitude (i.e., maximum amplitude of gradiometric PC waveform within the window for temporal features, maximum amplitude of magnetometric PC topography for spatial features). The specific importance of amplitude in IED detection, independently of other morphological features, was assessed using a simple deep learning classification model based on a multilayer perceptron (MaxAmplitude models). The input data for this model consisted in the maximum amplitude used for data normalization in NormAmplitude models. The perceptron was trained to determine the probability that a given window contained a spike, thereby enabling binary classification (probability threshold 0.5) based solely on amplitude. As above, three versions of the MaxAmplitude models were considered: a temporal one (using the maximum amplitude of gradiometric PC waveform), a spatial one (using maximum amplitude of magnetometric PC topography), and a spatio-temporal one (incorporating both maximum amplitudes as inputs). Each perceptron consisted in one hidden layer of 8 neurons (temporal and spatial models) or two hidden layers of 16 neurons (spatiotemporal model) with ReLU activation function and followed by an output layer of a single neuron with sigmoid activation function to produce a probability-like output.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eD. \u003cem\u003eTraining and performance evaluation\u003c/em\u003e\u003c/p\u003e \u003cp\u003e \u003cstrong\u003eModel training\u003c/strong\u003e \u003cp\u003eModel training was performed using an Adam optimizer algorithm with a batch size of 128 windows, binary cross-entropy as loss function, and a reduced learning rate when loss stopped improving. As preliminary sanity check, we trained our STIED models by randomly extracting 80% of the entire dataset for training and using the remaining 20% for testing. We did not observe overfitting and determined that 150 epochs/training steps were enough to reach a learning plateau in all models. For model performance evaluation, given that our dataset was composed of 10 patients, we performed a 10-fold repeated LOOCV wherein all windows of 9 out of 10 subjects were used for training, and all windows of the remaining subject for testing. This allowed to evaluate model performance in a clinically oriented setup (i.e., generalizability to the inclusion of new patients with similar epilepsy) and inter-individual variability of performance metrics.\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003ePerformance metrics (FE group)\u003c/strong\u003e \u003cp\u003eFor each cross-validation iterate, we compared model window classification (yes/no) to the actual presence of VDS-IEDs (\u0026lsquo;Spikes\u0026rsquo;/\u0026lsquo;Non-Spike\u0026rsquo;) using accuracy, specificity, and sensitivity according to the standard expressions\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cdiv id=\"Equa\" class=\"Equation\"\u003e \u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equa\" name=\"EquationSource\"\u003e\n$$\\:accuracy=\\frac{TP+TN}{TP+TN+FP+FN}\\:\\cdot\\:\\:100\\%,\\:specificity=\\frac{TN}{TN+FP}\\:\\cdot\\:\\:100\\%,\\:\\text{a}\\text{n}\\text{d}\\:\\:sensitivity=\\frac{TP}{TP+FN}\\:\\cdot\\:\\:100\\%\\:.$$\u003c/div\u003e \u003c/div\u003e \u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eComparison with unsupervised IED detection algorithms (FE group)\u003c/strong\u003e \u003cp\u003ePrevious work developed automated IED detection algorithm based on unsupervised machine learning algorithms such as ICA and HMM [\u003cspan additionalcitationids=\"CR12 CR13 CR14 CR15 CR16\" citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e]\u0026ndash;[\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e]. We sought to assess the added-value of our supervised DL approach by comparing its performance metrics with similar metrics derived from both the ICA and the amplitude HMM of MEG signals described in[\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e] and tested on the same dataset of FE patients.\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eIED localization of predicted IEDs (RFE group)\u003c/strong\u003e \u003cp\u003eAs a final and more exploratory analysis, we examined the performance of our STIED model, trained in our FE group, on different patients with RFE. This provides a drastic test of model generalizability since this dataset differed in the type of epilepsy (RFE instead of FE), population (both children and adults instead of children only), and recording paradigm (sleep recordings instead of wakeful rest). This also allows to showcase a practical way to use STIED in new patients, and how to extract IED localization using further post-processing (since our deep learning classifiers only predict the presence or absence of IEDs within a window, without specifying its precise timing or localization). Specifically, the timing of each predicted IED was extracted as the highest-amplitude peak within the corresponding window (according to STIED). The brain source generator of each predicted IED was then localized as the global maximum of brain activity at the corresponding timing, imaged on patients' MRI using noise-standardized Minimum Norm Estimation (see [\u003cspan citationid=\"CR34\" class=\"CitationRef\"\u003e34\u003c/span\u003e] for implementation details). To give a sense of clustering of predicted IED location, we created an IED density map by binarizing each IED brain image (value 1 in a 5-mm voxel around the global maximum, zero elsewhere) and averaging them over all predictions in the patient so as to measure the fraction of IEDs predicted at this voxel (i.e., a voxel at 100% concentrates all predicted IEDs, whereas IEDs are spread over large areas in a map with low values). Although VDS-IEDs were not marked temporally as they were in the FE patients, we had access to the localization of VDS-IED brain sources reconstructed by a clinical magnetoencephalographer (X.D.T.) using ECD modeling, to which we compared our density map of STIED predictions. Of note, the lack of temporal annotations did not allow us to go beyond this qualitative comparison of localizations and evaluate quantitatively detection performance in RFE patients.\u003c/p\u003e \u003c/p\u003e"},{"header":"III. RESULTS","content":"\u003cp\u003eWe now report the detection performance of these supervised DL models and analyze the impact of using temporal, spatial, or spatiotemporal features. We also explore the validity of our data reduction, assess the relevance of IED amplitude and IED morphology in STIED and compare its performance to unsupervised detection algorithms (ICA and HMM). Then, we test the possible generalizability of STIED to another, unlabeled dataset of patients with RFE.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eA. \u003cem\u003eDetection performance of STIED in SeLECTS\u003c/em\u003e\u003c/p\u003e \u003cp\u003eThe performance metrics for the three DL model types (temporal 1D-CNN, spatial 2D-CNN, spatiotemporal STIED) are summarized in TABLE 2 for balanced and unbalanced test data.\u003c/p\u003e \u003cp\u003e \u003cstrong\u003eImpact of model type\u003c/strong\u003e \u003cp\u003eClassification accuracy and specificity were consistently large whatever the model type, both for balanced and unbalanced test data (accuracy\u0026thinsp;\u0026gt;\u0026thinsp;85%, specificity\u0026thinsp;\u0026gt;\u0026thinsp;93%; mean over 10 cross-validation iterates), with no significant effect of model type (p\u0026thinsp;\u0026gt;\u0026thinsp;0.12). So, all three DL models were equivalent in their ability to correctly predict VDS-IEDs. Sensitivity was on average larger for the temporal and spatiotemporal models (\u0026gt;\u0026thinsp;84%) than for the spatial model (75%), though this observation was not statistically significant due to large inter-subject variability in sensitivity (p\u0026thinsp;\u0026gt;\u0026thinsp;0.26). This suggests that temporal features of IED waveforms are most useful to avoid false detections. Despite the absence of statistical effects, combining spatiotemporal features maximized all three performance metrics in the realistic setup of unbalanced test data (TABLE 2), indicating a slight but possible superiority of the STIED model, on which we shall focus hereafter. Interestingly, the trained weights \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{w}_{t}\\)\u003c/span\u003e\u003c/span\u003e and \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{w}_{s}\\)\u003c/span\u003e\u003c/span\u003e were both close to 0.5, showing that while STIED did not perform significantly better than the temporal 1D-CNN model, it effectively used both temporal and spatial features in its decision process.\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eBalanced vs. unbalanced metrics\u003c/strong\u003e \u003cp\u003eThe observation of similar performance metrics from balanced and unbalanced test data (TABLE 2) further advocates for the robustness of our DL algorithms. Specifically, the identical sensitivities (combined with consistently large specificities) indicate that all three models identified the same IEDs regardless of the amount of data without VDS-IEDs. In other words, DL model performance did not depend on IED frequency of the test patient. This conclusion was further supported by the absence of correlations between performance metrics and number of VDS-IEDs (Spearman correlation, |r\u0026thinsp;\u0026lt;\u0026thinsp;0.09; p\u0026thinsp;\u0026gt;\u0026thinsp;0.36).\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eImpact of data reduction\u003c/strong\u003e \u003cp\u003eThe first PC used for data reduction explained significantly more data variance than the second PC of same windowed data (\u003cem\u003et\u003c/em\u003e test on window covariance eigenvalues, p\u0026thinsp;\u0026lt;\u0026thinsp;3e-6), but this does not preclude that the latter contains useful IED features. Figure\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003ea compares performance metrics (unbalanced test data) for our three DL models applied to the first vs. second PC. All metrics were significantly smaller when using the second PC in STIED (p\u0026thinsp;\u0026lt;\u0026thinsp;0.01), with a particularly strong drop in mean sensitivity of 52%. The drop in accuracy and sensitivity were similarly significant in the temporal and spatial models (p\u0026thinsp;\u0026lt;\u0026thinsp;0.05) but not in specificity (p\u0026thinsp;\u0026gt;\u0026thinsp;0.11). Thus, the second PC contains remnant, low-variance features of IEDs excluded by our data reduction procedure, though these features are less effective at IED detection and are poorly specific to IEDs.\u003c/p\u003e \u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003e \u003cstrong\u003eComparison with unsupervised classifications\u003c/strong\u003e \u003cp\u003eTABLE 3 compares performance metrics of STIED (unbalanced test data) to those of two unsupervised detection algorithms (ICA and HMM) developed in a previous work and tested on the same dataset [\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e]. All approaches showed similar sensitivities (p\u0026thinsp;=\u0026thinsp;0.67), but STIED was significantly more specific to IEDs than both supervised methods (\u0026lt;\u0026thinsp;55%; p\u0026thinsp;\u0026lt;\u0026thinsp;2e-9). This merely reflects the expected fact that the supervised DL algorithm learns from VDS-IEDs and thus follows closely the clinical magnetoencephalographer\u0026rsquo;s decision.\u003c/p\u003e \u003c/p\u003e \u003cp\u003eB. \u003cem\u003eGeneralizability of FE-group-trained STIED to RFE patients\u003c/em\u003e\u003c/p\u003e \u003cp\u003eAs a final step, we sought to evaluate the performance of our STIED model, trained in our FE group, on 12 patients with RFE. Perhaps unsurprisingly, results were mitigated with only 2 patients reproducing exactly the location of IED events, 9 patients in which additional non-epileptiform events were detected besides the accurate location of VDS-IEDs, and 1 patient in which a cluster of VDS-IEDs was missed altogether.\u003c/p\u003e \u003cp\u003eFigure \u003cspan refid=\"Fig6\" class=\"InternalRef\"\u003e6\u003c/span\u003e illustrates these results by comparing the density map of predicted IEDs (Fig.\u0026nbsp;\u003cspan refid=\"Fig6\" class=\"InternalRef\"\u003e6\u003c/span\u003e, left) and ECD localization of VDS-IEDs (Fig.\u0026nbsp;\u003cspan refid=\"Fig6\" class=\"InternalRef\"\u003e6\u003c/span\u003e, right) in three patients. Figure\u0026nbsp;\u003cspan refid=\"Fig6\" class=\"InternalRef\"\u003e6\u003c/span\u003ea is representative of the successful cases where STIED co-localizes IEDs with VDS-IEDs. Both approaches were consistent with multifocal independent irritative zones, with the most active being posterior to the left frontal lesion. Figure\u0026nbsp;\u003cspan refid=\"Fig6\" class=\"InternalRef\"\u003e6\u003c/span\u003eb illustrates a case of partial success. Clinical analysis reported few VDS-IEDs, which were accurately identified by the STIED model. Nonetheless, Rolandic spikes in the centrotemporal area and sleep-related events in the occipital areas were also wrongly predicted, likely indicative of physiological transients [\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e], [\u003cspan citationid=\"CR36\" class=\"CitationRef\"\u003e36\u003c/span\u003e]. Figure\u0026nbsp;\u003cspan refid=\"Fig6\" class=\"InternalRef\"\u003e6\u003c/span\u003ec illustrates a case of mitigated success. Clinical assessment revealed two active, independent irritative zones located at the left opercular/periinsular and ventral occipital regions, which might be part of a common epileptogenic network, but STIED missed the ventral occipital cluster of VDS-IEDs. We conclude that, while STIED trained on FE patients learned IED features that generalize to all patients with RFE, other types of epileptiform activities were not recognized (such as polymorphic waveform), while some forms of physiological activity were falsely detected.\u003c/p\u003e"},{"header":"IV. DISCUSSION","content":"\u003cp\u003eThe development of fully automated tools for the detection and localization of IEDs is a long-standing goal in the field of clinical epilepsy. Here, we introduced STIED, a simple yet effective DL solution for IED automatic detection in clinical MEG recordings. This is part of the global momentum that \u0026ldquo;artificial intelligence\u0026rdquo; bears in technology, not the least in medical fields\u0026mdash;including neuroscience [\u003cspan citationid=\"CR37\" class=\"CitationRef\"\u003e37\u003c/span\u003e], [\u003cspan citationid=\"CR38\" class=\"CitationRef\"\u003e38\u003c/span\u003e] and clinical epilepsy [\u003cspan citationid=\"CR39\" class=\"CitationRef\"\u003e39\u003c/span\u003e]. In fact, STIED is not the first attempt in applying supervised DL to the evaluation of epilepsy with MEG ([\u003cspan additionalcitationids=\"CR19 CR20\" citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e]\u0026ndash;[\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e]). Here, we aimed to design a computationally reasonable architecture that encodes both temporal and spatial features in a way analogous to how clinical magnetoencephalographers analyze their clinical MEG recordings [\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e]. This allowed us to train our STIED model with high sensitivity and specificity, despite a relatively small training dataset, at least in the context of our FE group. We focused here on patients with FE, mainly SeLECTS, because their high IED amplitude and frequency yielded a relatively large count of IED events in a limited duration of MEG signals, which admittedly may have contributed to the efficient training of STIED at small dataset size. Interestingly, our results suggest that, after training, detection performance does not depend closely on IED frequency and thus could generalize to epileptic patients with scarcer interictal events. This contrasts with previous recent studies [\u003cspan additionalcitationids=\"CR19\" citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e]\u0026ndash;[\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e] proposing DL-based IED detection, which showed a substantial drop in sensitivity to less than 50% when assessed with unbalanced compared to balanced test data [\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e]. While authors overcame this issue \u003cem\u003ead-hoc\u003c/em\u003e by adjusting the probability threshold at the end of their decision blocks (using a thresholding moving strategy to enhance performance [\u003cspan additionalcitationids=\"CR19\" citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e]\u0026ndash;[\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e]), one advantage of our DL models is that they showed high sensitivity without such adjustment. Still, the generalizability of our current version of STIED to other types of epilepsy such as RFE was partial, presumably because it does not capture sufficiently the variety of IED field patterns and waveform morphologies (which may be different in deep medial temporal epilepsy [\u003cspan citationid=\"CR40\" class=\"CitationRef\"\u003e40\u003c/span\u003e] or change as the type of epilepsy evolves with age [\u003cspan citationid=\"CR41\" class=\"CitationRef\"\u003e41\u003c/span\u003e]). This being said, this paper provides proof of concept for the effectiveness of the STIED model architecture. Future updates of STIED with a larger and more diverse training dataset are necessary to fully validate this DL solution and to widen its range of applicability. STIED could also be an efficient and fast approach to assess the spike-wave index (i.e., fraction of recording time showing spike-and-wave activity [\u003cspan citationid=\"CR42\" class=\"CitationRef\"\u003e42\u003c/span\u003e]), a key diagnostic element for some pediatric epileptic conditions (reaching up to 85% in our training dataset [\u003cspan citationid=\"CR43\" class=\"CitationRef\"\u003e43\u003c/span\u003e]).\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eThe STIED architecture is the result of several trials not reported here. Regarding artificial neural network design, we quickly settled for a quite classical setup that combines 1D-CNN as done in previous works to analyze temporal signals [\u003cspan citationid=\"CR44\" class=\"CitationRef\"\u003e44\u003c/span\u003e], 2D-CNN typical of spatial image processing [\u003cspan citationid=\"CR45\" class=\"CitationRef\"\u003e45\u003c/span\u003e], and dense layers with sigmoid final neuron for classification. The number and size of layers were varied to maximize performance while minimizing complexity. In this endeavor, the identification of CNN inputs with relevant low-dimensional features amongst high-dimensional MEG data, proved key. We did so using a data reduction based on PCA that loosely follows what is done during clinical MEG visual analysis, i.e., extract IED waveform signals from gradiometers and images of IED dipolar patterns from magnetometers. This likely explains why STIED could learn from, and closely agree with, clinical magnetoencephalographers. One possible caveat of this procedure is that PCA can be dominated by large-amplitude transients such as electronic noise or physiological artefacts (e.g., ocular and cardiac magnetic fields) in time windows where they occur. This would likely be detrimental to STIED detection performance, at least for IED events simultaneous to noise artefacts. However, this possible issue was mitigated here altogether by MEG signal denoising prior to model training and testing. Another caveat of this data reduction was the exclusion of MEG features specific of, though poorly sensitive to, IEDs. Critically, it might also miss deep epileptiform activity, which would be subdominant in MEG recordings [\u003cspan citationid=\"CR32\" class=\"CitationRef\"\u003e32\u003c/span\u003e]. This limitation could be alleviated in future updates of STIED that would allow inputting multiple PCs, though at the moment the right number to use remains unclear. On the other hand, this strong data reduction allowed to train and run the model on affordable hardware, with high performance despite reasonable training times (about 4 hours for 10 subjects with 5-min MEG recordings) and small processing time of new data (less than 30 seconds for 1 hour MEG recording). This means that STIED can detect IEDs similarly to clinical magnetoencephalographers, about 300 time faster\u0026mdash;again at least within our FE group.\u003c/p\u003e \u003cp\u003eBeyond sheer performance, we sought to partially reverse engineer the STIED model and investigate what features of MEG signals drive IED detection. Generally speaking, reaching a full interpretation of model decisions remains a difficult and fundamental issue in the field of DL. The scope of our interpretability analysis here was relatively restricted and focused specifically on the impact of amplitude and input data type (temporal, spatial, or spatiotemporal). A surprising finding is that the amplitude of IED waveforms\u0026mdash;at first sight a primary gross characteristic of epileptiform activity\u0026mdash;was not critical in the STIED decision process. In fact, IED amplitude alone was poorly specific of visually identified epileptiform activity. Interestingly, a similarly low specificity was found in unsupervised algorithms based on ICA and HMM, for which arguments were given for the hypothesis that false positive events actually correspond to genuine but small-amplitude IEDs unidentified by clinical MEG evaluation [\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e]. This illustrates a possible advantage of unsupervised models. On the other hand, STIED yielded a fully automated decision, whereas both ICA and HMM were semi-automated. Further, whether such small-amplitude events, unidentified by STIED too, represent IEDs or clinically irrelevant physiological events, remains to be fully clarified. In the current state of knowledge, a conservative approach may be warranted for clinical applications so STIED likely represents the best data-driven approach so far. In the future, it will be interesting to compare the outcome of STIED and unsupervised algorithms in other types of IED recordings, such as the ICA of MEG based on optically pumped magnetometers [\u003cspan citationid=\"CR46\" class=\"CitationRef\"\u003e46\u003c/span\u003e] or the HMM of stereo-electroencephalography data [\u003cspan citationid=\"CR47\" class=\"CitationRef\"\u003e47\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eOur reverse engineering analysis also revealed that, while STIED does rely on both its spatial and temporal inputs (as we intended), the spatial features of IED magnetic topography bring at most a subtle added value to detection performance, compared with the temporal morphology of IEDs. In hindsight, this is likely because IED spiking waveforms are automatically accompanied with dipolar magnetic field patterns, so the latter do not add independent information to the former. Indeed, epileptiform spikes originate from bursts of hyperexcitable neurons within focal neural populations. In neocortical epilepsies (as was the case in our training group), focal excitation leads to post-synaptic current flows along apical dendrites of pyramidal neurons that are necessarily dipolar [\u003cspan citationid=\"CR48\" class=\"CitationRef\"\u003e48\u003c/span\u003e]. More generally, all sharp electrophysiological events\u0026mdash;not only IEDs but also physiological transients typically occurring in Rolandic, supramarginal, and occipital areas[\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e], [\u003cspan citationid=\"CR36\" class=\"CitationRef\"\u003e36\u003c/span\u003e] as well as transient oscillatory bursts emerging in brain functional networks [\u003cspan additionalcitationids=\"CR50\" citationid=\"CR49\" class=\"CitationRef\"\u003e49\u003c/span\u003e]\u0026ndash;[\u003cspan citationid=\"CR51\" class=\"CitationRef\"\u003e51\u003c/span\u003e]\u0026mdash;are focal and thus dipolar. Spatial features thus hardly distinguish sharp physiological events from IEDs, which presumably explains the poorer performance of the spatial DL model. Another, more technical implication is that data augmentation by rotation of topographical patterns should not be overdone. While we initially reasoned (following standard image recognition processing) that such rotations would improve model generalizability across patients by allowing more diverse IED localizations, during our trial phase we found that coarse 90-degree rotations used here worked better than finer rotations (e.g., at 12 degrees, the sensitivity of the spatial DL model tended to increase slightly, but specificity dropped significantly, p\u0026thinsp;\u0026lt;\u0026thinsp;0.03). Associating IEDs with too many dipolar patterns presumably renders DL models oversensitive to sharp physiological events. This aspect will require further consideration when updating STIED with a larger training dataset. On the other hand, including spatial features might help against false detections of spike-like artefacts that may arise in MEG signals with atypical dipolar patterns.\u003c/p\u003e \u003cp\u003eThe problem of physiological confounds was somewhat alleviated by the inclusion of temporal features, yet physiological transients with spiking waveform morphology remain a critical challenge to overcome [\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e], [\u003cspan citationid=\"CR36\" class=\"CitationRef\"\u003e36\u003c/span\u003e] as they are detrimental to detection specificity. This was illustrated by the high rate of false detections, together with the accurate location of VDS-IEDs, when applying our current version of STIED to sleep recordings of 9 out 12 patients with RFE. Some physiological transients typically emerge during drowsiness and sleep [\u003cspan citationid=\"CR28\" class=\"CitationRef\"\u003e28\u003c/span\u003e], so a critical next step might be to include sleep recordings of healthy controls to help STIED learn to distinguish them from epileptiform activity.\u003c/p\u003e"},{"header":"V.\tCONCLUSION","content":"\u003cp\u003eIn sum, we provided proof of concept that STIED is a promising DL solution for the automated detection of IEDs in focal epilepsy, though further validation is necessary before envisaging deployment in clinical routine. In future work, we intend to update the current version with a large-scale training dataset of labelled MEG recordings in patients with different types of epilepsies, including sleep recordings to discriminate physiological spikes. If expected improvements in model generalizability and detection specificity are confirmed, this would establish STIED as an invaluable tool to assist clinical magnetoencephalographers in getting a fast and accurate clinical evaluation of epilepsy from MEG recordings.\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003eData availability\u003c/p\u003e\n\u003cp\u003eThe datasets generated and/or analysed during the current study are not publicly available but are available from the corresponding author on reasonable request. Data and codes will be made available on request after approval by institutional authorities (Hôpital Universitaire de Bruxelles and Université Libre de Bruxelles).\u003c/p\u003e\n\u003cp\u003eAcknowledgments\u003c/p\u003e\n\u003cp\u003eThis work was supported by the Fonds Erasme (Brussels, Belgium; Research Convention: \u0026laquo; Les Voies du Savoir\u0026raquo;). Odile Feys is supported by the Fonds pour la Formation à la Recherche dans l\u0026rsquo;Industrie et l\u0026rsquo;Agriculture (FRIA, Fonds de la Recherche Scientifique (FRS-FNRS), Brussels, Belgium).\u0026nbsp;Xavier De Ti\u0026egrave;ge is Clinical Researcher at the FRS-FNRS (Brussels, Belgium). The MEG project at the H\u0026ocirc;pital Universitaire de Bruxelles is financially supported by the Fonds Erasme.\u003c/p\u003e\n\u003cp\u003eAuthor contribution\u003c/p\u003e\n\u003cp\u003eRaquel Fern\u0026aacute;ndez-Mart\u0026iacute;n\u0026nbsp;(R.F.M.) and Alfonso Gij\u0026oacute;n (A.G.) contributed to the conceptualization, methodology, design and implementation of the algorithm, software, formal analysis, investigation, validation, visualization and writing (original draft, review and editing); Odile Feys (O.F.) contributed to data acquisition, clinical data analysis (localization of IEDs) and writing (review); Elodie Juven\u0026eacute; (E.J.) contributed to data acquisition and writing (review); Alec Aeby (A.A.) contributed to writing (review) and resources; Charline Urbain (C.U.) contributed to writing (review) and resources; Xavier De Ti\u0026egrave;ge (X.D.T.) contributed to conceptualization, data acquisition and clinical data analysis (localization of IEDs), supervision, writing (review), resources and funding; Vincent Wens (V.W.) contributed to conceptualization, methodology, investigation, validation, supervision and writing (original draft, review and editing).\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eCompeting interests\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe authors declare no competing interests.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConsent for publication\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eAll authors have read the manuscript and consent to publish.\u003c/p\u003e\n\u003cp\u003eAdditional information\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eCorrespondence\u003c/strong\u003e and requests for materials should be addressed to R.F.M. and A.G.\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\u003cli\u003e\u003cspan\u003eFisher, R. S. et al. ILAE Official Report: A practical clinical definition of epilepsy. \u003cem\u003eEpilepsia\u003c/em\u003e \u003cb\u003e55\u003c/b\u003e (4), 475\u0026ndash;482 (2014).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003ePicot, M. C., Baldy-Moulinier, M., Daur\u0026egrave;s, J. P., Dujols, P. \u0026amp; Crespel, A. The prevalence of epilepsy and pharmacoresistant epilepsy in adults: A population-based study in a Western European country, \u003cem\u003eEpilepsia\u003c/em\u003e, vol. 49, no. 7, pp. 1230\u0026ndash;1238, Jul. (2008).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKirsch, H. E., Robinson, S. E., Mantle, M. \u0026amp; Nagarajan, S. Automated localization of magnetoencephalographic interictal spikes by adaptive spatial filtering, \u003cem\u003eClinical Neurophysiology\u003c/em\u003e, vol. 117, no. 10, pp. 2264\u0026ndash;2271, Oct. (2006).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKural, M. A. et al. Criteria for defining interictal epileptiform discharges in EEG: A clinical validation study. \u003cem\u003eNeurology\u003c/em\u003e \u003cb\u003e94\u003c/b\u003e (20), e2139\u0026ndash;e2147 (May 2020).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003ePanigrahi, M. \u0026amp; Jayalakshmi, S. Presurgical evaluation of epilepsy, \u003cem\u003eJ Pediatr Neurosci\u003c/em\u003e, vol. 3, no. 1 SUPPL., pp. 74\u0026ndash;81, (2008).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFeys, O., De, X. \u0026amp; Ti\u0026egrave;ge From cryogenic to on-scalp magnetoencephalography for the evaluation of paediatric epilepsy, \u003cem\u003eDev Med Child Neurol\u003c/em\u003e, Jul. (2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBagic, A. I., Knowlton, R. C., Rose, D. F. \u0026amp; Ebersole, J. S. \u003cem\u003eAmerican Clinical Magnetoencephalography Society Clinical Practice Guideline 1\u003c/em\u003e (Recording and Analysis of Spontaneous Cerebral Activity*, 2011).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eEbersole, J. S. Magnetoencephalography/Magnetic Source Imaging in the Assessment of Patients with Epilepsy, (1997).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDe Ti\u0026egrave;ge, X., Lundqvist, D., Beniczky, S., Seri, S. \u0026amp; Paetau, R. Current clinical magnetoencephalography practice across Europe: Are we closer to use MEG as an established clinical tool? \u003cem\u003eSeizure\u003c/em\u003e \u003cb\u003e50\u003c/b\u003e, 53\u0026ndash;59 (Aug. 2017).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLaohathai, C. et al. Practical Fundamentals of Clinical MEG Interpretation in Epilepsy. \u003cem\u003eFront. Neurol.\u003c/em\u003e, \u003cb\u003e12\u003c/b\u003e. Frontiers Media S.A., 14-Oct-2021.\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMalinowska, U. et al. Interictal networks in Magnetoencephalography. \u003cem\u003eHum. Brain Mapp.\u003c/em\u003e \u003cb\u003e35\u003c/b\u003e (6), 2789\u0026ndash;2805 (2014).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003ePizzo, F. et al. Deep brain activities can be detected with magnetoencephalography, \u003cem\u003eNat Commun\u003c/em\u003e, vol. 10, no. 1, Dec. (2019).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eOssadtchi, A. et al. Automated interictal spike detection and source localization in magnetoencephalography using independent components analysis and spatio-temporal clustering. \u003cem\u003eClin. Neurophysiol.\u003c/em\u003e \u003cb\u003e115\u003c/b\u003e (3), 508\u0026ndash;522 (2004).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eOssadtchi, A., Mosher, J. C., Sutherling, W. W., Greenblatt, R. E. \u0026amp; Leahy, R. M. Hidden Markov modelling of spike propagation from interictal MEG data, \u003cem\u003ePhys Med Biol\u003c/em\u003e, vol. 50, no. 14, pp. 3447\u0026ndash;3469, Jul. (2005).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eSeedat, Z. A. et al. Mapping Interictal activity in epilepsy using a hidden Markov model: A magnetoencephalography study. \u003cem\u003eHum. Brain Mapp.\u003c/em\u003e, (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eYe, S., Bagić, A. \u0026amp; He, B. Disentanglement of Resting State Brain Networks for Localizing Epileptogenic Zone in Focal Epilepsy, \u003cem\u003epreprint\u003c/em\u003e, (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFern\u0026aacute;ndez-Mart\u0026iacute;n, R. et al. Towards the automated detection of interictal epileptiform discharges with magnetoencephalography, \u003cem\u003eJ Neurosci Methods\u003c/em\u003e, vol. 403, Mar. (2024).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eZheng, L. et al. EMS-Net: A Deep Learning Method for Autodetecting Epileptic Magnetoencephalography Spikes, \u003cem\u003eIEEE Trans Med Imaging\u003c/em\u003e, vol. 39, no. 6, pp. 1833\u0026ndash;1844, Jun. (2020).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHirano, R. et al. Fully-Automated Spike Detection and Dipole Analysis of Epileptic MEG Using Deep Learning, \u003cem\u003eIEEE Trans Med Imaging\u003c/em\u003e, vol. 41, no. 10, pp. 2879\u0026ndash;2890, Oct. (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMouches, P. et al. Time CNN and Graph Convolution Network for Epileptic Spike Detection in MEG Data. \u003cem\u003eOct\u003c/em\u003e (2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eZheng, L. et al. An artificial intelligence\u0026ndash;based pipeline for automated detection and localisation of epileptic sources from magnetoencephalography. \u003cem\u003eJ. Neural Eng.\u003c/em\u003e \u003cb\u003e20\u003c/b\u003e (4), 046036 (Aug. 2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFeys, O. et al. Diagnostic and therapeutic approaches in refractory insular epilepsy, \u003cem\u003eEpilepsia\u003c/em\u003e, Jun. (2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBickel, P. et al. Springer Series in Statistics.\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDe Ti\u0026egrave;ge, X. et al. Clinical added value of magnetic source imaging in the presurgical evaluation of refractory focal epilepsy. \u003cem\u003eJ. Neurol. Neurosurg. Psychiatry\u003c/em\u003e. \u003cb\u003e83\u003c/b\u003e (4), 417\u0026ndash;423 (2012).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDe Ti\u0026egrave;ge, X. et al. Recording epileptic activity with MEG in a light-weight magnetic shield, \u003cem\u003eEpilepsy Res\u003c/em\u003e, vol. 82, no. 2\u0026ndash;3, pp. 227\u0026ndash;231, Dec. (2008).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eTaulu, S., Simola, J. \u0026amp; Kajola, M. Applications of the signal space separation method, \u003cem\u003eIEEE Transactions on Signal Processing\u003c/em\u003e, vol. 53, no. 9, pp. 3359\u0026ndash;3372, Sep. (2005).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHyv\u0026auml;rinen, A., Karhunen, J. \u0026amp; Oja, E. Independent Component Analysis, (2001).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eVig\u0026aacute;rio, R. N. Independent component approach to the analysis of EEG and MEG signals. \u003cem\u003eActa Polytech. Scand.\u003c/em\u003e \u003cb\u003e47\u003c/b\u003e (101), 589\u0026ndash;593 (1999). Mathematics and Computing Series.\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKhalid, M. I. et al. Epileptic MEG Spikes Detection Using Amplitude Thresholding and Dynamic Time Warping. \u003cem\u003eIEEE Access.\u003c/em\u003e \u003cb\u003e5\u003c/b\u003e, 11658\u0026ndash;11667 (2017).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eOostenveld, R., Fries, P., Maris, E. \u0026amp; Schoffelen, J. M. FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data, \u003cem\u003eComput Intell Neurosci\u003c/em\u003e, vol. 2011. (2011).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHari, R. \u0026amp; Puce, A. \u003cem\u003eMEG - EEG Primer\u003c/em\u003e. (2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eEnatsu, R. et al. Usefulness of MEG magnetometer for spike detection in patients with mesial temporal epileptic focus, \u003cem\u003eNeuroimage\u003c/em\u003e, vol. 41, no. 4, pp. 1206\u0026ndash;1219, Jul. (2008).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eWens, V. Exploring the limits of MEG spatial resolution with multipolar expansions, \u003cem\u003eNeuroimage\u003c/em\u003e, vol. 270, Apr. (2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eWens, V. et al. A geometric correction scheme for spatial leakage effects in MEG/EEG seed-based functional connectivity mapping, \u003cem\u003eHum Brain Mapp\u003c/em\u003e, vol. 36, no. 11, pp. 4604\u0026ndash;4621, Nov. (2015).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eAbadi, M. et al. TensorFlow: (2015). Large-Scale Machine Learning on Heterogeneous Systems.\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eRampp, S. et al. Normal Variants in Magnetoencephalography, \u003cem\u003eJournal of Clinical Neurophysiology\u003c/em\u003e, vol. 37, no. 6. Lippincott Williams and Wilkins, pp. 518\u0026ndash;536, 01-Nov-2020.\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBadrulhisham, F., Pogatzki-Zahn, E., Segelcke, D., Spisak, T. \u0026amp; Vollert, J. Machine learning and artificial intelligence in neuroscience: A primer for researchers, \u003cem\u003eBrain Behav Immun\u003c/em\u003e, vol. 115, pp. 470\u0026ndash;479, Jan. (2024).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMarblestone, A. H., Wayne, G. \u0026amp; Kording, K. P. Toward an integration of deep learning and neuroscience, \u003cem\u003eFront Comput Neurosci\u003c/em\u003e, vol. 10, no. SEP, Sep. (2016).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLucas, A., Revell, A. \u0026amp; Davis, K. A. Artificial intelligence in epilepsy \u0026mdash; applications and pathways to the clinic. \u003cem\u003eNat. Rev. Neurol.\u003c/em\u003e \u003cb\u003e20\u003c/b\u003e (6), 319\u0026ndash;336 (2024).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFeys, O. et al. On-Scalp Magnetoencephalography Based On Optically Pumped Magnetometers Can Detect Mesial Temporal Lobe Epileptiform Discharges, \u003cem\u003eAnn Neurol\u003c/em\u003e, vol. 95, no. 3, pp. 620\u0026ndash;622, Mar. (2024).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFeys, O. et al. On-scalp magnetoencephalography for the diagnostic evaluation of epilepsy during infancy, \u003cem\u003eClinical Neurophysiology\u003c/em\u003e, vol. 155. Elsevier Ireland Ltd, pp. 29\u0026ndash;31, 01-Nov-2023.\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eAeby, A. et al. A qualitative awake EEG score for the diagnosis of continuous spike and waves during sleep (CSWS) syndrome in self-limited focal epilepsy (SFE): A case-control study. \u003cem\u003eSeizure\u003c/em\u003e \u003cb\u003e84\u003c/b\u003e, 34\u0026ndash;39 (Jan. 2021).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFeys, O. et al. May, and X. De Ti\u0026egrave;ge, On-Scalp Optically Pumped Magnetometers versus Cryogenic Magnetoencephalography for Diagnostic Evaluation of Epilepsy in School-aged Children. \u003cem\u003eRadiology\u003c/em\u003e, (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKiranyaz, S. et al. 1D convolutional neural networks and applications: A survey, \u003cem\u003eMech Syst Signal Process\u003c/em\u003e, vol. 151, Apr. (2021).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLi, Z., Liu, F., Yang, W., Peng, S. \u0026amp; Zhou, J. A Survey of Convolutional Neural Networks: Analysis, Applications, and Prospects. \u003cem\u003eIEEE Trans. Neural Netw. Learn. Syst.\u003c/em\u003e \u003cb\u003e33\u003c/b\u003e (12), 6999\u0026ndash;7019 (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFeys, O. et al. and X. De Ti\u0026egrave;ge, Tri-axial rubidium and helium optically pumped magnetometers for on-scalp magnetoencephalography recording of interictal epileptiform discharges: a case study, \u003cem\u003eFront Neurosci\u003c/em\u003e, vol. 17, (2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFeys, O. et al. Delayed effective connectivity characterizes the epileptogenic zone during stereo-EEG. \u003cem\u003eClin. Neurophysiol.\u003c/em\u003e \u003cb\u003e158\u003c/b\u003e, 59\u0026ndash;68 (Feb. 2024).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHamalainen, M., Hari, R., Ilmoniemi, R. J., Knuutila, J. \u0026amp; Lounasmaa, O. V. Magnetoencephalography theory, instrumentation, and applications to noninvasive studies of the working human brain, (1993).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHari, R. \u0026amp; Salmelin, R. Human cortical oscillations: a neuromagnetic view through the skull. \u003cem\u003eTrends Neurosci.\u003c/em\u003e, (1997).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003evan Ede, F., Quinn, A. J., Woolrich, M. W. \u0026amp; Nobre, A. C. Neural Oscillations: Sustained Rhythms or Transient Burst-Events? \u003cem\u003eTrends in Neurosciences\u003c/em\u003e, vol. 41, no. 7. Elsevier Ltd, pp. 415\u0026ndash;417, 01-Jul-2018.\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eCoquelet, N. et al. Microstates and power envelope hidden Markov modeling probe bursting brain activity at different timescales, \u003cem\u003eNeuroimage\u003c/em\u003e, vol. 247, Feb. (2022).\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":false,"highlight":"","institution":"","isAcceptedByJournal":true,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"scientific-reports","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"scirep","sideBox":"Learn more about [Scientific Reports](http://www.nature.com/srep/)","snPcode":"","submissionUrl":"","title":"Scientific Reports","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"stoa","reportingPortfolio":"Scientific Reports","inReviewEnabled":true,"inReviewRevisionsEnabled":true},"keywords":"Automatic interictal epileptiform discharges detection, Convolutional Neural Networks, Deep Learning, Epilepsy, Magnetoencephalography.","lastPublishedDoi":"10.21203/rs.3.rs-5974529/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-5974529/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eMagnetoencephalography (MEG) allows the non-invasive detection of interictal epileptiform discharges (IEDs). Clinical MEG analysis in epileptic patients traditionally relies on the visual identification of IEDs, which is time consuming and partially subjective. Automatic, data-driven detection methods exist but show limited performance. Still, the rise of deep learning (DL)\u0026mdash;with its ability to reproduce human-like abilities\u0026mdash;could revolutionize clinical MEG practice. Here, we developed and validated STIED, a simple yet powerful supervised DL algorithm combining two convolutional neural networks with temporal (1D time-course) and spatial (2D topography) features of MEG signals inspired from current clinical guidelines. Our DL model enabled a successful identification of IEDs in patients suffering from focal epilepsy with frequent and high amplitude spikes (FE group), with high-performance metrics\u0026mdash;accuracy, specificity, and sensitivity all exceeding 85%\u0026mdash;when learning from spatiotemporal features of IEDs. This performance can be attributed to our handling of input data, which mimics established clinical MEG practice. Reverse engineering further revealed that STIED encodes fine spatiotemporal features of IEDs rather than their mere amplitude. The model trained on the FE group also showed promising results when applied to a separate group of presurgical patients with different types of refractory focal epilepsy, though further work is needed to distinguish IEDs from physiological transients. This proof-of-concept study represents a first step towards the use of STIED and DL algorithms in the routine clinical MEG evaluation of epilepsy.\u003c/p\u003e","manuscriptTitle":"STIED: A deep learning model for the SpatioTemporal detection of focal Interictal Epileptiform Discharges with MEG","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-05-06 12:36:50","doi":"10.21203/rs.3.rs-5974529/v1","editorialEvents":[{"type":"communityComments","content":0},{"type":"decision","content":"Accepted","date":"2025-05-22T18:09:08+00:00","index":"","fulltext":""},{"type":"editorInvitedReview","content":"","date":"2025-05-07T18:33:07+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"52734313200735721782093227724750270133","date":"2025-04-28T17:43:27+00:00","index":"hide","fulltext":""},{"type":"reviewersInvited","content":"","date":"2025-04-28T17:36:38+00:00","index":"","fulltext":""},{"type":"checksComplete","content":"","date":"2025-04-18T08:19:45+00:00","index":"","fulltext":""},{"type":"submitted","content":"Scientific Reports","date":"2025-04-04T17:45:59+00:00","index":"","fulltext":""}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"scientific-reports","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"scirep","sideBox":"Learn more about [Scientific Reports](http://www.nature.com/srep/)","snPcode":"","submissionUrl":"","title":"Scientific Reports","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"stoa","reportingPortfolio":"Scientific Reports","inReviewEnabled":true,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"478d7a26-9ce8-4212-b9c0-c9ab0f699ea8","owner":[],"postedDate":"May 6th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"published-in-journal","subjectAreas":[{"id":47809375,"name":"Health sciences/Neurology/Neurological disorders/Epilepsy"},{"id":47809376,"name":"Biological sciences/Neuroscience/Computational neuroscience/Learning algorithms"},{"id":47809377,"name":"Biological sciences/Neuroscience/Computational neuroscience/Network models"},{"id":47809378,"name":"Health sciences/Diseases/Neurological disorders/Epilepsy"}],"tags":[],"updatedAt":"2025-07-07T16:14:53+00:00","versionOfRecord":{"articleIdentity":"rs-5974529","link":"https://doi.org/10.1038/s41598-025-03880-1","journal":{"identity":"scientific-reports","isVorOnly":false,"title":"Scientific Reports"},"publishedOn":"2025-07-01 15:57:41","publishedOnDateReadable":"July 1st, 2025"},"versionCreatedAt":"2025-05-06 12:36:50","video":"","vorDoi":"10.1038/s41598-025-03880-1","vorDoiUrl":"https://doi.org/10.1038/s41598-025-03880-1","workflowStages":[]},"version":"v1","identity":"rs-5974529","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-5974529","identity":"rs-5974529","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.