bioRxiv preprint doi: https://doi.org/10.1101/810796; this version posted October 18, 2019. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license.

ANATOMICALLY INFORMED BAYESIAN SPATIAL PRIORS FOR FMRI ANALYSIS

David Abramian?†, Per Siden´ ‡, Hans Knutsson?†, Mattias Villani‡↑, Anders Eklund?†‡

? Division of Medical Informatics, Department of Biomedical Engineering † Center for Medical Image Science and Visualization (CMIV) ‡ Division of Statistics & Machine learning, Department of Computer and Information Science Linkoping¨ University, Linkoping,¨ Sweden ↑ Department of Statistics, Stockholm University, Stockholm, Sweden

ABSTRACT 2. METHODS Existing Bayesian spatial priors for functional magnetic reso- nance imaging (fMRI) data correspond to stationary isotropic 2.1. Bayesian spatial GLM smoothing filters that may oversmooth at anatomical bound- The most common way to model fMRI data is as a voxel- aries. We propose two anatomically informed Bayesian spa- wise general linear model with serial correlations in the resid- tial models for fMRI data with local smoothing in each voxel uals, which are modeled as an AR(p) process. This combined based on a field estimated from a T1-weighted anatomi- model is referred to as GLM-AR(p). In the case of single sub- cal image. We show that our anatomically informed Bayesian ject data, with T volumes, N voxels, K regressors and an AR spatial models results in posterior probability maps that fol- model of order p, this model is written as low the anatomical structure. Y = X W + E , Index Terms— Bayesian statistics, functional MRI, acti- [T ×N] [T ×K][K×N] [T ×N] vation mapping, adaptive smoothing E = Ee R + Z , 1. INTRODUCTION [T ×N] [T ×P ][P ×N] [T ×N] where Y is the observation , X is the design matrix, The analysis of functional magnetic resonance imaging W is the regressor matrix and E is the residual matrix. The (fMRI) data has generally relied on frequentist statistics to residual matrix E is itself expressed as the product of a lagged perform inferences about brain activity. After fitting a gen- prediction error matrix Ee with an AR coefficient matrix R eral linear model (GLM) to the individual voxel time series, plus a matrix of i.i.d. zero mean Gaussian errors Z, where t-values are calculated for contrasts of interest at every voxel, iid −1 Z·,n ∼ N(0,λn IT ), and λn is the noise precision at voxel resulting in t-maps that can be thresholded at an appropriate n. In this Bayesian framework, smoothness of the regression significance level. Isotropic Gaussian smoothing is the most coefficients enters the model through a spatial precision ma- common way of preprocessing fMRI data, but several adap- trix Dw in their prior distribution, according to tive smoothing approaches for detecting brain activity have 0 −1 −1 been proposed [1, 2, 3, 4, 5, 6, 7]. Wk,· ∼ N 0, αk Dw , During the 2000s, a Bayesian framework for fMRI anal- 0 where Wk,· is the of the k-th row of the regression ysis was developed by Penny et al. [8, 9, 10, 11, 12], which coefficient matrix W, representing the k-th regression coeffi- provided increased flexibility compared to the classical fre- cient at every voxel, and αk is a smoothness hyperparameter quentist approach, by allowing the estimation of individual for the k-th regressor (since the following also applies to the smoothness parameters for each regressor and autoregressive AR coefficients, we refer to their precision matrices generi- ´ (AR) noise coefficient. Siden et al. [13, 14] extended this cally as D). The precision matrix D encodes the conditional work to an efficient Markov Chain Monte Carlo (MCMC) im- dependencies between every pair of voxels. The smoothness plementation which works in 2D as well as 3D. However, we assumption constrains these dependencies to exist only be- are not aware of any work that performs anatomically adap- tween a voxel and its immediate neighbors, which has the ad- tive Bayesian spatial modeling. In this work we propose two vantage of making this matrix very sparse. approaches for performing 2D Bayesian spatial modeling in an anatomically-adaptive way. 2.2. Uniform graph Laplacian precision matrix This work was supported by the Swedish Research Council, grant 2017- 04889, and by the Center for Industrial Information Technology (CENIIT) at Graphs constitute a natural way of describing relationships Linkoping¨ University between sets of elements. Therefore, the precision matrices bioRxiv preprint doi: https://doi.org/10.1101/810796; this version posted October 18, 2019. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license.

employed by Penny et al. and Siden´ et al. take the form of graph Laplacian matrices. In their formulation the pre- cision matrix D is an unweighted graph Laplacian (UGL), where di,i equals the number of pixels neighboring pixel i and di,j = −1 if pixels i, j are cardinal neighbors. For inner pixels this corresponds to the Laplacian operator, which in 2D takes the form  0 −1 0 HUGL = −1 4 −1 . 0 −1 0

Generically, graph Laplacian matrices can be constructed with [15] L = B − A,

where A is an adjacency matrix whose ai,j element, called a weight, represents in this context the strength of the condi- tional dependence between pixels i and j, and B is a diago- P Fig. 1. Local orientation represented using the structure ten- nal degree matrix with bi,i = j ai,j, that is, the sum of all the incoming weights to pixel i. Since B can be constructed sor. Red vectors indicate the main local orientation, while from A, the adjacency matrix is sufficient for generating the green vectors indicate the second (perpendicular) orientation. graph Laplacian. Under this formulation the same UGL prior If no vector is present, there is no orientation information can be constructed by considering its dependency structure available (e.g. due to uniform intensity). (neighborhood), which for inner pixels takes the shape   0 1 0 second eigenvalue indicates the amount of structure in the ori- NUGL = 1 0 1 , entation perpendicular to the first eigenvector. The structure 0 1 0 tensor is, therefore, a flexible model capable or representing structure in zero (noise, uniform data), one (line, edge), or that is, ai,j = 1 if pixels i, j are cardinal neighbors. It can be seen that this results in the same precision matrix D ≡ L. two (crossing lines, crossing edges) orientations (for the 2D Due to the uniform neighborhood shape and constant case). weights between neighbors this type of prior is incapable As fMRI data lacks contrast, the structure tensor is calcu- of encoding anatomical information. Such a prior will not lated from a registered T1-weighted volume. Figure 1 shows respect anatomical tissue boundaries, mixing, for example, the eigenvectors of the structure tensor for a typical brain im- signals from white and gray brain matter. Conversely, in or- age. The tensor is small and isotropic in very uniform re- der for the prior to encode relevant anatomical information it gions, while next to lines or edges it becomes anisotropic and is necessary for the dependencies between neighboring pixels oriented perpendicularly to the line or edge. to be specified independently at each location. 2.4. Spatial model with four orientations 2.3. The structure tensor In our first proposed solution we assign to every pixel one of four oriented neighborhood structures according to the local In order to establish pixel relationships that respect anatomi- structural orientation in that pixel. Such a model offers lim- cal boundaries, we must first estimate the position and orien- ited angular resolution, since only four different orientations tation of these boundaries. Our main tool for achieving this can be represented. However, it simplifies the formulation of is the structure tensor, a tensor estimated at every pixel (using the possible neighborhoods and provides increased sparsity quadrature filters along different directions [16, 17]) whose in the precision matrix D. We refer to this model as 4DIR. eigenvalues and eigenvectors reveal the degree to which spa- We start by considering four possible orientations: horizon- tial structure is present and the orientation of any such struc- tal, vertical, and two diagonals. The corresponding orienta- ture, here understood as lines or edges. A detailed explanation tion vectors are of the estimation and interpretation of structure falls 1 0 d = , d = , outside the scope of this paper, see [18, 16, 19] for a thor- x 0 y 1 ough treatment of this topic. For our purposes it is sufficient to point out that the eigenvector of the structure tensor corre- 1 1 1 −1 dxy = √ , d−xy = √ . sponding to the largest eigenvalue is perpendicular to the main 2 1 2 1 structure orientation at the given pixel, while the eigenvalue is For computational efficiency we want to avoid having to proportional to the degree of certainty of this orientation. The calculate the eigenvectors of the structure tensor. We can find bioRxiv preprint doi: https://doi.org/10.1101/810796; this version posted October 18, 2019. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license.

which of the four orientations is closest to the main tensor ori- entation at each point by first defining tensors corresponding to each of the four orientations T T Tx = dxdx , Ty = dydy ,

T T Txy = dxydxy, T−xy = d−xyd−xy, and then projecting, through an inner product, the structure tensor at each point onto the four orientation tensors. The maximum projection value will correspond to the orientation closest to that of the structure tensors. Having found at each pixel which of the four orientations is closest to that of the structure tensor, we define neighbor- hoods (filters) along each of the four orientations 0 0 0 0 1 0 Fig. 2. Variables involved in weighting of the neighborhoods Nx = 1 0 1 , Ny = 0 0 0 , for the ANYDIR model. The structure tensor is shown in the 0 0 0 0 1 0 middle. 1 0 0 0 0 1 N = 0 0 0 , N = 0 0 0 . xy   −xy   where φ is the angle of the line connecting the central 0 0 1 1 0 0 pixj pixel i with neighboring pixel j, φ is an angle repre- As the structure tensor is aligned across the orientation of tensori senting the main orientation of the structure tensor at pixel lines and edges (see Figure 1), which we are trying to pre- i, r is the distance between pixels i and j (see Figure 2). serve, we associate to each pixel a neighborhood perpendicu- pixj Additionally, α and β are adjustable parameters taking non- lar to the orientation of the structure at that point (e.g. if d is x negative real values, where α controls the width of the distri- the orientation for some pixel, then the appropriate neighbor- bution around φ and β penalizes the values in the di- hood would be N ). tensori y agonal neighbors with respect to the horizontal and vertical Having assigned a specific neighborhood to each pixel, a ones. In this work we use α = 12 and β = 5. new adjacency matrix A can be constructed and used to 4DIR This neighborhood formulation generates neighborhoods define a graph Laplacian D . However, due to the spe- 4DIR that vary continuously with respect to φ , which allows cific process for calculating the orientation at each position, tensori the representation of arbitrary orientations in the structures it cannot be guaranteed that the relationship between a pair around pixels, at the cost of reduced sparsity in the precision of pixels i, j is symmetric, i.e., that a = a , which would i,j j,i matrix. As in the previous case the adjacency matrix A preclude D from being used as a precision matrix. Sym- ANYDIR 4DIR is not guaranteed to be symmetric. The same kind of correc- metry can be enforced by applying the procedure tion can be applied in order to generate a graph Laplacian ma- T 0 A + A trix L suitable for use as a precision matrix DANYDIR. A 0 = 4DIR 4DIR , ANYDIR 4DIR 2 which effectively sets the value of ai,j and aj,i to the average 3. RESULTS of the two. This correction has little effect on the orientations 0 encoded in the graph and allows the new matrix L4DIR to be We compared the results produced by all three precision used as a precision matrix D4DIR. matrices in the context of Bayesian fMRI analysis. We used preprocessed data from subject 100307 of the Hu- 2.5. Spatial model with arbitrary orientations man Connectome Project [20], specifically the T1-weighted volume and the motor task data. The analysis was per- The previously presented model is limited in angular reso- formed slice-by-slice using the SPM package for Matlab lution, as it can only encode four orientations. In order to together with the extension developed by Siden´ et al. [13]. 3 × 3 overcome this limitation we consider a neighborhood The only modification to the code was the addition of the around every pixel and determine the weight for each of the proposed precision matrices. Our modified code can be 8 possible neighbors by sampling from a continuous func- found at (https://github.com/DavidAbramian/ tion at discrete positions corresponding to the centers of the adaptiveBayesianPrior). neighboring pixels. We refer to this model as ANYDIR. The As a preprocessing step, the T -weighted volume was sampled function is 1 downsampled to match the resolution of the fMRI data. This α is necessary, since the precision matrix has to be estimated sin(φpix − φtensor ) j i T ai,j = f(i, j) = , α, β > 0, from the 1-weighted volume and later applied to the fMRI rβ data. pixj PPM of the global mean 0.2% 0.8. Top: UGL model. Middle: 4DIR 4. DISCUSSION The copyright holder for this preprint (which was not was (which preprint this for holder copyright The Regression coefficient . While our presentation is centered on 2D priors, both UGL 4DIR Fig. 4.MCMC. Bayesian Left: GLM regressionhand regression coefficient motor corresponding results task. Right: to obtained PPMsthe right for right using the hand probability motor of tasksignal, effect exceeding of thresholded at model. Bottom: ANYDIR model. anatomical lines, indicating that the priorsboundaries. respect anatomical We have proposed two newanalysis Bayesian spatial that priors allow for fMRI dence for over voxels. a These locally priors wereical anisotropic used structure, to spatial encode resulting anatom- depen- infor anatomically-adaptive fMRI smoothing data.the existing The framework priors for caning Bayesian minimal be modifications. fMRI easily analysis, incorporated requir- into of the proposed approachesrequiring can significant be modifications. extendedimproved to The by 3D priors incorporating without can additionalstructure also tensor information to, be from for the with example, uniform use the intensity. UGLalso prior These be in adaptive applied areas spatial indata [21]. models Bayesian can frameworks for diffusion MRI ANYDIR 5. times, with CC-BY 4.0 International license International 4.0 CC-BY a this version posted October 18, 2019. 2019. 18, October posted version this 000 ; 4DIR -weighted volume, ANYDIR 1 10, T of the global mean sig- 0.2% 0.8. The regression coefficients for https://doi.org/10.1101/810796

doi: doi:

30 40 50 50 60 70 warmup iterations, and with a thinning factor of D. In both cases the models have successfully adapted Due to the time-consuming nature of the MCMC analysis The PPMs from all three methods are similar, showing 000 it was carried outGibbs on a sampling single algorithm representative was axial slice. iterated The nal and thresholded at both of the proposed models clearlypatterns reflect absent anatomical from spatial the UGL results.angular The for patterns the are 4DIR highly modelresolution, as while a the result ANYDIR of modelcurved the results patterns. limited in angular more natural large activation intral the sulcus, motor cortex andcortex. and However, smaller the close activations activations detected toposed by methods in the both are of slightly the cen- the narrower and pro- somatosensory extend further along Fig. 3. Comparisonboth of of neighborhood the proposed structures models.of implied spatial Lines by prior represent the dependencies orientation ods at adapt the these dependencies given at point. eachthe point in Both anatomical accordance meth- with structure. Theof 4DIR four method possible orientations, only while makestations with vary use ANYDIR continuously. the orien- to the anatomical structure given by the 3.2. Functional MRI results Figure 4 shows, forcients obtained all for three a models, rightrior hand the probability motor regression maps task, coeffi- (PPMs) asthe quantifying well effect of as the said poste- probability task exceeding of 1, 3.1. Anatomical adaptiveness Figure 3 illustrates the orientationgenerated of the by pixel the neighborhoods two proposedthe approaches, conditional which dependencies determine encoded intrix prior precision ma- as spatial prior dependenceand is not across placed them. alonglar The lines resolution, 4DIR and as method edges it shows limited canorientations, angu- only while represent the neighborhoods ANYDIR inarbitrary produces four orientations. neighborhoods in certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under under available is made It in perpetuity. the preprint to display a license bioRxiv granted has who author/funder, is the review) by peer certified bioRxiv preprint preprint bioRxiv bioRxiv preprint doi: https://doi.org/10.1101/810796; this version posted October 18, 2019. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license.

5. REFERENCES [12] Lee M Harrison, Will Penny, Guillaume Flandin, Chris- tian C Ruff, Nikolaus Weiskopf, and Karl J Friston, [1] Ola Friman, Magnus Borga, Peter Lundberg, and Hans “Graph-partitioned spatial priors for functional mag- Knutsson, “Adaptive analysis of fMRI data,” NeuroIm- netic resonance images,” NeuroImage, vol. 43, no. 4, age, vol. 19, no. 3, pp. 837–845, 2003. pp. 694–707, 2008. [2] Rajesh R Nandy and Dietmar Cordes, “Novel nonpara- [13] Per Siden,´ Anders Eklund, David Bolin, and Mattias metric approach to canonical correlation analysis with Villani, “Fast Bayesian whole-brain fMRI analysis with applications to low CNR functional MRI data,” Mag- spatial 3D priors,” NeuroImage, vol. 146, pp. 211–225, netic Resonance in Medicine, vol. 50, no. 2, pp. 354– 2017. 365, 2003. [14] Per Siden,´ Finn Lindgren, David Bolin, Anders Ek- [3] Joakim Rydell, Hans Knutsson, and Magnus Borga, lund, and Mattias Villani, “Spatial 3D Matern priors “Bilateral filtering of fMRI data,” IEEE Journal of Se- for fast whole-brain fMRI analysis,” arXiv preprint lected Topics in Signal Processing, vol. 2, no. 6, pp. arXiv:1906.10591, 2019. 891–896, 2008. [15] Fan RK Chung, Spectral graph theory, American Math- [4] Anders Eklund, Mats Andersson, and Hans Knutsson, ematical Society, 1997. “Fast random permutation tests enable objective evalu- ation of methods for single-subject fMRI analysis,” In- [16] Gosta¨ H Granlund and Hans Knutsson, Signal process- ternational journal of biomedical imaging, vol. 2011, ing for , Kluwer Academic Publishers, 2011. 1995. [5] Hamid Behjat, Nora Leonardi, Leif Sornmo,¨ and Dimitri [17] Hans Knutsson and Mats Andersson, “What’s so good Van De Ville, “Anatomically-adapted graph wavelets about quadrature filters?,” in Proceedings 2003 In- for improved group-level fMRI activation mapping,” ternational Conference on Image Processing (Cat. No. NeuroImage, vol. 123, pp. 185–199, 2015. 03CH37429). IEEE, 2003, vol. 3, pp. III–61. [6] Xiaowei Zhuang, Zhengshi Yang, Tim Curran, Richard [18] Hans Knutsson, “Representing local structure using ten- Byrd, Rajesh Nandy, and Dietmar Cordes, “A family of sors,” in Scandinavian Conference on Image Analysis, locally constrained CCA models for detecting activation 1989, pp. 244–251. patterns in fMRI,” NeuroImage, vol. 149, pp. 63–84, [19] Hans Knutsson, Carl-Fredrik Westin, and Mats Anders- 2017. son, “Representing local structure using tensors II,” in [7] Gabriele Lohmann, Johannes Stelzer, Eric Lacosse, Scandinavian Conference on Image Analysis. Springer, Vinod J Kumar, Karsten Mueller, Esther Kuehn, Wolf- 2011, pp. 545–556. gang Grodd, and Klaus Scheffler, “LISA improves sta- [20] David C Van Essen, Stephen M Smith, Deanna M Barch, tistical analysis for fMRI,” Nature communications, vol. Timothy EJ Behrens, Essa Yacoub, Kamil Ugurbil, Wu- 9, no. 1, pp. 4014, 2018. Minn HCP Consortium, et al., “The WU-Minn human [8] Will Penny, Stefan Kiebel, and Karl Friston, “Varia- connectome project: an overview,” Neuroimage, vol. tional Bayesian inference for fMRI time series,” Neu- 80, pp. 62–79, 2013. roImage, vol. 19, no. 3, pp. 727–741, 2003. [21] Xuan Gu, Per Siden,´ Bertil Wegmann, Anders Eklund, [9] Will Penny and Guillaume Flandin, “Bayesian analy- Mattias Villani, and Hans Knutsson, “Bayesian diffu- sis of fMRI data with spatial priors,” in Proceedings of sion tensor estimation with spatial priors,” in Interna- the Joint Statistical Meeting (JSM). American Statistical tional Conference on Computer Analysis of Images and Association. Citeseer, 2005. Patterns. Springer, 2017, pp. 372–383. [10] Will Penny, Guillaume Flandin, and Nelson Trujillo- Barreto, “Bayesian comparison of spatially regularised general linear models,” Human brain mapping, vol. 28, no. 4, pp. 275–293, 2007. [11] Lee M Harrison, W Penny, Jean Daunizeau, and Karl J Friston, “Diffusion-based spatial priors for functional magnetic resonance images,” Neuroimage, vol. 41, no. 2, pp. 408–423, 2008.