This repository implements a graph signal processing (GSP) approach for analyzing brain connectivity patterns derived from resting-state fMRI data. The methodology applies spectral decomposition techniques to structural brain networks, enabling dimensionality reduction from high-dimensional connectivity matrices to interpretable graph frequency representations.
- Classification accuracy: 67% (N=88 subjects)
- Dimensionality reduction: 79,800 features → 20 spectral bands
- Dataset: Human Connectome Project (HCP) resting-state fMRI
- Parcellation: Schaefer 400-region atlas
The analysis pipeline consists of the following stages:
- Brain Parcellation: Time series extraction using the Schaefer 400-region cortical atlas
- Connectivity Estimation: Pearson correlation matrices computed from regional time series
- Graph Construction: Correlation matrices thresholded and converted to adjacency matrices
- Spectral Decomposition: Normalized graph Laplacian eigendecomposition
- Feature Engineering: Projection of connectivity patterns onto 20 spectral frequency bands
- Classification: Machine learning applied to spectral features
The 20-band spectral representation captures network topology at multiple scales:
- Low frequencies: Global network structure and large-scale communities
- Mid frequencies: Intermediate connectivity patterns
- High frequencies: Local neighborhood structure and fine-grained variations
.
├── data/ # Data directory (not included in repository)
├── src/ # Source code
│ ├── preprocessing.py # fMRI preprocessing and parcellation
│ ├── connectivity.py # Connectivity matrix computation
│ ├── graph_laplacian.py # Laplacian construction and decomposition
│ ├── spectral_features.py # Spectral band feature extraction
│ └── classification.py # ML classification pipeline
├── notebooks/ # Jupyter notebooks for analysis
├── results/ # Output directory for results
├── requirements.txt # Python dependencies
└── README.md # This file
- Python 3.8 or higher
- pip package manager
Clone the repository:
git clone https://github.com/yourusername/brain-gsp-analysis.git
cd fMRI-Spectral-GSPInstall required packages:
pip install -r requirements.txt- numpy >= 1.21.0
- scipy >= 1.7.0
- scikit-learn >= 1.0.0
- nibabel >= 3.2.0
- nilearn >= 0.9.0
- pandas >= 1.3.0
- matplotlib >= 3.4.0
Download the HCP resting-state fMRI data from the Human Connectome Project website. Organize the data according to the following structure:
data/
├── sub-001/
│ └── func/
│ └── sub-001_task-rest_bold.nii.gz
├── sub-002/
│ └── func/
│ └── sub-002_task-rest_bold.nii.gz
...
Execute the complete pipeline:
python src/run_pipeline.py --data_dir ./data --output_dir ./resultsFor granular control, run individual analysis stages:
# Extract time series using Schaefer 400 atlas
python src/preprocessing.py --input ./data --output ./processed
# Compute connectivity matrices
python src/connectivity.py --input ./processed --output ./connectivity
# Perform spectral decomposition
python src/graph_laplacian.py --input ./connectivity --output ./spectral
# Extract 20-band features
python src/spectral_features.py --input ./spectral --output ./features --n_bands 20
# Run classification
python src/classification.py --input ./features --output ./resultsThe normalized graph Laplacian is computed as:
L = I - D^(-1/2) A D^(-1/2)
where:
- A is the adjacency matrix (thresholded correlation matrix)
- D is the degree matrix
- I is the identity matrix
Eigendecomposition of the Laplacian yields:
L = U Λ U^T
where:
- U contains the graph Fourier basis (eigenvectors)
- Λ is a diagonal matrix of eigenvalues (graph frequencies)
For each subject's connectivity matrix C, the spectral features are computed by:
- Projecting C onto each eigenvector u_k: f_k = u_k^T C u_k
- Binning eigenvalues into 20 frequency bands
- Aggregating projections within each band (mean or sum)
This produces a 20-dimensional feature vector per subject.
The 67% classification accuracy demonstrates that spectral graph features capture meaningful individual differences in brain connectivity. The dramatic dimensionality reduction (from 79,800 to 20 features) suggests that brain networks exhibit low-dimensional structure in the spectral domain.
Data were provided by the Human Connectome Project, WU-Minn Consortium (Principal Investigators: David Van Essen and Kamil Ugurbil; 1U54MH091657) funded by the 16 NIH Institutes and Centers that support the NIH Blueprint for Neuroscience Research; and by the McDonnell Center for Systems Neuroscience at Washington University.
Van Essen DC, Smith SM, Barch DM, Behrens TEJ, Yacoub E, Ugurbil K (2013). The WU-Minn Human Connectome Project: An overview. NeuroImage 80:62-79.
-
Ortega, A., Frossard, P., Kovačević, J., Moura, J. M., & Vandergheynst, P. (2018). Graph signal processing: Overview, challenges, and applications. Proceedings of the IEEE, 106(5), 808-828.
-
Shuman, D. I., Narang, S. K., Frossard, P., Ortega, A., & Vandergheynst, P. (2013). The emerging field of signal processing on graphs: Extending high-dimensional data analysis to networks and other irregular domains. IEEE Signal Processing Magazine, 30(3), 83-98.
-
Schaefer, A., Kong, R., Gordon, E. M., Laumann, T. O., Zuo, X. N., Holmes, A. J., ... & Yeo, B. T. (2018). Local-global parcellation of the human cerebral cortex from intrinsic functional connectivity MRI. Cerebral Cortex, 28(9), 3095-3114.
-
Huang, W., Bolton, T. A., Medaglia, J. D., Bassett, D. S., Ribeiro, A., & Van De Ville, D. (2018). A graph signal processing perspective on functional brain imaging. Proceedings of the IEEE, 106(5), 868-885.
Contributions are welcome. Please open an issue to discuss proposed changes before submitting a pull request.
This project is licensed under the MIT License. See below for details.
MIT License
Copyright (c) 2025 [Pavel Stepanov/University of Miami]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
For questions or collaboration inquiries, please open an issue in this repository.
This work builds upon foundational research in graph signal processing and neuroimaging analysis. We acknowledge the Human Connectome Project for providing the neuroimaging data used in this study.