Implements advanced hyperalignment methods for functional neuroimaging data with task-informed features. Provides sparse graph-based alignment of functional connectivity patterns across subjects using spectral decomposition and Procrustes alignment. Includes extensions for task-informed alignment, Riemannian geometry operations on SPD manifolds, and voxel-level projection via Nyström extension.
The `hatsa` package implements the Core HATSA (Hybrid Anchor-based Time-Series Alignment) algorithm. This algorithm is designed to align functional connectivity patterns, represented as spectral sketches derived from graph Laplacians, across multiple subjects. It leverages anchor parcels and Generalized Procrustes Analysis for robust alignment, employing sparse matrix operations for computational efficiency.
Core HATSA Algorithm
The primary function is run_hatsa_core
. It processes
subject-specific time-series data and alignment parameters to produce:
Original spectral sketches for each subject.
Aligned spectral sketches for each subject.
The corresponding rotation matrices (in SO(k)) used for alignment.
The algorithm follows three main stages: 1. **Initial Spectral Sketching (per subject):**
A correlation matrix is computed from the time-series.
This graph is sparsified based on strongest positive/negative connections per parcel.
The sparsified graph is symmetrized using a weighted averaging scheme.
Non-zero edge weights of the symmetrized graph are z-scored, ensuring symmetry is preserved.
A sparse graph Laplacian (`L = D - W`) is constructed.
The `k` eigenvectors corresponding to the smallest, non-zero eigenvalues of `L` form the subject's original spectral sketch. Eigenvectors for eigenvalues numerically close to zero are discarded. This step uses efficient methods for sparse matrices.
2. **Iterative Refinement (Generalized Procrustes Analysis - GPA):**
Rows corresponding to pre-defined anchor parcels are extracted from each subject's original spectral sketch.
A group anchor template is initialized (typically as the mean of subjects' anchor sketches).
Iteratively:
Subject-specific orthogonal rotation matrices (`R_i SO(k)`) are computed to best align each subject's anchor sketch to the current group template (Orthogonal Procrustes Problem).
The group anchor template is updated as the mean of the subjects' rotated anchor sketches.
3. **Apply Final Rotations:**
The final rotation matrices from the GPA are applied to each subject's full original spectral sketch to obtain the aligned spectral sketches.
Author
Maintainer: Brad Buchsbaum brad.buchsbaum@gmail.com