1 Introduction

Resting fMRI (rfMRI) is being increasingly used to study brain connectivity and functional organization [2]. It is also used for longitudinal studies of brain development and as a diagnostic biomarker in cross-sectional studies for various neurological and psychological diseases and conditions [12]. Large scale connectivity information derived from fMRI can be used to delineate functional regions [2]. By extension, identification of multiple contiguous areas, each of which exhibits distinct connectivity to the rest of the brain, can be used to define a functional parcellation of the entire cerebral cortex [2, 16].

Since rfMRI data reflect spontaneous brain activity, it is not possible to directly compare signals across subjects [9]. Instead, comparisons make use of connectivity features, typically computed from pairwise correlations of the rfMRI time series between a point of interest and other locations in the brain [6]. For analysis of cerebral cortex, it is common to compute a feature vector at each location on a tessellated representation of the cortex as the correlation from that vertex to all other vertices. This is a very high dimensional feature and often requires dimensionality reduction or down-sampling for use in multi-subject comparisons. An alternative approach for inter-subjects comparisons is to use group independent component analysis (ICA) [5]. Group ICA concatenates rfMRI data from multiple subjects and represents the data as a summation of independent spatial or temporal components. In this way common networks across subjects can be identified.

Here we describe a novel method for inter-subject comparison of fMRI signals in which a transformation is applied that allows direct comparison of time series across subjects. We use the geometry of normalized (zero mean, unit length) time series to represent the rfMRI data as a set of labeled points on the hypersphere. We then conjecture the existence of an orthogonal transformation, which we refer to as BrainSync, that makes the rfMRI from two subjects directly comparable. BrainSync retains the original signal geometry by preserving the pairwise geodesic distances between all pairs of points on the hypersphere while also temporally aligning or synchronizing the two scans. This synchronization results in an approximate matching of the time series at homologous locations across subjects. The synchronized data can then be directly pooled to facilitate large scale studies involving multiple subjects from cross-sectional as well as longitudinal studies. We show applications of BrainSync to rfMRI as well as illustrate how it can be used for task fMRI through an example involving a motor function task.

2 Methods

We assume we have rfMRI and associated structural MRI data for two subjects. Our goal is to synchronize the rfMRI time series between these two subjects, although the method extends directly both to multiple sessions for a single subject or synchronization across multiple subjects. Our analysis below assumes that the rfMRI data has been mapped on to a tessellated representation of the midcortical layer of the cerebral cortex. The cortical surfaces for the two subjects must also be nonrigidly aligned and resampled onto a common mesh, as can be achieved using FreeSurfer [7] or BrainSuite [14].

Denote the cortically mapped rfMRI data for the subjects as matrices X and Y, each of size \(T\times V\), where T represents the number of time points and V is the number of vertices in the cortical mesh. Corresponding columns in X and Y represent the time series at homologous locations in the two brains. The data vectors in each column in X and Y are normalized to have zero mean and unit length.

2.1 Geometry of the rfMRI Signal Space

Since the time series at each vertex are of unit length, we can represent each column of X and Y as a single point on the unit hypersphere \(\mathbb {S}^{T-1}\) of dimension \(T-1\), where T is the number of time samples.

Let \(\varvec{x}\) and \(\varvec{y}\) represent time series from two points in the brain. Then the inner product of \(\varvec{x}\) and \(\varvec{y}\) yields the Pearson correlation \(\rho _{\varvec{x}\varvec{y}}\) between them. Distance on the hypersphere depends only on correlation, so that highly correlated time series will appear as tight clusters of points. Distance between clusters on the hypersphere will reflect the degree of correlation between their respective time series. The inverse cosine of \(\rho _{\varvec{x}\varvec{y}}\) gives the geodesic distance between the points on the hypersphere. The squared Euclidean distance between them is given by \(\Vert \varvec{x}-\varvec{y}\Vert ^{2}=2-2\rho _{\varvec{x}\varvec{y}}\) and so is also solely a function of \(\rho _{\varvec{x}\varvec{y}}\). It follows that if two subjects have similar connectivity patterns to each other, then the clusters and the distance between these clusters will be similar for both subjects. With this picture in mind, we conjecture the existence of an orthogonal transformation (rotation and/or reflection) that will map the data from one subject onto that of the other based on the following well known result [4]:

Proposition 1

Let \(\varvec{x}_{1},\cdots ,\varvec{x}_{V}\) and \(\varvec{y}_{1},\cdots ,\varvec{y}_{V}\) be points in \(\mathbb {R}^{T}\). If \(\Vert \varvec{x}_{i}-\varvec{x}_{j}\Vert =\Vert \varvec{y}_{i}-\varvec{y}_{j}\Vert ,\forall i,j\in \{1,\cdots ,V\}\), then there exists a rigid motion (Ot) such that \(\varvec{x}_{i}=O\varvec{y}_{i}+t,\forall i\in \{1,\cdots ,V\}\).

