geometric-brain-dynamics-mapping-v3

star 1

Geometric Basis Functions (GBF) framework for noninvasive whole human brain dynamics mapping. Uses participant-specific eigenmodes from cortical surface to resolve inverse problem in EEG/MEG source imaging. Activation: brain dynamics, geometric basis functions, source imaging, EEG/MEG, cortical geometry.

hiyenwong By hiyenwong schedule Updated 6/3/2026

name: geometric-brain-dynamics-mapping-v3 description: "Geometric Basis Functions (GBF) framework for noninvasive whole human brain dynamics mapping. Uses participant-specific eigenmodes from cortical surface to resolve inverse problem in EEG/MEG source imaging. Activation: brain dynamics, geometric basis functions, source imaging, EEG/MEG, cortical geometry."

Geometric Brain Dynamics Mapping (GBF v3)

Overview

This skill implements the methodology from "A geometry aware framework enhances noninvasive mapping of whole human brain dynamics" (arXiv:2604.25592, April 2026). The framework provides a powerful anatomical constraint for electroencephalography (EEG) and magnetoencephalography (MEG) source imaging by embedding participant-specific Geometric Basis Functions (GBFs).

Core Innovation

Problem: Non-invasive electrophysiology lacks methods that accurately reconstruct whole-brain spatiotemporal dynamics while incorporating individual cortical geometry. Current source imaging is limited by simplistic or biologically implausible priors.

Solution: Geometric Basis Functions (GBFs) - eigenmodes derived from each individual's cortical surface that:

  • Provide a powerful anatomical constraint
  • Resolve the inverse problem with improved reconstruction fidelity
  • Align source estimates with geometric organization of neural dynamics
  • Yield high localization accuracy and capture fast spatiotemporal dynamics

Activation Keywords

  • brain dynamics mapping
  • geometric basis functions
  • GBF
  • EEG source imaging
  • MEG source imaging
  • cortical geometry
  • eigenmodes
  • noninvasive brain mapping
  • inverse problem
  • whole-brain dynamics

Methodology

Step 1: Cortical Surface Processing

Extract participant-specific cortical surface geometry from structural MRI.

def extract_cortical_surface(structural_mri):
    """
    Extract cortical surface mesh from structural MRI.
    
    Args:
        structural_mri: T1-weighted anatomical scan
    
    Returns:
        vertices: Surface vertices [N, 3]
        faces: Surface faces [M, 3]
    """
    # Surface reconstruction using FreeSurfer or similar
    surfaces = reconstruct_surfaces(structural_mri)
    
    # Get pial and white matter surfaces
    pial = surfaces['pial']
    white = surfaces['white']
    
    # Compute mid-cortical surface
    vertices = (pial.vertices + white.vertices) / 2
    faces = pial.faces
    
    return vertices, faces

Step 2: Geometric Basis Function Computation

Compute eigenmodes of the cortical surface Laplacian.

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import eigsh

def compute_geometric_basis_functions(vertices, faces, n_modes=200):
    """
    Compute Geometric Basis Functions (eigenmodes) from cortical surface.
    
    Args:
        vertices: Surface vertices [N, 3]
        faces: Surface faces [M, 3]
        n_modes: Number of eigenmodes to compute
    
    Returns:
        gbf: Geometric basis functions [N, n_modes]
        eigenvalues: Corresponding eigenvalues [n_modes]
    """
    # Compute surface Laplacian (Laplace-Beltrami operator)
    L = compute_laplace_beltrami(vertices, faces)
    
    # Compute mass matrix
    M = compute_mass_matrix(vertices, faces)
    
    # Solve generalized eigenvalue problem: L @ phi = lambda * M @ phi
    eigenvalues, eigenvectors = eigsh(L, k=n_modes, M=M, sigma=0)
    
    # Sort by eigenvalue (ascending)
    idx = np.argsort(eigenvalues)
    eigenvalues = eigenvalues[idx]
    gbf = eigenvectors[:, idx]
    
    return gbf, eigenvalues

