Skip to content

pstepanovum/fMRI-Spectral-GSP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brain Connectivity Analysis using Graph Signal Processing

License: MIT Python 3.8+

Overview

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.

Key Results

  • 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

Methodology

The analysis pipeline consists of the following stages:

  1. Brain Parcellation: Time series extraction using the Schaefer 400-region cortical atlas
  2. Connectivity Estimation: Pearson correlation matrices computed from regional time series
  3. Graph Construction: Correlation matrices thresholded and converted to adjacency matrices
  4. Spectral Decomposition: Normalized graph Laplacian eigendecomposition
  5. Feature Engineering: Projection of connectivity patterns onto 20 spectral frequency bands
  6. Classification: Machine learning applied to spectral features

Spectral Band Innovation

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

Repository Structure

.
├── 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

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Setup

Clone the repository:

git clone https://github.com/yourusername/brain-gsp-analysis.git
cd fMRI-Spectral-GSP

Install required packages:

pip install -r requirements.txt

Required Python Packages

  • 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

Usage

Data Preparation

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
...

Running the Analysis

Execute the complete pipeline:

python src/run_pipeline.py --data_dir ./data --output_dir ./results

Step-by-step Execution

For 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 ./results

Technical Details

Graph Laplacian Formulation

The 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

Spectral Decomposition

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)

Feature Vector Construction

For each subject's connectivity matrix C, the spectral features are computed by:

  1. Projecting C onto each eigenvector u_k: f_k = u_k^T C u_k
  2. Binning eigenvalues into 20 frequency bands
  3. Aggregating projections within each band (mean or sum)

This produces a 20-dimensional feature vector per subject.

Results Interpretation

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.

Dataset Citation

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.

References

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Contributing

Contributions are welcome. Please open an issue to discuss proposed changes before submitting a pull request.

License

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.

Contact

For questions or collaboration inquiries, please open an issue in this repository.

Acknowledgments

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.

About

Decoding cognitive states from fMRI brain networks using Spectral Graph Signal Processing (GSP) and High-Resolution Graph Fourier Transforms. Analysis of 88 subjects from the HCP S1200 dataset.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages