1 Introduction

Group structural and functional studies of brain imaging data require registration across a population in order to draw inferences at finer scales. For studies involving the cerebral cortex it is often sufficient to perform this registration with respect to a 2D parameterization of the cortical surface. Most cortical surface registration methods are guided either by sulcal and gyral landmarks or curvature maps that reflect cortical folding [1, 2]. The resulting registrations are appropriate for quantifying structural characteristics across populations, but there is ample evidence that regions of functional specialization are not accurately aligned across subjects using only anatomical landmarks [3]. Poor alignment can result in reduced statistical power when regions of functional activation do not accurately align. The common practice of spatial smoothing can overcome this problem to some degree, but limits our ability to localize and detect effects at finer scales. Functional regions can be better identified or aligned using a series of functional localizers as is common in fMRI studies of the visual system [4]. But this task-driven approach is limited by the number of regions that can be mapped in each subject using a discrete set of tasks. A more general approach uses data from subjects watching a movie to drive alignment of the entire cerebral cortex [5]. Another alternative is to use resting fMRI (rfMRI) data. While there is evidence for involvement of a large fraction of cerebral cortex in resting activity, using rfMRI for intersubject alignment presents a challenge because resting time-series cannot be directly compared across subjects as is the case for task fMRI.

A recent series of papers have used the concept of hyperalignment to better align functional data across subjects [6]. The main idea is to use a linear transformation on the data from each subject to maximize the similarity of response profiles in a set of task data. This can be viewed as a method for spatial alignment that does not enforce any topological restrictions on the spatial mapping but instead uses linear combinations of the data from a local neighborhood to produce a spatial inter-subject correspondence. Here we explore an alternative to this approach in which we use a topologically-constrained nonrigid deformation of the cortical surfaces to perform inter-subject registration. An alternative recent method also used rfMRI data for this purpose [7]. In that case, z-score maps derived from ICA analysis of the functional activations were used to perform group-wise cortical surface registration. Spectral features derived from fMRI connectivity matrices have also been used for driving cortical registration [5, 8].

An orthogonal transform termed BrainSync performs synchronization of time-series across subjects at homologous locations in the brain [9]. The transform exploits the correlation structure common across subjects to perform the synchronization. When synchronized, rfMRI signals become approximately equal at homologous locations across subjects. The BrainSync transform is lossless and preserves correlation structures. As a result of synchronization we can directly compare time series across subjects. We can then use the aligned time series themselves as a feature to induce functional correspondence through nonrigid registration of the surfaces. This new approach to functional alignment is described here. Starting with the anatomically registered cortical surfaces, each cortical hemispheres is first mapped to a unit square flat map. The rfMRI data are then mapped to these squares and used as features to coregister across subjects using a modified demons algorithm. The distortion in the flat mapping is compensated for using the metric tensor determinant. The method is evaluated using resting and task data from the HCP project database.

2 Materials and Methods

As input, we assume structural and rfMRI images for each subject. The structural images are preprocessed to generate cortical surface representations and coregistered to a common atlas. The fMRI data are preprocessed using HCPs minimal processing pipeline [10]. They are then mapped to a common atlas using the mapping computed from the structural images. This preprocessing results in structurally coregistered \(V\times T\) data matrices, one per subject, with V vertices in the cortical surface mesh and T time points. We refine this intersubject alignment using the rfMRI by first synchronizing their time-series with BrainSync, and then use these time-series as features in the alignment algorithm.

Flat Mapping and Metric Computation: We generate a flat map of the cortical surface mesh of the atlas to which the fMRI data have been mapped for each subject. A harmonic map is computed on the unit square for each hemisphere such that the inter-hemispheric fissure that divides the two hemispheres is mapped to the boundary of the square and rest of the surface is mapped to its interior. The fMRI data is resampled onto a \(256\,\times 256\) regular grid on the square for each hemisphere using linear interpolation, resulting in a \(256\,\times 256\,\times T\) fMRI data representation. For fast computation, the dimensionality of the dataset was reduced using PCA to 20 (chosen based on rank analysis of the data). The SVD of a reference subject’s \(V\,\times \,T\) fMRI data was used to compute a set of 20 temporal basis functions onto which the subject’s synchronized fMRI data was projected to produce data of size \(256\,\times 256\,\times \,20\). The 3D surface coordinates of the cortical mesh were also resampled to the regular grid and the metric tensor computed using finite differences (Fig. 1).