def compute_laplace_beltrami(vertices, faces):
    """
    Compute discrete Laplace-Beltrami operator using cotangent weights.
    """
    n_vertices = len(vertices)
    
    # Cotangent Laplacian
    L = csr_matrix((n_vertices, n_vertices))
    
    for face in faces:
        i, j, k = face
        # Compute cotangent weights for each edge
        v_i, v_j, v_k = vertices[i], vertices[j], vertices[k]
        
        # Edge vectors
        e_ij = v_j - v_i
        e_ik = v_k - v_i
        e_jk = v_k - v_j
        e_ji = -e_ij
        e_ki = -e_ik
        e_kj = -e_jk
        
        # Cotangents
        cot_i = np.dot(e_ij, e_ik) / np.linalg.norm(np.cross(e_ij, e_ik))
        cot_j = np.dot(e_ji, e_jk) / np.linalg.norm(np.cross(e_ji, e_jk))
        cot_k = np.dot(e_ki, e_kj) / np.linalg.norm(np.cross(e_ki, e_kj))
        
        # Update Laplacian
        L[i, j] -= cot_k / 2
        L[i, k] -= cot_j / 2
        L[j, i] -= cot_k / 2
        L[j, k] -= cot_i / 2
        L[k, i] -= cot_j / 2
        L[k, j] -= cot_i / 2
        
        L[i, i] += (cot_j + cot_k) / 2
        L[j, j] += (cot_i + cot_k) / 2
        L[k, k] += (cot_i + cot_j) / 2
    
    return L

Step 3: Source Reconstruction with GBF

Reconstruct neural sources as linear combinations of geometric basis functions.

class GBFSourceImaging:
    """
    EEG/MEG source imaging using Geometric Basis Functions.
    """
    
    def __init__(self, gbf, forward_model, lambda_reg=0.01):
        """
        Initialize GBF source imaging.
        
        Args:
            gbf: Geometric basis functions [N_vertices, n_modes]
            forward_model: Lead field matrix [N_sensors, N_vertices]
            lambda_reg: Regularization parameter
        """
        self.gbf = gbf
        self.n_modes = gbf.shape[1]
        
        # Projected forward model: A = forward @ gbf
        self.A = forward_model @ gbf  # [N_sensors, n_modes]
        self.lambda_reg = lambda_reg
        
    def reconstruct_sources(self, eeg_data):
        """
        Reconstruct neural source activity from EEG/MEG data.
        
        Args:
            eeg_data: Sensor data [N_sensors, N_times]
        
        Returns:
            source_activity: Source activity on cortical surface [N_vertices, N_times]
            mode_activity: Mode coefficients [n_modes, N_times]
        """
        n_times = eeg_data.shape[1]
        
        # Solve for mode coefficients: argmin ||A @ c - y||^2 + lambda ||c||^2
        # Using ridge regression
        AtA = self.A.T @ self.A
        AtA_reg = AtA + self.lambda_reg * np.eye(self.n_modes)
        
        mode_activity = np.linalg.solve(AtA_reg, self.A.T @ eeg_data)
        
        # Project back to cortical surface
        source_activity = self.gbf @ mode_activity
        
        return source_activity, mode_activity

Key Features

Feature Description Benefit
Participant-Specific Individual cortical geometry Personalized precision
Geometric Constraint Eigenmodes align with anatomy Biologically plausible
Compact Representation Hundreds of modes vs. thousands of vertices Efficient computation
High Localization Accurate spatial source localization Better neuroscience insights
Fast Dynamics Captures spatiotemporal patterns Temporal resolution preserved
Anatomical Pathways Consistent with white matter tracts Validated connectivity

Validation

The framework is validated across multiple paradigms:

  • Meta-Source Benchmark: High localization accuracy
  • Task-Evoked Data: Accurate stimulus-related activity
  • Resting-State Networks: Captures spontaneous dynamics
  • Intracranial Stimulation: Ground-truth validation
  • Epilepsy Data: Clinical relevance demonstrated

Applications

1. Basic Neuroscience Research

# Study whole-brain dynamics during cognitive tasks
gbf_imaging = GBFSourceImaging(gbf, forward_model)

# Reconstruct task-evoked activity
source_activity, mode_activity = gbf_imaging.reconstruct_sources(eeg_data)

# Analyze mode contributions
top_modes = analyze_mode_contributions(mode_activity, task_onsets)

2. Clinical Applications

# Epileptic focus localization
seizure_sources = gbf_imaging.reconstruct_sources( seizure_eeg)
focal_activity = detect_seizure_onset(seizure_sources)

# Pre-surgical mapping
stimulation_map = validate_with_cortical_stimulation(stimulation_sites)

3. Brain-Computer Interfaces

# Real-time source imaging for BCIs
bci_imager = GBFSourceImaging(gbf, forward_model, lambda_reg=0.001)

while bci_running:
    eeg_chunk = acquire_eeg(n_samples=256)
    sources, _ = bci_imager.reconstruct_sources(eeg_chunk)
    features = extract_source_features(sources)
    command = classifier.predict(features)

Workflow

Complete Pipeline

def gbf_source_imaging_pipeline(subject_id, eeg_file, mri_file):
    """
    Complete GBF source imaging pipeline.
    """
    # Step 1: Load and preprocess data
    raw_eeg = mne.io.read_raw_fif(eeg_file)
    raw_eeg.filter(1, 40)  # Bandpass filter
    
    # Step 2: Extract cortical surface
    subjects_dir = os.environ['SUBJECTS_DIR']
    vertices, faces = extract_cortical_surface_from_freesurfer(
        subject_id, subjects_dir
    )
    
    # Step 3: Compute GBF
    gbf, eigenvalues = compute_geometric_basis_functions(
        vertices, faces, n_modes=200
    )
    
    # Step 4: Compute forward model
    fwd = mne.make_forward_solution(
        raw_eeg.info, trans, src, bem, eeg=True, meg=False
    )
    forward_model = fwd['sol']['data']  # Lead field
    
    # Step 5: Create source imager
    gbf_imaging = GBFSourceImaging(gbf, forward_model)
    
    # Step 6: Reconstruct sources
    epochs = mne.Epochs(raw_eeg, events, event_id, tmin=-0.2, tmax=0.5)
    evoked = epochs.average()
    
    source_activity, mode_activity = gbf_imaging.reconstruct_sources(
        evoked.data
    )
    
    return source_activity, mode_activity, gbf

Comparison with Traditional Methods

Method Spatial Resolution Anatomical Plausibility Computational Efficiency Individual Variability
Minimum Norm Low Low High Not addressed
LORETA Moderate Moderate Moderate Not addressed
Beamformer Moderate Low Moderate Partial
GBF (Ours) High High High Fully Addressed

Implementation Notes

Dependencies

pip install numpy scipy mne nibabel
# Optional: FreeSurfer for surface reconstruction

Computational Considerations

  • GBF Computation: ~1-2 minutes per subject (one-time)
  • Source Reconstruction: Real-time capable (>100 Hz)
  • Memory: 500MB for 200 modes on dense surface (150k vertices)

Hyperparameters

Parameter Default Description
n_modes 200 Number of geometric basis functions
lambda_reg 0.01 Ridge regression regularization
surface_density 'ico5' Cortical surface density

Limitations

  1. Surface-Based: Does not model deep brain structures
  2. Linear Assumption: Assumes linear mixing of sources
  3. Stationary Forward Model: Does not account for head movement
  4. Computational Cost: GBF computation for dense surfaces

Future Directions

  • Extension to subcortical structures
  • Non-stationary forward modeling
  • Multi-modal fusion (EEG + MEG + fMRI)
  • Deep learning integration for mode selection

References

@article{wang2026geometry,
  title={A geometry aware framework enhances noninvasive mapping of whole human brain dynamics},
  author={Wang, Song and Lou, Kexin and Wei, Chen and Sheng, Zhiyuan and Tang, Jiahao and Peng, Kaining and Shen, Xinke and Mei, Shuhao and Chen, Liang and Gu, Dongfeng and Liu, Quanying},
  journal={arXiv preprint arXiv:2604.25592},
  year={2026}
}

Related Skills

  • brain-dit-fmri-foundation-model: Brain-DiT for fMRI modeling
  • meta-learning-in-context-brain-decoding-v5: Cross-subject brain decoding
  • neural-population-dynamics: Population-level neural dynamics analysis
  • eeg-brain-connectivity-bci: EEG connectivity analysis

Last updated: 2026-04-30 Paper: arXiv:2604.25592

Install via CLI
npx skills add https://github.com/hiyenwong/ai_collection --skill geometric-brain-dynamics-mapping-v3
Repository Details
star Stars 1
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator