Align brains through regional age patterns - Find your brain twins
NeuroAlign extends traditional brain age prediction to the regional level, creating rich embedding spaces that capture nuanced patterns of brain aging. By representing each participant as a vector of regional Brain Age Gap (BAG) values, we can:
- Find similar brains using nearest-neighbor retrieval
- Interpret aging patterns with LLM-powered analysis
- Visualize brain similarity through interactive 3D visualizations
- Link brain structure to behavior via questionnaire data integration
MRI Scans (Anatomical + Diffusion)
↓
Regional Feature Extraction (GM, WM, Microstructure)
↓
Multi-Modal Brain Age Prediction
↓
Regional BAG Computation (predicted - actual age per region)
↓
Embedding Space (participants as BAG vectors)
↓
Similarity Retrieval (find nearest neighbors)
↓
LLM Interpretation ("Brains like yours belong to people who...")
↓
Interactive Web Demo
# Clone the repository
git clone https://github.com/yourusername/neuroalign.git
cd neuroalign
# Install with uv (recommended)
uv sync --all-extras
# Or with pip
pip install -e ".[all]"# Copy environment template
cp .env.example .env
# Edit .env with your paths
nano .env# Train regional BAG models
python -m scripts.train_regional_bag
# Build FAISS retrieval index
python -m scripts.build_retrieval_index
# Launch web app
python -m app.main- N = ~3,500 participants
- Modalities: Structural MRI (T1w), Diffusion MRI
- Features:
- Gray matter volume (parcellated)
- Cortical thickness
- White matter microstructure (MD, RD, FA, NODDI derivatives)
- Atlas: 4S456Parcels (456 brain regions)
- Questionnaire data: Integrated behavioral/cognitive assessments
neuroalign/
├── src/neuroalign/ # Main package
│ ├── data/
│ │ ├── loaders/ # Modality-specific data loaders
│ │ └── preprocessing/ # Feature extraction & normalization
│ ├── modeling/ # BAG prediction models
│ ├── embedding/ # Embedding space operations
│ ├── retrieval/ # Nearest neighbor search
│ ├── visualization/ # Plotting utilities
│ ├── agent/ # LLM interpretation
│ └── utils/ # Helper functions
├── notebooks/ # Analysis notebooks
├── app/ # React web application
├── scripts/ # CLI scripts
├── tests/ # Unit tests
├── data/ # Data documentation
├── models/ # Saved models
└── docs/ # Documentation
- Parcellate whole-brain images using 4S456Parcels atlas
- Extract regional summaries per modality
- Normalize features
- Train separate models per region and modality
- Compare Ridge, XGBoost, and MLP approaches
- Nested cross-validation for hyperparameter tuning
BAG[region, modality] = predicted_age[region, modality] - chronological_age- Build FAISS index for fast nearest-neighbor search
- Retrieve top-k most similar participants
- Extract questionnaire profiles of similar participants
- Generate natural language insights with Claude
The interactive web application allows users to:
- Upload MRI data or select pre-computed examples
- View regional BAG profile on a 3D brain
- Explore the embedding space
- Discover their "brain twins"
- Read AI-generated interpretations
Tech Stack: React, FastAPI, Plotly, Claude API
# Install dev dependencies
uv sync --all-extras
# Run tests
pytest
# Format code
black src/ tests/ scripts/
# Lint
ruff check src/
# Type check
mypy src/@software{neuroalign,
author = {Your Name},
title = {NeuroAlign: Regional Brain Age Alignment for Similarity Analysis},
year = {2025},
url = {https://github.com/yourusername/neuroalign}
}MIT License - see LICENSE file for details.
- Neuroimaging: CAT12, QSIPrep, FreeSurfer
- Parcellation: Custom
parcellatepackage - LLM: Anthropic Claude
- Retrieval: FAISS (Meta AI)
Your Name - your.email@example.com
Project Link: https://github.com/yourusername/neuroalign