Fig. 1.
figure 1

(a) Mean curvature shown on the cortical surface and its flat harmonic map to the unit square; (b) the determinant of the metric tensor induced by the flat harmonic map is shown on the cortex and the flat map.

Fig. 2.
figure 2

Flowchart of rfDemons algorithm: the cortical surface is mapped to the unit square. The corresponding synchronized rfMRI datasets for subject and reference are then re-sampled on the square. The deformation field that registers the rfMRI data is computed using the metric-compensated symmetrized demons algorithm. The deformation is then applied to the subject rfMRI data to map it back to the cortical surface mesh.

rfDemons: rfMRI-Based Cortical Registration: We start with BrainSync transformed rfMRI data for two individual datasets, with one designated as the ‘reference’ (or fixed) and the other as the ‘subject’ (or moving). Each is represented on the square atlas map as a \(256\,\times 256\,\times 20\) data matrix.

Let \(F(\mathbf {x}(\tau ),t)\) denote the rfMRI data at the \(t^{\text {th}}\) fMRI time point, at spatial location \(\mathbf {x}\) in the square with \(\mathbf {x}(\tau )\) a set of deformation fields, parameterized by \(\tau \). We define \(F(\mathbf {x}(\tau ),t)\) to be the rfMRI data of the subject when \(\tau =0\) and the subject optimally matched to the reference when \(\tau =1\), so that the subject data are gradually deformed to the reference as \(\tau \) goes from 0 to 1. Since the input rfMRI data is synchronized, we can use an optical flow formulation \(F(\mathbf {x}(\tau ),t)=F(\mathbf {x},t)\) [11], i.e. the data are constant with respect to \(\tau \), and it is possible to match the data from subject to reference with an appropriate deformation map \(\mathbf {x}(1)\). Taking the derivative of F with respect to \(\tau \), we get \(\frac{dF}{d\tau }(\mathbf {x}(\tau ),t)=\nabla _{\mathbf {x}}F(\mathbf {x}(\tau ),t)\cdot v(\mathbf {x})\) where \(v(\mathbf {x})=\frac{d\mathbf {x}(\tau )}{d\tau }\) is the velocity of point \(\mathbf {x}\) and \(\nabla _{\mathbf {x}}\) is the spatial gradient. Our goal is to estimate the velocity \(v(\mathbf {x})\) at each iteration. The solution of this equation can be obtained in the least squares sense over the cortical surface by minimizing the cost

$$\begin{aligned} C(v)=\int \int \left( \nabla _{\mathbf {x}}F(\mathbf {x}(\tau ),t)\cdot v(\mathbf {x})-\frac{dF(\mathbf {x}(\tau ),t)}{d\tau }\right) ^{2}\det \left( g(\mathbf {x})\right) d\mathbf {x}dt \end{aligned}$$
(1)

over v, where \(g(\mathbf {x})\) indicates the surface metric tensor that encodes the distortion from the surface to the square map of the surface (Fig. 1). Since \(g(\mathbf {x})\) is slowly varying spatially compared to F, we can replace the images F by \(F^{g}=\sqrt{\det \left( g(\mathbf {x})\right) }F\). Equation 1 shows that v cannot be uniquely defined, since we only observe the projection of v onto the gradient of F. We therefore select the minimum \(L_{2}\) norm solution for v. In continuous form using variational calculus we solve the system of equations: \(v(\mathbf {x})\int \left\| \nabla F^{g}(\mathbf {x}(\tau ),t)\right\| ^{2}dt=\int \frac{dF^{g}(\mathbf {x}(\tau ),t)}{d\tau }\nabla F^{g}(\mathbf {x}(\tau ),t)dt\) to get

$$\begin{aligned} v(\mathbf {x})=\int \frac{dF^{g}(\mathbf {x}(\tau ),t)}{d\tau }\nabla F^{g}(\mathbf {x}(\tau ),t)dt/\int \left\| \nabla F^{g}(\mathbf {x}(\tau ),t)\right\| ^{2}dt. \end{aligned}$$
(2)

Following [11,12,13], we add the demons force in the denominator for stability when the spatial gradient is small, to obtain:

$$\begin{aligned} v(\mathbf {x})=&\frac{\int \frac{dF^{g}(\mathbf {x}(\tau ),t)}{d\tau }\nabla F^{g}(\mathbf {x}(\tau ),t)dt}{\int \left\| \nabla F^{g}(\mathbf {x}(\tau ),t)\right\| ^{2}dt+\alpha ^{2}\int \left( \frac{dF^{g}(\mathbf {x}(\tau ),t)}{d\tau }\right) ^{2}dt}. \end{aligned}$$

