Structural Eigenmodes of the Brain to Improve the Source Localization of EEG: Application to Epileptiform Activity.
The 14 matches
- [1] § Results › Structural Eigenmodes Enable Source Localization of Seizure Spread › Testing, Validation, and Comparison to Other Approaches › Comparison Between Structural Eigenmode Approaches ↔ STC_Analysis.ipynb, lines 501 to 531 · score 0.70 · region localization error, squared error, variance explained, cosine score, correlated, SNR · Report a mismatch
- [2] § Methods › Simulated Evaluation Data › Mapping to Sensor Space with MNE Python ↔ gem_fns.py, lines 561 to 619 · score 0.66 · sensor space, inverse problem, efficiency, oriented, source space, cortex · Report a mismatch
- [3] § Results › Structural Eigenmodes Enable Source Localization of Seizure Spread › Performance Against Number of Modes — The Over‐ Versus Under‐Parameterized Regimes ↔ STC_Analysis.ipynb, lines 143 to 245 · score 0.63 · region localization error, EEG noise, EEG power, cosine score, SNR, metrics · Report a mismatch
- [4] § Methods › Source Localization ↔ gem_fns.py, lines 473 to 559 · score 0.62 · Small singular, EEG modes, component, SVD, rcond, truncate · Report a mismatch
- [5] § Methods › Evaluation › Simulation Test Conditions ↔ sample_sesl_pipeline.ipynb, lines 134 to 150 · score 0.62 · dSPM, eLORETA, sLORETA, MNE · Report a mismatch
- [6] § Results › Structural Eigenmodes Enable Source Localization of Seizure Spread › Testing, Validation, and Comparison to Other Approaches › Performance of Established Methods ↔ sample_sesl_pipeline.ipynb, lines 134 to 150 · score 0.60 · dSPM, eLORETA, sLORETA, loose, MNE, noise · Report a mismatch
- [7] § Results › Structural Eigenmodes Enable Source Localization of Seizure Spread › Testing, Validation, and Comparison to Other Approaches › Performance of Established Methods ↔ STC_Analysis.ipynb, lines 501 to 531 · score 0.58 · sLORETA, variance explained, cosine score, loose, MNE, metrics · Report a mismatch
- [8] § Methods › Structural Brain Data ↔ dynsim_fns.py, lines 101 to 196 · score 0.56 · streamline length, connectivity matrix, Spherical, parcellation, threshold · Report a mismatch
- [9] § Methods › Simulated Evaluation Data › Epileptor Equations ↔ dynsim_fns.py, lines 436 to 507 · score 0.55 · state variables, Epileptor model, spike, TVB, seizures · Report a mismatch
- [10] § Methods › Evaluation › Simulation Test Conditions ↔ STC_Analysis.ipynb, lines 28 to 88 · score 0.55 · inverse solutions, forward model, HCP, fsaverage, signal, EEG · Report a mismatch
- [11] § Methods › Evaluation › Simulation Metrics › Region Localization Error ↔ STC_Analysis.ipynb, lines 143 to 245 · score 0.54 · Region localization error, EEG power, Otsu, MNE, Threshold · Report a mismatch
- [12] § Methods › Eigenmode Creation › Connectome Eigenmodes ↔ STC_Analysis.ipynb, lines 306 to 384 · score 0.54 · subcortical regions, Connectome eigenmodes, geometric eigenmodes, discrete, eigenvalue · Report a mismatch
- [13] § Methods › Structural Brain Data ↔ dynsim_fns.py, lines 267 to 325 · score 0.53 · subcortical structures, cortical region, atlas, parcellation, vertex · Report a mismatch
- [14] § Methods › Source Localization ↔ gem_fns.py, lines 473 to 559 · score 0.51 · EEG modes, singular, vector, SVD, operator, squares · Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 720 lines · 33 KB · BSD-3-Clause · 6 matches
- # %% [markdown]
- # # Paper STC Analysis Notebook
- #
- # This notebook provides an example of how the functions in `sesl` (structural eigenmode source localisation) can be used to perform source localisation on a simulated dataset.
- # It runs on one example simulation, uses fsaverage, and demonstrates how the figures in the original paper can be generated (if run on all simulations and with all the different input files).
- # Remember to put the 1000 region parcellation labels into the appropriate folder in your Freesurfer fsaverage directory.
- # The aim for this notebook is for reproducibility of the analysis in the paper, so if you are interested in running `sesl` on your own data, please refer to the other notebook.
- # %%
- import numpy as np
- import matplotlib.pyplot as plt
- from pathlib import Path
- from IPython.display import clear_output
- import mne
- from mne.minimum_norm import make_inverse_operator, apply_inverse
- from skimage.filters import threshold_otsu
- from useful_fns import *
- from gem_fns import *
- from dynsim_fns import *
- from plot_fns import plot_mean_and_range, plot_tria_mesh
- %load_ext autoreload
- %autoreload 2
- # %%
- ANALYSIS_TYPE = 'GEM_discrete' # 'GEM_discrete' or 'GEM_surface' or 'CEM_discrete' or 'SEM_discrete'
- SNR = None # Signal to noise ratio for the simulation and MN inverse solutions - None for no noise
- if SNR is not None:
- RCOND = 1/(10**(SNR/10))
- else:
- RCOND = None
- ELECTRODE_CONFIG = '1010'
- if ELECTRODE_CONFIG == '1020':
- ONLY_20ELECTRODES = True # Whether to only use the 20 electrodes in the 10-20 system
- MONTAGE = 'standard_1020' # EEG montage - 'standard_1020' or 'standard_1005'
- elif ELECTRODE_CONFIG == '1010':
- ONLY_20ELECTRODES = False
- MONTAGE = 'standard_1020' # EEG montage - 'standard_1020' or 'standard_1005'
- elif ELECTRODE_CONFIG == '1005':
- ONLY_20ELECTRODES = False
- MONTAGE = 'standard_1005' # EEG montage - 'standard_1020' or 'standard_1005'
- LOOSE = 0 # Fixed Orientation = 0, Loose = 1.
- DEPTH = 0 # Depth weighting - Best not to use for EMs
- DOWNSAMPLE = True # Whether to use the downsampled SRC or dense MRI mesh for calculating the GEM
- PICK_EEG = True # Whether to use EEG
- PICK_MEG = False # Whether to use MEG
- BINARISE_CEM = False # Whether to binarise the CEM before calculating the eigenmodes
- USE_FSAVERAGE_FWD = False # Whether to use the fsaverage forward model when solving the inverse problem
- USE_FSAVERAGE_GEM = False # Whether to use the fsaverage MRI when calculating the GEMs
- USE_GROUP_CON = False # Whether to use the group connectome when calculating the CEMs
- NUM_MODES = 1000
- STEP = 50
- num_modes = np.arange(start=STEP, stop=NUM_MODES+STEP, step=STEP)
- COMPARE_MNE = None # Whether to compare with MNE - Type the method or None/False
- SURROGATE_TEST = None # 'rotate' # 'roll' or 'rotate'
- SHUFFLE_ARRAY = np.arange(7, 700, 70) # Best to use an increment such that it's not a divisor of the number of sources in each hemisphere and don't start from 0 if using roll
- # Hyperparameters Unlikely To Change:
- ICO = 5 # Ideally this would be 5 for a higher resolution mesh, but 3 for this working example due to online memory limits.
- CON = 'con1019' # 'con1019' or 'con379'
- SFREQ = 78.125 # Hz - Default Sampling Frequency is 78.125Hz from 78.125Hz = 20kHz /256 = from 1/dt*1000 / scaling of 256 - Or it is /128 by the temporal averaging = 0.61 Hz
- # Path
- FS_PATH = Path("/Applications/freesurfer/7.3.2/")
- SUBJECTS_DIR = FS_PATH / "subjects"
- SUBJECT = "fsaverage"
- SIM_DIRECTORY = Path('Ignore/Simulations/')
- PARCELLATION = 'native.1000Parcels_Yeo2011_7Networks' # 'HCPMMP1'
- CON_PATH = f'External_Resources/HCP_data/HCP100206_{CON}'
- DISCRETE_FWD_PATH = Path(f'Ignore/{SUBJECT}_Con1000_twohemisrc_fwd.fif')
- # If None, will generate the GEMs - Path('Ignore/{SUBJECT}_ico5_gems.npz')
- # Better to recalculate to avoid mistakes, but using the ultra high res mesh is better and not realistic to recalculate.
- GEM_PATH = None
- SIM_TYPE = 'NMM'
- # '7networks_RH_Default_TempPole_1' # 'NMM' for TVB simualtion / a given time series or NAME_OF_REGION / INDEX_OF_REGION for a patch simulation
- EXTENT = 20 # Extent of the patch in mm
- SIM_FILE = Path(f'{SIM_DIRECTORY}/HCP100206_con1019_CIFTI_STRUCTURE_THALAMUS_LEFT_g_2.0.npz')
- print(f"Simulation File: {SIM_FILE}")
- # %%
- if SIM_TYPE == 'NMM':
- # Load the TVB Simulation
- raw_x = np.load(SIM_FILE)['raw_x'].astype(np.float32)
- raw_t = np.arange(raw_x.shape[0])/SFREQ
- # Reduce data to 60s
- raw_x = raw_x[:int(60*SFREQ),:,:,:]
- raw_t = raw_t[:int(60*SFREQ)]
- # Take only necessary state_variables
- raw_x = raw_x[:,0,:,0]
- # Transformations to the data:
- # Use the negative, so that the seizure-state has higher voltage
- raw_x = -raw_x
- # Add 1 to the data so neutral is 0V
- # raw_x = raw_x + 1
- # Lower the units
- raw_x = raw_x*10e-9
- # Subtracting by simple offset works best, such that resting is around 0
- offset = np.percentile(raw_x, 20)
- raw_x = raw_x - offset
- # %%
- if SIM_TYPE == 'NMM':
- plt.plot(raw_t, raw_x[:, 0])
- plt.xlabel('Time (s)', fontsize=14)
- plt.ylabel('Amplitude (Am)', fontsize=14)
- plt.xticks(fontsize=14)
- plt.yticks(fontsize=14)
- plt.tight_layout()
- plt.show()
- # %%
- if SIM_TYPE == 'NMM':
- # Plot a carpet plot (square)
- # Need to Change the Shape of the Simulation Output (2D and Transposed)
- plt.figure(figsize=(20, 10))
- cs=plt.imshow(raw_x.T, cmap="gray", aspect='equal',interpolation='none',origin='lower')
- plt.title('Raw Source Time Series', fontsize=20)
- axcb=plt.colorbar(cs)
- axcb.set_label('Amplitude (Am)', fontsize=20)
- axcb.ax.tick_params(labelsize=16)
- plt.ylabel('Region', fontsize=20)
- plt.xlabel('Time (s)', fontsize=20)
- xticks = np.arange(start=0,stop=raw_t.shape[0],step=int(np.ceil(raw_t.shape[0]/5)))
- plt.xticks(ticks=xticks,labels=np.round(raw_t[xticks],0).astype(int))
- plt.axis("tight")
- plt.xticks(fontsize=16)
- plt.yticks(fontsize=16)
- plt.show()
- # %% [markdown]
- # ## GEM Surface
- # %%
- if ANALYSIS_TYPE == 'GEM_surface':
- # Initialise the lists
- RLEs = []
- RLE_points = []
- coss = []
- ses = []
- cos_acrosstime = []
- expvars = []
- # Read fwd solution
- fwd = mne.read_forward_solution(f'Ignore/{SUBJECT}_ico{ICO}-fwd.fif') # mne.read_forward_solution(f'Ignore/{SUBJECT}_openmeeg_ico{ICO}-fwd.fif')
- # Construct the cortical mask
- mask = cortical_mask(SUBJECT, SUBJECTS_DIR, fwd['src'], downsample=True)
- info = generate_mne_info(sampling_freq=SFREQ, montage_name=MONTAGE, add_meg=PICK_MEG)
- if ONLY_20ELECTRODES:
- names_1020 = ['Fp1', 'Fp2', 'F7', 'F3', 'Fz', 'F4', 'F8', 'A1', 'T3', 'C3', 'Cz', 'C4', 'T4', 'T5', 'P3', 'Pz', 'P4', 'T6', 'O1', 'O2', 'A2']
- ch_inds = mne.pick_channels(ch_names=info['ch_names'], include=names_1020, )
- info = mne.pick_info(info, ch_inds)
- fwd = mne.pick_channels_forward(fwd, include=info['ch_names'], )
- fwd = mne.pick_types_forward(fwd, meg=PICK_MEG, eeg=PICK_EEG, exclude=info['bads'], )
- com_labels = None # If end up shifting the ordering of function calls around, com_labels is input to tvb_loadtomne
- # Load the TVB simulation
- stc, sim = tvb_loadtomne(raw_x, SUBJECT, fwd, info, PARCELLATION, selected_label=com_labels, fs_path= FS_PATH, )
- if SNR is not None:
- eeg_power = np.sum(sim.data**2)/sim.data.size
- eeg_noise = np.random.normal(0, np.sqrt(eeg_power)/np.sqrt(10**(SNR/10)), sim.data.shape)
- sim.data = sim.data + eeg_noise
- # Set EEG Reference if required - Doesn't matter if before or after adding noise
- if PICK_EEG:
- sim.set_eeg_reference('average',projection=True)
- # Compute covariance
- cov = mne.Covariance(data=np.identity(len(sim.ch_names)), names=sim.ch_names, bads=sim.info['bads'], projs=sim.info['projs'], nfree=1 )
- # Apply a highpass filter
- # sim = sim.filter(l_freq=1., h_freq=None )
- # Index of 50% of max EEG power
- hmp_i = np.where(np.sum(sim.data * sim.data, axis=0) > 0.5*np.sum(sim.data * sim.data, axis=0).max())[0][0]
- # GEM Solver
- # Graph for varying number of modes
- if USE_FSAVERAGE_FWD:
- fwd = mne.read_forward_solution(Path(f'Ignore/fsaverage_ico{ICO}-fwd.fif'))
- fwd = mne.pick_channels_forward(fwd, include=info['ch_names'], )
- fwd = mne.pick_types_forward(fwd, meg=PICK_MEG, eeg=PICK_EEG, exclude=info['bads'], )
- stc, _ = tvb_loadtomne(raw_x, 'fsaverage', fwd, info, PARCELLATION, selected_label=com_labels, fs_path= FS_PATH, )
- SUBJECT = 'fsaverage'
- if GEM_PATH:
- # Load the GEMs
- eval, emodes = np.load(GEM_PATH)['evals'], np.load(GEM_PATH)['emodes']
- else:
- # Calculate the eigenmodes
- if USE_FSAVERAGE_GEM:
- fwd_fsaverage = mne.read_forward_solution(Path(f'Ignore/fsaverage_ico{ICO}-fwd.fif'))
- mask = cortical_mask('fsaverage', SUBJECTS_DIR, fwd_fsaverage['src'], downsample=True)
- evals, emodes = both_hemi_calc_eig(fwd_fsaverage['src'], mask=mask, num_modes=NUM_MODES)
- del fwd_fsaverage
- else:
- evals, emodes = both_hemi_calc_eig(fwd['src'], mask=mask, num_modes=NUM_MODES)
- weight = 1 / (2*np.pi + np.sqrt(np.abs(evals)))
- emodes = emodes * weight[np.newaxis, :]
- for num_mode in num_modes:
- # 1. Obtain the eigenmodes
- emodes_subset = np.concatenate((emodes[:, :num_mode//2], emodes[:, NUM_MODES//2:NUM_MODES//2+num_mode//2]), axis=1)
- # 2. Apply the solver
- loose, depth = LOOSE, DEPTH
- solver_kwargs = dict(emodes=emodes_subset, rcond=RCOND)
- stc_est_region, var_exp, w = apply_solver(gem_solver, sim, fwd, cov, loose, depth, **solver_kwargs)
- # 3. Calculate threshold
- threshold = threshold_otsu(np.abs(stc_est_region.data,))/ np.max(np.abs(stc_est_region.data)) * 100
- # threshold = 40
- # print(f"Otsu's Threshold = {threshold}")
- # 4. Calculate metrics
- RLE = mne.simulation.metrics.region_localization_error(stc, stc_est_region, fwd['src'], threshold=f'{threshold}%', per_sample=False)
- RLE_point = mne.simulation.metrics.region_localization_error(stc.copy().crop(tmin=raw_t[hmp_i], tmax=raw_t[hmp_i]), stc_est_region.copy().crop(tmin=raw_t[hmp_i], tmax=raw_t[hmp_i]), fwd['src'], threshold=f'{threshold}%', per_sample=False)
- cos = mne.simulation.metrics.cosine_score(stc, stc_est_region, per_sample=False)
- aligned_stc_est = stc_aligner(stc, stc_est_region)
- nse = (aligned_stc_est.data/np.abs(aligned_stc_est.data).max() - stc.data/np.abs(stc.data).max())**2
- varexp_stc = log_exp_var(stc.data/np.abs(stc.data).max(), np.sqrt(nse))
- se = np.mean(nse)
- cos_t = mne.simulation.metrics.cosine_score(stc, stc_est_region, per_sample=True)
- varexp_stc = log_exp_var(stc.data/np.abs(stc.data).max(), np.sqrt(nse))
- expvars.append(varexp_stc)
- RLEs.append(RLE)
- RLE_points.append(RLE_point)
- coss.append(cos)
- ses.append(se)
- cos_acrosstime.append(cos_t)
- # %% [markdown]
- # ## CON1019 Discrete Source Space (1000 cortical regions)
- # %%
- if ANALYSIS_TYPE != 'GEM_surface':
- # Load Connectivity
- if SIM_TYPE == 'NMM':
- load_centres=False
- else:
- load_centres=True
- if USE_GROUP_CON or SUBJECT == 'fsaverage':
- con = con_loader(Path('External_Resources/HCP_data/SC_con1019/group_streamline_count_atlas.csv'), load_tracts=True, threshold=None, weights_only=True, load_centres=load_centres, subject=SUBJECT, subjects_dir=SUBJECTS_DIR)
- con.region_labels = np.loadtxt(CON_PATH / Path('region_names.txt'), dtype=str)
- else:
- con = con_loader(CON_PATH, load_tracts=True, threshold=None, weights_only=False, load_centres=load_centres, subject=SUBJECT, subjects_dir=SUBJECTS_DIR)
- selected_label = mne.read_labels_from_annot(SUBJECT, PARCELLATION, subjects_dir=SUBJECTS_DIR)
- # Remove the ??? regions
- selected_label = [label for label in selected_label if '???' not in label.name]
- # Load fwd, needs to be the discrete one
- fwd = mne.read_forward_solution(DISCRETE_FWD_PATH)
- info = generate_mne_info(sampling_freq=SFREQ, montage_name=MONTAGE, add_meg=PICK_MEG)
- if ONLY_20ELECTRODES:
- names_1020 = ['Fp1', 'Fp2', 'F7', 'F3', 'Fz', 'F4', 'F8', 'A1', 'T3', 'C3', 'Cz', 'C4', 'T4', 'T5', 'P3', 'Pz', 'P4', 'T6', 'O1', 'O2', 'A2']
- ch_inds = mne.pick_channels(ch_names=info['ch_names'], include=names_1020, )
- info = mne.pick_info(info, ch_inds)
- fwd = mne.pick_channels_forward(fwd, include=info['ch_names'], )
- fwd = mne.pick_types_forward(fwd, meg=PICK_MEG, eeg=PICK_EEG, exclude=info['bads'], )
- # 1. Generate the information from the dense source space Freesurfer labels
- region_centres = centre_loader(con.region_labels, coords='MRI_RAS', parcellation=PARCELLATION, subject=SUBJECT, subjects_dir=SUBJECTS_DIR, ) / 1000 # Convert to m
- label_hemi = np.array([label.hemi for label in selected_label])
- label_names = np.array([label.name[:-3] for label in selected_label])
- com_labels = generate_com_labels(region_centres, label_names, label_hemi, SUBJECT)
- if SIM_TYPE == 'NMM':
- # Load the TVB simulation and convert to EEG
- stc, sim = tvb_loadtomne(raw_x, SUBJECT, fwd, info, PARCELLATION, selected_label=com_labels, fs_path= FS_PATH, )
- else:
- # Create a single timepoint patch simulation with the centre region being the string in SIM_TYPE
- stc, sim = patch_simulator(con, SIM_TYPE, fwd, info, selected_label=com_labels, radius=EXTENT, restrict_hemi=True, full_src=True)
- raw_t = np.array([0])
- if SNR is not None:
- eeg_power = np.sum(sim.data**2)/sim.data.size
- eeg_noise = np.random.normal(0, np.sqrt(eeg_power)/np.sqrt(10**(SNR/10)), sim.data.shape)
- sim.data = sim.data + eeg_noise
- # Set EEG Reference if required - Doesn't matter if before or after adding noise
- if PICK_EEG:
- sim.set_eeg_reference('average',projection=True)
- # sim.apply_proj()
- # Compute covariance
- cov = mne.Covariance(data=np.identity(len(sim.ch_names)), names=sim.ch_names, bads=sim.info['bads'], projs=sim.info['projs'], nfree=1 )
- # Index of 50% of max EEG power
- hmp_i = np.where(np.sum(sim.data * sim.data, axis=0) > 0.5*np.sum(sim.data * sim.data, axis=0).max())[0][0]
- # %%
- # Load or generate the EMs
- if ANALYSIS_TYPE != 'GEM_surface':
- # In case we want to use a different fwd to the one used for the simulation (i.e. using group average fwd)
- if USE_FSAVERAGE_FWD:
- SUBJECT = 'fsaverage'
- fwd = mne.read_forward_solution(Path(f'Ignore/{SUBJECT}_Con1000_twohemisrc_fwd.fif'))
- # Read fwd solution
- fwd_surf = mne.read_forward_solution(Path(f'Ignore/{SUBJECT}_ico{ICO}-fwd.fif'))
- # Geometric eigenmodes
- if ANALYSIS_TYPE == 'GEM_discrete':
- # Load the pre-computed GEMs
- if GEM_PATH:
- evals, emodes = np.load(GEM_PATH)['evals'], np.load(GEM_PATH)['emodes']
- # Calculate the eigenmodes
- elif USE_FSAVERAGE_GEM:
- fwd_surf = mne.read_forward_solution(Path(f'Ignore/fsaverage_ico5-fwd.fif'))
- mask = cortical_mask('fsaverage', SUBJECTS_DIR, fwd_surf['src'], downsample=DOWNSAMPLE)
- evals, emodes = both_hemi_calc_eig(fwd_surf['src'], downsample=DOWNSAMPLE, mask=mask, num_modes=NUM_MODES, normalise=False )
- emodes = subset_eigenmodes(emodes, fwd_surf['src'], method='average', downsample=DOWNSAMPLE, parcellation=PARCELLATION, subjects_dir=SUBJECTS_DIR, region_labels=con.region_labels, subject='fsaverage', normalise=True)
- else:
- mask = cortical_mask(SUBJECT, SUBJECTS_DIR, fwd_surf['src'], downsample=DOWNSAMPLE)
- evals, emodes = both_hemi_calc_eig(fwd_surf['src'], downsample=DOWNSAMPLE, mask=mask, num_modes=NUM_MODES, normalise=False )
- # np.savez_compressed(Path(f'Ignore/{SUBJECT}_ico5_gems.npz'), evals=evals, emodes=emodes)
- emodes = subset_eigenmodes(emodes, fwd_surf['src'], method='average', downsample=DOWNSAMPLE, parcellation=PARCELLATION, subjects_dir=SUBJECTS_DIR, region_labels=con.region_labels, subject=SUBJECT, normalise=True)
- # np.savez_compressed(Path(f'Ignore/{SUBJECT}_con1000_gems.npz'), evals=evals, emodes=emodes)
- # Now weight the emodes by the inverse of the eigenvalues
- weight = 1 / (2*np.pi + np.sqrt(np.abs(evals)))
- emodes = emodes * weight[np.newaxis, :]
- # Connectivity eigenmodes
- elif ANALYSIS_TYPE == 'CEM_discrete':
- evals, emodes = calc_con_eigenmodes(con.weights, NUM_MODES, threshold=0, normed=True, binarise=BINARISE_CEM)
- # Now weight the emodes by the inverse of the eigenvalues
- weight = 1 / (0.1*np.abs(evals).mean() + np.abs(evals))
- emodes = emodes * weight[np.newaxis, :]
- # Truncate the eigenmodes to remove subcortical regions
- if CON == 'con1019':
- emodes = emodes[:-19,:]
- elif CON == 'con379':
- emodes = emodes[19:,:]
- # Both types of eigenmodes
- elif ANALYSIS_TYPE == 'SEM_discrete':
- mask = cortical_mask(SUBJECT, SUBJECTS_DIR, fwd_surf['src'], downsample=DOWNSAMPLE)
- g_evals, emodes = both_hemi_calc_eig(fwd_surf['src'], downsample=DOWNSAMPLE, mask=mask, num_modes=NUM_MODES, )
- g_emodes = subset_eigenmodes(emodes, fwd_surf['src'], method='average', downsample=DOWNSAMPLE, parcellation=PARCELLATION, subjects_dir=SUBJECTS_DIR, region_labels=con.region_labels, subject=SUBJECT)
- # Order g_emodes by eigenvalue
- # Create interleaved index array for ordering eigenmodes
- idx = np.array([[i, i+NUM_MODES//2] for i in range(1, NUM_MODES//2+1)]).flatten()
- idx = idx - 1 # Convert to 0-based indexing
- g_emodes = g_emodes[:, idx]
- g_evals = g_evals[idx]
- c_evals, c_emodes = calc_con_eigenmodes(con.weights, NUM_MODES, threshold=0, normed=True, binarise=BINARISE_CEM)
- c_emodes = c_emodes/ np.linalg.norm(c_emodes, axis=0)
- # Truncate the eigenmodes to remove subcortical regions
- if CON == 'con1019':
- c_emodes = c_emodes[:-19,:]
- elif CON == 'con379':
- c_emodes = c_emodes[19:,:]
- # # Normalise the evals
- g_evals = np.abs(g_evals)/np.abs(g_evals).mean()
- c_evals = np.abs(c_evals)/np.abs(c_evals).mean()
- g_weight = np.pi / (0.1 + np.sqrt(np.abs(g_evals)))
- c_weight = np.pi / (0.1 + c_evals)
- g_emodes = g_emodes * g_weight[np.newaxis, :]
- c_emodes = c_emodes * c_weight[np.newaxis, :]
- # Combine the emodes and evals
- evals = np.concatenate((g_evals, c_evals))
- idx = np.argsort(evals) # Get indices that would sort eigenvalues from low to high
- evals = evals[idx] # Sort eigenvalues
- emodes = np.concatenate((g_emodes, c_emodes), axis=1)[:, idx] # Combine and sort eigenmodes
- # %%
- if ANALYSIS_TYPE != 'GEM_surface':
- # Initialise the lists
- RLEs = []
- RLE_points = []
- coss = []
- ses = []
- cos_acrosstime = []
- expvars = []
- rle_acrosstime = []
- for num_mode in num_modes:
- # 1. Obtain the eigenmodes
- if ANALYSIS_TYPE == 'GEM_discrete':
- emodes_subset = np.concatenate((emodes[:, :num_mode//2], emodes[:, NUM_MODES//2:NUM_MODES//2+num_mode//2]), axis=1)
- evals_subset = np.concatenate((evals[:num_mode//2], evals[NUM_MODES//2:NUM_MODES//2+num_mode//2]), )
- # elif ANALYSIS_TYPE == 'SEM_discrete':
- # # This will make it so that there are an equal number of g and c modes
- # g_emodes_subset = g_emodes[:, :num_mode//2]
- # c_emodes_subset = c_emodes[:, :num_mode//2]
- # emodes_subset = np.zeros((g_emodes_subset.shape[0], num_mode))
- # emodes_subset[:, ::2] = g_emodes_subset # Even indices for g_emodes
- # emodes_subset[:, 1::2] = c_emodes_subset # Odd indices for c_emodes
- else:
- emodes_subset = emodes[:, :num_mode]
- evals_subset = evals[:num_mode]
- # 2. Apply the solver
- loose, depth = LOOSE, DEPTH
- solver_kwargs = dict(emodes=emodes_subset, rcond=RCOND,)
- stc_est_region, var_exp, w = apply_solver(gem_solver, sim, fwd, cov, loose, depth, pick_ori='normal', **solver_kwargs)
- # 3. Calculate threshold
- threshold = threshold_otsu(np.abs(stc_est_region.data,))/ np.max(np.abs(stc_est_region.data)) * 100
- # threshold = 40
- print(f"Otsu's Threshold = {threshold}")
- # 4. Calculate metrics
- RLE = mne.simulation.metrics.region_localization_error(stc, stc_est_region, fwd['src'], threshold=f'{threshold}%', per_sample=False)
- rle_t = mne.simulation.metrics.region_localization_error(stc, stc_est_region, fwd['src'], threshold=f'{threshold}%', per_sample=True)
- RLE_point = mne.simulation.metrics.region_localization_error(stc.copy().crop(tmin=raw_t[hmp_i], tmax=raw_t[hmp_i]), stc_est_region.copy().crop(tmin=raw_t[hmp_i], tmax=raw_t[hmp_i]), fwd['src'], threshold=f'{threshold}%', per_sample=False)
- cos = mne.simulation.metrics.cosine_score(stc, stc_est_region, per_sample=False)
- aligned_stc_est = stc_aligner(stc, stc_est_region) # Technically not needed for the discrete source case
- nse = (aligned_stc_est.data/np.abs(aligned_stc_est.data).max() - stc.data/np.abs(stc.data).max())**2
- varexp_stc = log_exp_var(stc.data/np.abs(stc.data).max(), np.sqrt(nse))
- se = np.mean(nse)
- cos_t = mne.simulation.metrics.cosine_score(stc, stc_est_region, per_sample=True)
- expvars.append(varexp_stc)
- RLEs.append(RLE)
- RLE_points.append(RLE_point)
- coss.append(cos)
- ses.append(se)
- cos_acrosstime.append(cos_t)
- rle_acrosstime.append(rle_t)
- # %% [markdown]
- # # Graphs
- # %%
- # Plot the results
- # Turn into arrays
- RLEs = np.array(RLEs)
- RLE_points = np.array(RLE_points)
- fig, axs = plt.subplots(3, 2, figsize=(20, 10))
- axs[0, 0].plot(num_modes[:len(RLEs)], RLEs*1e3, marker='o')
- axs[0, 0].axvline(fwd['nchan'], ymin=0, ymax=1, color='r', linestyle='--')
- axs[0, 0].set_title(f'RLE - Otsu\'s Threshold')
- axs[0, 0].set_xlabel('Number of Modes')
- axs[0, 0].set_ylabel(f'RLE (mm)')
- axs[0, 0].grid()
- axs[0, 1].plot(num_modes, RLE_points*1e3, marker='o')
- axs[0, 1].axvline(fwd['nchan'], ymin=0, ymax=1, color='r', linestyle='--')
- axs[0, 1].set_title(f'RLE 50% EEG at Otsu\'s Threshold - t = {raw_t[hmp_i]:.1f}s')
- axs[0, 1].set_xlabel('Number of Modes')
- axs[0, 1].set_ylabel('RLE 50% EEG (mm)')
- axs[0, 1].grid()
- # Plot the Explained Variance
- axs[1,0].plot(num_modes, expvars, marker='o')
- axs[1,0].axvline(fwd['nchan'], ymin=0, ymax=1, color='r', linestyle='--')
- axs[1,0].set_title('Explained Variance')
- axs[1,0].set_xlabel('Number of Modes')
- axs[1,0].set_ylabel('Explained Variance (%)')
- axs[1,0].grid()
- # Normalised Mean Squared Error
- axs[1, 1].plot(num_modes, ses, marker='o')
- axs[1, 1].axvline(fwd['nchan'], ymin=0, ymax=1, color='r', linestyle='--')
- # axs[1, 1].axvline(306, ymin=0, ymax=1, color='r', linestyle='--')
- # axs[1, 1].axvline(343, ymin=0, ymax=1, color='r', linestyle='--')
- axs[1, 1].set_title('Normalised Mean Squared Error')
- axs[1, 1].set_xlabel('Number of Modes')
- axs[1, 1].set_ylabel('Mean Squared Error')
- # axs[1, 1].set_yscale('log')
- axs[1, 1].grid()
- axs[2, 0].plot(num_modes, coss, marker='o')
- axs[2, 0].axvline(fwd['nchan'], ymin=0, ymax=1, color='r', linestyle='--')
- axs[2, 0].set_title('Cosine Score')
- axs[2, 0].set_xlabel('Number of Modes')
- axs[2, 0].set_ylabel('Cosine Score')
- axs[2, 0].grid()
- cos_acrosstime = np.array(cos_acrosstime)
- plot_mean_and_range(cos_acrosstime, raw_t, stat_type='max', show_minmax=True, ax=axs[2,1])
- axs[2,1].set_title(f'Cosine Score Across Time - {ANALYSIS_TYPE}')
- axs[2,1].set_xlabel('Time (s)')
- axs[2,1].set_ylabel('Cosine Score')
- plt.tight_layout()
- # %% [markdown]
- # ## MNE inverse operator for comparison
- # %%
- COMPARE_MNE = 'sLORETA'
- # MNE inverse operator for comparison
- if COMPARE_MNE:
- # Compute inverse operator
- inv = make_inverse_operator(sim.info, fwd, cov, loose=LOOSE, depth=DEPTH, )
- if SNR is not None:
- # Noting that MNE-Python takes in a linear SNR - (10**(SNR/10)) - 1 / lambda2**2
- stc_est_region_mne = apply_inverse(sim, inv, method=COMPARE_MNE, lambda2=1/(10**(SNR/10)), pick_ori=None)
- else:
- stc_est_region_mne = apply_inverse(sim, inv, method=COMPARE_MNE, lambda2=np.finfo(np.float64).eps, pick_ori=None)
- # 3. Calculate tresholds
- threshold = threshold_otsu(np.abs(stc_est_region_mne.data,))/ np.max(np.abs(stc_est_region_mne.data)) * 100
- # threshold = 40
- print(f"Otsu's Threshold = {threshold}")
- print('RLE timeseries = ', mne.simulation.metrics.region_localization_error(stc, stc_est_region_mne, fwd['src'], threshold=f'{threshold}%', per_sample=False))
- print('RLE 50% EEG = ', mne.simulation.metrics.region_localization_error(stc.copy().crop(tmin=raw_t[hmp_i], tmax=raw_t[hmp_i]), stc_est_region_mne.copy().crop(tmin=raw_t[hmp_i], tmax=raw_t[hmp_i]), fwd['src'],
- threshold=f'{threshold}%', per_sample=False))
- print('Cosine Score = ', mne.simulation.metrics.cosine_score(stc, stc_est_region_mne, per_sample=False))
- cos_t = mne.simulation.metrics.cosine_score(stc, stc_est_region_mne, per_sample=True)
- cos_t = cos_t.reshape(1,-1)
- aligned_stc_est = stc_aligner(stc, stc_est_region_mne)
- print('Squared Error = ', np.sum((aligned_stc_est.data - stc.data)**2))
- print('Standardised Square Error = ', np.sum((aligned_stc_est.data/np.abs(aligned_stc_est.data).max() - stc.data/np.abs(stc.data).max())**2))
- print('Variance Explained = ', log_exp_var(stc.data/np.abs(stc.data).max(), np.sqrt(np.sum((aligned_stc_est.data/np.abs(aligned_stc_est.data).max() - stc.data/np.abs(stc.data).max())**2))))
- # print('Correlation = ', np.corrcoef(aligned_stc_est.data, stc.data)[0, 1]) # Correlation takes too long to compute for ico5
- # %%
- if COMPARE_MNE:
- fig, axs = plt.subplots(3, 2, figsize=(20, 10))
- plot_mean_and_range(cos_t, raw_t, show_minmax=True, ax=axs[0,0])
- axs[0,0].set_title(f'Cosine Score Across Time - {COMPARE_MNE}', fontsize=12)
- axs[0,0].set_xlabel('Time (s)', fontsize=12)
- axs[0,0].set_ylabel('Cosine Score', fontsize=12)
- axs[0,0].set_title(f'Cosine Score Across Time - {COMPARE_MNE}', fontsize=12)
- axs[0,0].set_xlabel('Time (s)', fontsize=12)
- axs[0,0].set_ylabel('Cosine Score', fontsize=12)
- axs[0,0].get_legend().remove()
- plt.tight_layout()
- # %% [markdown]
- # ## Surrogate Test
- # %%
- if 'SHUFFLE_ARRAY' not in locals() and SURROGATE_TEST:
- # Create a shuffle array - Increments of 7 such that it's not a divisor of the number of sources in each hemisphere
- print('Shuffle Array not defined, using default with 99 surrogates')
- SHUFFLE_ARRAY = np.arange(7, 700, 7)
- # Perform the surrogate test for N interations
- if SURROGATE_TEST:
- RLEs = RLEs.tolist()
- RLE_points = RLE_points.tolist()
- for shuffle in SHUFFLE_ARRAY:
- # Generate Surrogate Modes using the Roll Method
- if SURROGATE_TEST == 'roll':
- if ANALYSIS_TYPE == 'GEM_discrete':
- emodes_subset = np.concatenate((emodes[:, :num_mode//2], emodes[:, NUM_MODES//2:NUM_MODES//2+num_mode//2]), axis=1)
- elif ANALYSIS_TYPE == 'CEM_discrete':
- emodes_subset = emodes[:, :num_mode]
- # Roll the eigenmodes
- emodes_subset[:emodes_subset.shape[0]//2,:emodes_subset.shape[1]//2] = np.roll(emodes_subset[:emodes_subset.shape[0]//2,:emodes_subset.shape[1]//2], shift=shuffle, axis=0)
- emodes_subset[emodes_subset.shape[0]//2:,emodes_subset.shape[1]//2:] = np.roll(emodes_subset[emodes_subset.shape[0]//2:,emodes_subset.shape[1]//2:], shift=shuffle, axis=0)
- # Generate Surrogate Modes using the Rotational Eigenstrapping Method
- if SURROGATE_TEST == 'rotate':
- # Normalise to be safe
- emodes = emodes / np.linalg.norm(emodes, axis=0)[np.newaxis, :]
- surrogate_emodes = both_hemi_surrogate_eig(emodes, evals, normalize=True, thresh=0, )
- surrogate_emodes = surrogate_emodes*weight[np.newaxis, :]
- emodes_subset = np.concatenate((surrogate_emodes[:, :num_mode//2], surrogate_emodes[:, NUM_MODES//2:NUM_MODES//2+num_mode//2]), axis=1)
- # 2. Apply the solver
- loose, depth = LOOSE, DEPTH
- solver_kwargs = dict(emodes=emodes_subset, rcond=RCOND)
- stc_est_region, var_exp, w = apply_solver(gem_solver, sim, fwd, cov, loose, depth, **solver_kwargs)
- # 3. Calculate threshold
- threshold = threshold_otsu(np.abs(stc_est_region.data), )/ np.max(stc_est_region.data) * 100
- # 4. Calculate metrics
- RLE = mne.simulation.metrics.region_localization_error(stc, stc_est_region, fwd['src'], threshold=f'{threshold}%', per_sample=False)
- RLE_point = mne.simulation.metrics.region_localization_error(stc.copy().crop(tmin=raw_t[hmp_i], tmax=raw_t[hmp_i]), stc_est_region.copy().crop(tmin=raw_t[hmp_i], tmax=raw_t[hmp_i]), fwd['src'], threshold=f'{threshold}%', per_sample=False)
- cos = mne.simulation.metrics.cosine_score(stc, stc_est_region, per_sample=False)
- aligned_stc_est = stc_aligner(stc, stc_est_region) # Technically not needed for the discrete source case
- nse = (aligned_stc_est.data/np.abs(aligned_stc_est.data).max() - stc.data/np.abs(stc.data).max())**2
- varexp_stc = log_exp_var(stc.data/np.abs(stc.data).max(), np.sqrt(nse))
- se = np.mean(nse)
- expvars.append(varexp_stc)
- RLEs.append(RLE)
- RLE_points.append(RLE_point)
- coss.append(cos)
- ses.append(se)
- # Clear Cell Output
- clear_output(wait=True)
- RLEs = np.array(RLEs)
- RLE_points = np.array(RLE_points)
- # %%
- # Stop it here for now if run all
- 1/0
- # %% [markdown]
- # ## Videos of Sources
- #
- # ### Source Estimate
- # %%
- if ANALYSIS_TYPE != 'GEM_surface':
- # To convert the discrete source estimate to a surface estimate just run these two functions - then allows us to use MNE's plotting functions
- fwd_surface = mne.read_forward_solution(f'Ignore/{SUBJECT}_ico3-fwd.fif')
- fwd_surface = mne.pick_channels_forward(fwd_surface, include=info['ch_names'], )
- fwd_surface = mne.pick_types_forward(fwd_surface, meg=PICK_MEG, eeg=PICK_EEG, exclude=info['bads'], )
- stc_surface, _ = tvb_loadtomne(stc_est_region.data.T, SUBJECT, fwd_surface, info, PARCELLATION, fs_path= FS_PATH, )
- # time_max here is the frame shown in the video. Which can be interpretted as a picture.
- surfer_kwargs = dict(
- hemi='both', subjects_dir=SUBJECTS_DIR,
- # colormap='mne',
- # clim=dict(kind='value', lims=[stc_est_region.data.min(), (stc_est_region.data.max()+stc_est_region.data.min())/2, stc_est_region.data.max()]),
- clim = dict(kind='value', lims=[0, stc_est_region.data.max()/2, stc_est_region.data.max()]),
- # clim=dict(kind='value', lims=[0, stc.data.max()/2, stc.data.max()]),
- views='rostral', initial_time=raw_t[hmp_i],
- time_unit='s', size=(800, 800), smoothing_steps=10,
- backend='pyvistaqt',
- )
- if ANALYSIS_TYPE == 'GEM_surface':
- brain = stc_est_region.plot(**surfer_kwargs)
- else:
- brain = stc_surface.plot(**surfer_kwargs)
- brain.set_playback_speed(speed=1)
- # %% [markdown]
- # ### True Sources
- # %%
- if ANALYSIS_TYPE != 'GEM_surface':
- # Looking at true stc
- stc_surface, _ = tvb_loadtomne(stc.data.T, SUBJECT, fwd_surface, info, PARCELLATION, fs_path= FS_PATH, )
- # time_max here is the frame shown in the video. Which can be interpretted as a picture.
- surfer_kwargs = dict(
- hemi='both', subjects_dir=SUBJECTS_DIR,
- # colormap='mne',
- # clim=dict(kind='value', lims=[stc.data.min(), (stc.data.max()+stc.data.min())/2, stc.data.max()]),
- clim = dict(kind='value', lims=[0, stc.data.max()/2, stc.data.max()]),
- # clim=dict(kind='value', lims=[0, stc.data[:,hmp_i].max()/2, stc.data[:,hmp_i].max()]),
- views='rostral',
- initial_time=raw_t[hmp_i], #
- # background='white',
- time_unit='s', size=(800, 800), smoothing_steps=10)
- if ANALYSIS_TYPE == 'GEM_surface':
- brain = stc.plot(**surfer_kwargs)
- else:
- brain = stc_surface.plot(**surfer_kwargs)
- brain.set_playback_speed(speed=1)
- # %% [markdown]
- # ## Visualising the Eigenmodes
- # %%
- # Plot the eigenmodes
- l_points, l_trias = get_tria_from_src(fwd_surf['src'], hemi=0, downsample=DOWNSAMPLE)
- l_tria = lapy.TriaMesh(l_points, l_trias)
- mask = cortical_mask(SUBJECT, SUBJECTS_DIR, fwd_surf['src'], downsample=DOWNSAMPLE)
- evals, s_emodes = both_hemi_calc_eig(fwd_surf['src'], downsample=DOWNSAMPLE, mask=mask, num_modes=NUM_MODES, normalise=False )
- mode_number = 20
- plot_tria_mesh(l_tria, vfunc=s_emodes[:s_emodes.shape[0]//2, mode_number],showcaxis=True)
- # %%
- from mpl_toolkits.mplot3d import Axes3D
- %matplotlib widget
- # Check discrete source space - for the eigenmodes
- # 3D plot of Discrete Source space where colour is dependent on subset_emodes
- mode_number = 20
- # Extract positions and colors
- positions = np.concatenate((fwd['src'][0]['rr'], fwd['src'][1]['rr']), axis=0)
- # colors = disc_emodes[:, mode_number]
- colors = emodes[:, mode_number]
- # Create a 3D scatter plot
- fig = plt.figure(figsize=(10, 10))
- ax = fig.add_subplot(111, projection='3d')
- sc = ax.scatter(positions[:, 0], positions[:, 1], positions[:, 2], c=colors, cmap='coolwarm', s=50)
- # Ensure axes follow the same scale
- ax.set_box_aspect([np.ptp(positions[:, 0]), np.ptp(positions[:, 1]), np.ptp(positions[:, 2])])
- # Add color bar
- cb = plt.colorbar(sc, ax=ax, shrink=0.5)
- cb.set_label(f'Subset Eigenmodes (Mode {mode_number})', fontsize=12)
- # Set labels
- ax.set_xlabel('X', fontsize=12)
- ax.set_ylabel('Y', fontsize=12)
- ax.set_zlabel('Z', fontsize=12)
- ax.set_title('3D Plot of Discrete Source Space', fontsize=14)
- plt.show()
- # %%
STC_Analysis.ipynb at commit 81268ed, under BSD-3-Clause · at the source
Overview
- Department of Biomedical Engineering The University of Melbourne Melbourne Australia
- Graeme Clark Institute The University of Melbourne Melbourne Australia
- National University of Singapore Singapore Singapore
- Grenoble Institut des Neurosciences INSERM Grenoble (La Tronche) France
- Department of Data Science & AI Monash University Melbourne Australia
- Department of Medicine, St Vincent's Hospital, Melbourne The University of Melbourne Melbourne Australia
Abstract
A fundamental view of neuroscience is that, in addition to neuronal activity, the structure of the brain constrains and explains brain function. An alluring formalism in computational neuroscience has been the generation of structural eigenmodes of neural activity from a matrix representing the anatomy of the brain. Traditionally, brain connectomics has been the gold standard for the coupling between structure and function. However, it has recently been suggested that simpler brain geometry can provide more explanatory power in fMRI. An adjacent modality is the source localization problem of EEG, which aims to identify the underlying generators of EEG recordings. The underdetermined nature of the problem requires sufficient constraints to produce realistic and unique solutions of source activity. In this work, a simple framework for incorporating different forms of structural brain eigenmodes to constrain the source localization problem in epilepsy is presented. Geometric eigenmodes were found to be able to reconstruct the spread of a seizure through the brain slightly better than connectome eigenmodes, and both types of structural modes significantly outperformed commonly used approaches.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 14 matches between paragraphs and lines of code.
Spokhim/sesl
81268edac5a70ea091d06cdce6ec2539075fdec0, 23 March 2026Availability: 2 checks, the latest on 31 October 2026: the link answers
- 31 October 2026: the link answers
- 30 September 2026: the link answers
8 files
- STC_Analysis.ipynb, Jupyter, 720 lines, 6 matches
- dynsim_fns.py, Python, 749 lines, 3 matches
- gem_fns.py, Python, 1,029 lines, 3 matches
- plot_fns.py, Python, 480 lines
- sample_sesl_pipeline.ipy
nb , Jupyter, 227 lines, 2 matches - useful_fns.py, Python, 390 lines
- LICENSE, License, 28 lines
- README.md, Text, 84 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 6 scripts, each with its path and the digest of its content;
- 14 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data Availability Statement
All code for the source localization pipeline can be found at: https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 7 authors, 5 keywords, 7 MeSH terms, 1 funder, 73 references.
Cite
This paper
Siu, P. H., Karoly, P. J., Mansour L., S., Soto‐Breceda, A., Kuhlmann, L., Cook, M. J., & Grayden, D. B. (2026). Structural Eigenmodes of the Brain to Improve the Source Localization of EEG: Application to Epileptiform Activity. Advanced science (Weinheim, Baden-Wurttemberg, Germany), 13(31), e16802. https://
BibTeX
@article{siu2026structur
author = {Siu, Pok Him and Karoly, Philippa J. and Mansour L., Sina and Soto‐Breceda, Artemio and Kuhlmann, Levin and Cook, Mark J. and Grayden, David B.},
title = {{Structural Eigenmodes of the Brain to Improve the Source Localization of EEG: Application to Epileptiform Activity}},
journal = {Advanced science (Weinheim, Baden-Wurttemberg, Germany)},
year = {2026},
month = mar,
volume = {13},
number = {31},
pages = {e16802},
publisher = {Wiley},
issn = {2198-3844},
doi = {10.1002/
url = {https://
pmid = {41869755},
pmcid = {PMC13588046}
}
RIS
TY - JOUR
AU - Siu, Pok Him
AU - Karoly, Philippa J.
AU - Mansour L., Sina
AU - Soto‐Breceda, Artemio
AU - Kuhlmann, Levin
AU - Cook, Mark J.
AU - Grayden, David B.
TI - Structural Eigenmodes of the Brain to Improve the Source Localization of EEG: Application to Epileptiform Activity
T2 - Advanced science (Weinheim, Baden-Wurttemberg, Germany)
J2 - Adv Sci (Weinh)
PY - 2026
DA - 2026/
VL - 13
IS - 31
SP - e16802
SN - 2198-3844
PB - Wiley
DO - 10.1002/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1002/
"type": "article-journal",
"title": "Structural Eigenmodes of the Brain to Improve the Source Localization of EEG: Application to Epileptiform Activity",
"container-title": "Advanced science (Weinheim, Baden-Wurttemberg, Germany)",
"author": [
{
"family": "Siu",
"given": "Pok Him"
},
{
"family": "Karoly",
"given": "Philippa J."
},
{
"family": "Mansour L.",
"given": "Sina"
},
{
"family": "Soto‐Breceda",
"given": "Artemio"
},
{
"family": "Kuhlmann",
"given": "Levin"
},
{
"family": "Cook",
"given": "Mark J."
},
{
"family": "Grayden",
"given": "David B."
}
],
"container-title-short":
"volume": "13",
"issue": "31",
"page": "e16802",
"DOI": "10.1002/
"PMID": "41869755",
"PMCID": "PMC13588046",
"ISSN": "2198-3844",
"publisher": "Wiley",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
23
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1162/netn.a.543 [code]
- High-resolution Bayesian Virtual Epileptic Patient using neural field models.Journal: Network neuroscience (Cambridge, Mass.)In common: The Virtual Brain, MNE-Python, SciPy, 2 other tools, epilepsy, 10 references
- [2] doi:10.1002/advs.202405246 [code]
- Seizure Sources Can Be Imaged from Scalp EEG by Means of Biophysically Constrained Deep Neural Networks.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: The Virtual Brain, MNE-Python, scikit-image, 3 other tools, epilepsy, EEG, 9 references
- [3] doi:10.1073/pnas.2201128119 [code]
- Deep neural networks constrained by neural mass models improve electrophysiological source imaging of spatiotemporal brain dynamics.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: The Virtual Brain, MNE-Python, scikit-image, 3 other tools, epilepsy, EEG, 8 references
- [4] doi:10.1371/journal.pcbi.1011642 [code]
- Parameter estimation in a whole-brain network model of epilepsy: Comparison of parallel global optimization solvers.Journal: PLoS computational biologyIn common: scikit-learn, SciPy, Matplotlib, 1 other tool, epilepsy, EEG, 10 references
- [5] doi:10.1038/s43588-025-00841-6 [code]
- Virtual brain twins for stimulation in epilepsy.Journal: Nature computational scienceIn common: The Virtual Brain, MNE-Python, scikit-learn, 3 other tools, epilepsy, EEG, 7 references
- [6] doi:10.1371/journal.pcbi.1012911 [code]
- Virtual epilepsy patient cohort: Generation and evaluation.Journal: PLoS computational biologyIn common: The Virtual Brain, MNE-Python, scikit-learn, 3 other tools, epilepsy, EEG, 6 references
- [7] doi:10.1093/braincomms/fcag217 [code]
- Investigation of stress hormones across multiday seizure cycles.Journal: Brain communicationsIn common: epilepsy, 3 authors
- [8] doi:10.7554/elife.106194 [code]
- Virtual Brain Inference (VBI), a flexible and integrative toolkit for efficient probabilistic inference on whole-brain models.Journal: eLifeIn common: MNE-Python, scikit-learn, SciPy, 2 other tools, 8 references
- [9] doi:10.1038/s41586-023-06098-1 [code]
- Geometric constraints on human brain function.Journal: NatureIn common: BrainSpace, SciPy, NumPy, 10 references
- [10] doi:10.1093/braincomms/fcac173 [code]
- Multiple mechanisms shape the relationship between pathway and duration of focal seizures.Journal: Brain communicationsIn common: epilepsy, 3 references, 2 authors
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 6 scripts, and 14 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:d0298d2e91a89fdb…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1002/advs.202516802)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1002/advs.202516802.svg
:target: https://openscicode.org/badge/doi/10.1002/advs.202516802
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1002/advs.202516802"><img src="https://openscicode.org/badge/doi/10.1002/advs.202516802.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".
If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