Since in our case the points are on a hypersphere \(\mathbb {S}^{T-1}\), we can exclude the translation and apply a strict orthogonal transformation. In order to illustrate this concept, we performed the following illustrative experiment using in vivo rfMRI data. We mapped rfMRI data onto the cortical surfaces for a pair of subjects with \(T=1200\) time samples per vertex. For illustrative purposes we need to reduce dimensionality to \(\mathbb {R}^{3}\) so that we can plot the data on the \(\mathbb {S}^{2}\) sphere. We consider data from only three locations: cingulate, motor cortex and visual cortex. We projected this data onto the \(\mathbb {R}^{3}\) subspace corresponding to the three largest singular values in the data matrix and renormalized to unit length. This data is of sufficiently low rank that we can indeed see the clustering of points on the sphere (Fig. 1a and b). Figure 1c shows the result of applying the BrainSync orthogonal transformation described below to the data from subject 2 and then applying the same dimensionality reduction as previously applied to subject 1. The data for subject 2 is now very similar to that of subject 1, consistent with our earlier conjecture.

Fig. 1.
figure 1

Illustration of the BrainSync concept: (a), (b): data from cingulate (red), motor (green) and visual (blue) cortex for two subjects after dimensionality reduction to \(\mathbb {R}^3\); (c) data from subject 2 synchronization to subject 1 followed by dimensionality reduction identical to that for subject 1 in (a).

2.2 A Method for Temporal Synchronization

The orthogonal transform \(O^{s}\) to synchronize the two data sets, X and Y, is chosen to minimize the overall squared error: \(O^{s}=\arg \min _{O\in O(T)}\Vert X-OY\Vert ^{2}\) where O(T) represents the group of \(T\times T\) orthogonal matrices. Given the high dimensionality of the surface vertices (\(V\simeq 32,000\)) relative to number of time samples (\(T\simeq 1,200\)) in the data analyzed below, the problem is well-posed and can be solved using the Kabsch algorithm [10]. Following the derivation in [15], we first form the \(T\times T\) cross-correlation matrix \(XY^{t}\) and compute its SVD: \(XY^{t}=U\Sigma V^{t}\). The optimal orthogonal matrix is then given by \(O^{s}=UV^{t}\).

To illustrate the behavior of BrainSync we applied this orthogonal transformation to data from a pair of rfMRI data sets from the HCP database described and explored more extensively below. Figure 2 shows an example of the time series before and after BrainSync for the same vertex for the two subjects.

Fig. 2.
figure 2

Representative time series for two subjects for a single cortical location before and after synchronization from subject 2 to subject 1.

3 Applications, Experiments and Results

3.1 Data

We used the minimally preprocessed (ICA-FIX denoised) resting fMRI data from 40 unrelated subjects, which are publicly available from the Human Connectome Project (HCP) [8]. In addition to this processing, we also applied the temporal non-local means (tNLM) filter [3] to improve SNR. Finally, we normalized the filtered resting fMRI time series at each vertex to zero mean and unit length.

3.2 Application 1: Quantifying Variability of RfMRI Across a Population

To compute within subject variability, we computed the correlation at each vertex between two sessions in the same subject after synchronization and averaged the result over all 40 subjects, Fig. 3a. To compute between subject variability, we performed pairwise synchronization for all \(40 \atopwithdelims ()2\) pairs. We then computed the between-subject correlations at each vertex after synchronization, averaged over all pairs and plotted the result as the map shown in Fig. 3b. Within-subject variability across sessions reveals that most of the brain exhibits repeatable patterns of correlation, which leads to accurate syncing. Examples of areas with lower correlation include limbic cortex, anterior temporal pole, insula and medial frontal cortex, possibly due to lower signal amplitudes from these regions. Across subject correlations are lower than within subject correlations. This is expected as individual variability will lead to differences in correlation patterns across subjects. Nevertheless, the regions showing higher correlations are similar to those found within individuals.

Fig. 3.
figure 3

Correlation of Resting fMRI and BrainSync: (a) across two sessions for the same subject, averaged over 40 subjects; (b) between subjects averaged over all pairs and two sessions.

3.3 Application 2: Cortical Parcellation

Parcellations of the human cerebral cortex representing cyto-, myelo- or chemo-architecture are helpful in understanding the structural and function organization of the brain [1, 17]. Resting fMRI has been used for identification of contiguous areas of cortex that exhibit similar functional connectivity to define a functional parcellation [2, 16]. One major problem in using rfMRI for single subject parcellation is that the amount of data from a single subject is usually not sufficient to reliably parcellate the cerebral cortex brain into a large number of regions [2, 13]. Since BrainSync makes data across subjects directly comparable, this synchronized data can be easily pooled and a joint parcellation of a large number of subjects is possible.

We synchronized all the subject data to a single reference brain and pooled the data from 40 subjects \(\times \) 2 sessions. Let \(B_{i,j}\) represent the \(T\times V\) data matrix for the \(i^{th}\) subject and \(j^{th}\) scan, all synchronized to the first subject’s first scan. The concatenated data matrix is then \(B=[B_{1,1},B_{2,1},\cdots ,B_{40,1},B_{1,2},\cdots ,B_{40,2}]\). The k-means algorithm was then applied to this data to generate simultaneous parcellation into k = 100 regions of all the \(40\times 2\) brain scans. Note that we do not enforce any spatial prior or topological constraint on the data. Sample parcellations for two subjects, two sessions each, are shown in Fig. 4 for individual clustering and joint (BrainSync) clustering. For visualization of the individual clustering results, we used the Hungarian algorithm [11] for label matching across subjects. For joint clustering, corresponding regions are automatically identified through k-means clustering and no re-labelling is required.

To quantify performance, we computed the Adjusted Rand Index (ARI) between all pairs of subjects and scans and report both within-subject and across-subject similarity by averaging across subjects and sessions respectively. ARIs were computed for both the individual and group parcellation.

Fig. 4.
figure 4

Representative individual parcellation results (\(k=100\)) for two subjects, two sessions each. Upper row: each brain parcellated separately; lower row: joint parcellation using the synchronized time series.

As expected, individual clustering results for \(k=100\) parcels are very variable across both sessions and subjects, Fig. 4, because of the limited information in a single 15 min rfMRI scan. After synchronization, results appear far more consistent across sessions. They also appear more coherent across subjects, although, unsurprisingly less so than the within-subject comparisons. Table 1 shows that the ARI is substantially higher for synchronized joint clustering vs. individual clustering. Table 1 also shows significantly higher across session similarity than across subjects.

Table 1. Adjusted rand indices: mean(std) for different number of classes (k) for individual (Orig) and group (Sync) parcellation.

3.4 Applications to Task fMRI

Predicting Timing Information. To further analyze the performance of BrainSync, we considered two sessions of a block motor task for a single subject. These two sessions involved identical motor tasks but the timing blocks were different. The first session was synchronized to the second and the resulting orthogonal transformation \(O^{s}\) was applied to the \(T \times 1\) time series that defines the timing blocks for the first session. As shown in Fig. 5(a), \(O^{s}\) allows us to predict the task timing of the second session from the first session.

Fig. 5.
figure 5

Task data (a) Red: timing blocks for session 1, black: timing blocks for session 2 and blue: timing for session 1 after applying the orthogonal transformation predicted by BrainSync to timing blocks for (left) tongue and (right) right hand motor tasks. (b) Correlation between resting and synchronized motor tongue task time series. Strong correlation between task and resting fMRI can be seen throughout the brain other than in primary motor and default mode regions where we expect maximum dissimilarity between brain activity during motor and rest states.

Contrasting Task vs Rest. We also use BrainSync to directly compare resting and motor activity. For this purpose we considered motor activity (self-paced tongue movement) and resting data from the HCP database for a single subject. The resting and task data were synchronized using BrainSync. At each point on the brain, the correlation between synced task and resting data was computed (Fig. 5(b)). Results shown in Fig. 5(b) indicate that despite the fact that we are comparing task and resting data, much of the brain can still be synchronized. Exceptions include the facial primary motor cortex area and portions of the default mode network. This observation is consistent with the fact that we would expect increased motor activity and decreased default mode activity during the motor task. This result shows promise for the use of BrainSync to compare brain activity between different states in a manner that accounts for ongoing (spontaneous) brain activity in both conditions.

4 Discussion and Conclusion

We have described a novel method for synchronization of rfMRI data across subjects and scans. By exploiting similarity in correlation structure across subjects we are able to transform the time series so that they become highly correlated across subjects. This synchronization process bears some similarity to image registration, in the sense that after synchronization comparisons can be made directly with respect to these time series across subjects. Importantly, since the transformation is orthogonal, correlations in the original data are preserved and the transform is invertible. BrainSync is fast, requiring 10secs on a laptop and has the complexity \(O(T^3) + O(T^2V)\) due to SVD and matrix multiplication. One of the implicit assumptions in this work is that the rfMRI signal is stationary in the sense that correlation patterns are preserved over time. Our results show good correspondence of signals over the 15 min windows used in this analysis. However, even within a 15 min period we would expect to see variations in the activity of different networks, and it would be interesting to explore whether BrainSync is able to enhance our ability to identify and characterize these dynamic changes in network activity. As far as we know, this is the first paper to describe the possibility of inter-subject synchronization for both resting and task fMRI. BrainSync can simplify and improve the performance of group studies (e.g. we show variance across subjects, within subject, group parcellation (Sects. 3.2 and 3.3); as well as enable us to answer new questions (e.g. dynamical functional connectivity, recovering timing and task related regions (Sect. 3.4)). For task fMRI there are cases when the stimulus Answers to Queries is not available (e.g. self-paced cognitive tasks) where BrainSync can be helpful. BrainSync also has potential applications for group analysis, dynamical connectivity, and timing correction.