The corresponding discrete version is

$$\begin{aligned} v^{k}(\mathbf {x})=\frac{\sum _{n=1}^{N}(F_{T}^{g}(\mathbf {x},n)-F_{M}^{g}\circ T^{k}(\mathbf {x}))\cdot \nabla F_{T}^{g}(\mathbf {x},n)}{\sum _{n}||\nabla F_{T}^{g}(\mathbf {x})||^{2}+\alpha ^{2}\sum _{n}(F_{T}^{g}(\mathbf {x})-F_{M}^{g}\circ T^{k}(\mathbf {x}))^{2}}, \end{aligned}$$
(3)

where n is the fMRI time point and \(\circ \) represents the composition operator. \(F_{T}\) is the target image and \(F_{M}\) the moving image, \(T^{k}(\mathbf {x})\) is the deformation at the \(k^{\text {th}}\) iteration. The hyperparameter \(\alpha \) controls for stability and, following [11], it can be shown that the displacement in Eq. 3 is bounded by \(1/2\alpha \).

We will consider the symmetric version similar to that proposed in [14]:

$$\begin{aligned} v^{k}(\mathbf {x})&=\frac{\sum _{n}(F_{T}^{g}(\mathbf {x},n)-F_{M}^{g}\circ T^{k}(\mathbf {x}))\cdot \nabla F_{T}^{g}(\mathbf {x},n)}{\sum _{n}||\nabla F_{T}^{g}(\mathbf {x},n)||^{2}+\alpha ^{2}\sum _{n}(F_{T}^{g}(\mathbf {x},n)-F_{M}^{g}\circ T^{k}(\mathbf {x}))^{2}}\\ +&\frac{\sum _{n}(F_{T}^{g}(\mathbf {x},n)-F_{M}^{g}\circ T^{k}(\mathbf {x},n))\cdot \nabla F_{M}^{g}(\mathbf {x},n)}{\sum _{n=1}^{N}||\nabla F_{M}^{g}(\mathbf {x},n)||^{2}+\alpha ^{2}\sum _{n=1}^{N}(F_{T}^{g}(\mathbf {x},n)-F_{M}^{g}\circ T^{k}(\mathbf {x}))^{2}} \end{aligned}$$

that leads to an approximately inverse consistent deformation field. The steps of velocity estimation \(v(\mathbf {x})\), accumulation to the deformation field (\(T^{k+1}(\mathbf {x})\leftarrow T^{k}(\mathbf {x})+v^{k}(\mathbf {x})\)), and warping the subject’s rfMRI data using this deformation \(T(\mathbf {x})\), are iterated until the norm of the velocity becomes small (e.g. \(10^{-6}\)th of a pixel). A flowchart for the rfDemons method is shown in Fig. 2. The execution time for the HCP datasets used below (32K per hemisphere cortical mesh density, 1200 time samples) is 3–4 min on a typical workstation (Pentium V, 16 GB RAM) with a minimum memory requirement of 4 GB. The relatively light computational load of the algorithm is due to the fact that we perform the registration in the flat square space instead of on the sphere (as in spherical demons [8]). Since we compensate for the metric tensor corresponding to the flat map, we minimize regional biases in deformation fields that would otherwise result from metric distortion in the cortical surface maps.

3 Validation and Results

Data: We used minimally preprocessed (ICA-FIX denoised) resting and task fMRI data from 40 independent subjects (all right handed, age 26–30, 16 male and 24 female), which are publicly available from the Human Connectome Project (HCP) [10, 15]. We used data that was acquired in two independent resting fMRI sessions (with same LR phase encoding) of 15 min each (TR = 720 ms, TE = 33.1 ms, 2 mm\(\,\times \,\)2 mm\(\,\times \,\)2 mm voxels) with the subjects asked to relax and fixate on a projected bright cross-hair on a dark background.

Fig. 3.
figure 3

Magnitude of the rfDemons deformation fields for two subjects, two sessions each. Note the cross-session consistency in the deformation fields for each subject.

Intra-subject and Inter-subject Consistency: For the first study, we coregistered two independent sessions of the same subject to a reference and checked for differences in the resulting deformation fields. If individual differences between cortical anatomy and functional specialization, as reflected in the rfMRI signal, are indeed driving the deformation then we would expect to see similar deformations for two sessions of the same subject. Similarly, we would expect to see differences in these deformation fields for different subjects. In other words, the inter-subject variance should be much larger than the intra-subject variance. To explore this issue, the deformations from the unit square were mapped back to the original surface with metric compensation to represent the true deformations on the cortical surface. Our expectations are confirmed anecdotally in Fig. 3 which shows the magnitudes of these deformations for two sessions each for two subjects. Within subject deformations are very similar, but they differ markedly across subjects. Cross-subject and cross-session differences were further quantified by computing the standard deviations of the deformation difference across sessions for each subject and averaged over subjects (Fig. 4(a)), and also the standard deviation of the deformation differences across subjects, averaged over sessions for all subjects (Fig. 4(b)). Again, the cross-subject difference is much larger than within subject cross-session differences. Somatomotor cortex shows low s.d. of deformation across subjects indicating that anatomical registration also aligns functionally in this region. This is expected since these areas are well defined by the pre and post central sulci. In contrast, the visual areas show much larger inter-subject variability. Again, this is consistent with the known variability of visual functional areas with respect to cortical anatomy, and the reason that functional localizers are frequently used in these areas. The within-subject cross-session maps indicates generally low variability with the exception of areas V1-V4. Performance in this area requires further investigation.

Fig. 4.
figure 4

(a) Intra-subject standard deviation maps for rfDemons; (b) Inter-subject standard deviation maps for rfDemons.

Table 1. Correlations between subject and reference z-scores before (structural) and after (rfDemons) functional alignment. We list the median correlation over subjects and interquartile distance together with computed p-values.

Task-Data Mapping: We also used task fMRI data to validate the results of rfDemons registration. We considered z-score maps for the emotion, gambling, language, motor, relational and social tasks in the HCP dataset [15]. In order to validate the cortical alignment obtained from the rfMRI data, we computed the mapping between the subject and reference rfMRI data by rfDemons and applied the resulting deformation map to the z-score maps from the task fMRI data. Our underlying hypothesis is that rfMRI based registration will improve functional alignment of the cortical surface, which will result in turn in better alignment across subjects of the z-score maps from the task data. To perform this comparison, for each task we computed the correlation between the z-score maps for each individual and the reference before and after functional alignment. Median and interquartile values are listed in Table 1.

Fig. 5.
figure 5

Number of vertices in the cortical surface mesh above given threshold for the averaged z-score maps over subjects, for the language task (math_story) data before and after rfDemons registration.

The before and after alignment correlations were compared using the Wilcoxon ranksum test (1-sided, paired) of the null hypothesis that the paired difference in the correlations has zero median. A significant increase in the correlation of z-score maps of reference and subjects was observed in all cases as shown in Table 1. This result indicates that the resting-fMRI based rfDemons registration is able to improve inter-subject alignment of functional regions as evoked through a series of tasks. Additionally, we averaged the z-score maps across subjects before and after rfDemons alignment. Regions of significant activity lie in the tails of the distribution of these average z-score maps. The ability to more reliably detect this activation should therefore be reflected in a larger number of spatial locations that are outliers in this distribution. We computed the number of vertices on the cortical surface that exceeded a given z-score threshold, computed as a function of that threshold, in Fig. 5 for the language task (math vs. story contrast). As expected, we see a larger fraction of vertices exceeding the higher thresholds after rfDemons alignment.

4 Discussion and Conclusion

We have described a novel method (rfDemons) for functional alignment of the cerebral cortex using resting fMRI data. Our studies shows a high degree of within-subject consistency through most of the cortex except in the visual cortex. This latter observation may limit applicability in visual cortex, although the problem could be addressed using data from a combination of resting and visual stimulation. Between subject comparisons indicate a strong spatial dependence on the degree of variability across subjects. Again, this is most pronounced in visual cortex, and is smaller in regions, such as somatomotor cortex, that are known to be well defined by anatomical landmarks. Through application of the rfDemons registration results to task fMRI data we were able to explore whether functional registration improves the alignment of task-evoked activity. Through correlation studies we see small but significant improvement in the correlation of z-score maps between subjects after rfDemons alignment. This improvement is seen over several different contrasts representing multiple different functional tasks. We also saw an increase in the number of vertices in which the group averaged z-score exceeded a given threshold, indicating the potential for increased sensitivity in detecting task-related activity.