Contents
- Introduction (Note: mri_dualperm is only available in the development version of FreeSurfer)
- Creating "Stacks"
-
Use Cases
- Use Case 1: passing stacks from both modalities
- Use Case 2: Passing only a single modality stack to create surrogates to be used at a later time
- Use Case 3: Passing a stack from one modality and the surrogates from another modality created as in Use Case #2
- Use Case 4: Passing surrogates for both modalities where the surrogates were created as in Use Case #2
- Specifying the Type of Permutation
- Masking
- Other Options
- How to cite
1. Introduction (Note: mri_dualperm is only available in the development version of FreeSurfer)
Dual permutation (DP) is a method to compute the p-value of an inter-modal spatial Pearson correlation coefficient (PCC) of cross-subject mean maps. For example, the result of an fMRI study and a mean map of serotonin receptor density as measured by PET. Each modality is represented by a "stack" of subjects, ie, a map with multiple frames where each frame is a subject. The mean maps to be correlated are computed from these stacks by fitting a regression model in a GLM, then computing a contrast of regression coefficients to reduce the stack to a single univariate map. Dual permutation works by creating "surrogate" maps of each modality and then computing the correlation between the surrogates. The surrogate maps are constructed by first residualizing the stack using the GLM, then permuting the design matrix, then reanalyzing the resdiualized stack with the permuted design matrix, followed by applying the contrast to create a univariate surrogate. This is repeated many times to create a list of surrogate PCCs. The p-value is then computed at the fraction of times the surrogate PCCs exceeded the real PCC. DP should only be used in cases where the two modalities come from different subject populations. The stacks must exist in the same space, eg, MNI152, fsaverage, or a table of ROIs.
DP has been rigorously verified. The surrogate PCC has been shown analytically to have the same variance of that of the real PCC under the null regardless of spatial autocorrelation function (SACF, including spatial non-staionarity of the SACF), spatial non-stationarity in noise power, and group level design. As a non-parametric method, it does not rely on assumptions about the distribution of the noise. DP has been shown to control the false positive rate (also known as the type I error rate) in pairs of real data configured to be null, including, fMRI, cortical thickness, cortical curvature, DTI fractional anisotropy, and serotonin transporter binding potential as measured by PET. DP works in cases where both modalities are null (known as the "Full Null") as well as when one of the modalities is null but the other is non-null (known as the "Partial Null").
2. Creating "Stacks"
"Stacks" are single files with multiple subjects "stacked" in the frame dimension. A stack must be in an atlas space, such as MNI152, fsaverage, or a table of ROIs. Voxel-wise stacks are typically stored in NIFTI or mgz format whereas ROI stacks are in text files. In FreeSurfer, there are several ways to create stacks, such as with mris_preproc, isxconcat-sess, asegstats2table, aparcstats2table, and mri_concat. Of course, stacks created from other software packages can be used with mri_dualperm. The two modalities can have different numbers of subjects but must have the same number of voxels (ie, columns, rows, and slices).
Note: the order of the subjects in a stack is important! The order must match the rows in your design matrix (unless you are using an OSGM).
3. Use Cases
mri_dualperm is the FreeSurfer program that implements DP. It can be run in several ways:
- Passing stacks from both modalities
- Passing only a single modality stack to create surrogates to be used at a later time
- Passing a stack from one modality and the surrogates from another modality created as in Use Case #2
- Passing surrogates for both modalities where the surrogates were created as in Use Case #2
It is likely that Use Case 1 will apply to most users. However, allowing the creation of surrogates from a single modality at a time has some advantages, mainly it allows surrogates to be publicly distributed in cases where privacy concerns prevent the distribution of individual subject data in which case Use Cases #3 or #4 could be used. The creation of surrogates from a single modality also makes it easier to perform DP on a broad scale. For example, single modality surrogates could be stored in the BIDS atlas format on OpenNeuro. If surrogates for many such modalities existed, then inter-modal correlations could be computed at a massive scale. Of course, regardless of the application, precomputing surrogates will speed up the final computations.
Both modalities (stacks or surrogates) must be in the same space. It is possible to compile DP runs across spaces. For example, if subcortical gray matter structures were analyzed in the volume and cortical structures were analyzed on the surface, then a whole brain gray matter correlation analysis could be run by running DP on each space separately, then combining the results afterwards.
The execution time of DP depends on the number of subjects in each modality, the size of the atlas space, and the number of permutations. If the number of subjects is 20 and the space is fsaverage, the mri_dual perm only takes a few minutes to run 500 permutations.
3.1. Use Case 1: passing stacks from both modalities
mri_dualperm --o outputfolder --nperm 500 --map1 stack1.nii.gz --osgm1 --map2 stack2.nii.gz --osgm2
In the above command, DP will be run with 500 permutations. The above command with --osgm1 and --osgm2 will compute a simple mean of the group (OSGM = One-Sample Group Mean). More complicated designs are possible (see below). With OSGM, the order of the subjects in the stacks does not matter.
The output will go into outputfolder. The inter-modal correlation will be in the cc.dat file. The p-value will be in p12.max.dat. This file will have three values: (1) p-value for PCC > 0, (2) p-value for PCC < 0, and (3) p-value for PCC != 0. Choose the one appropriate for your hypothesis. There will also be glm1 and glm2 folders with output of the GLM analysis for each modality. This can be handy for quality control and troubleshooting.
If one wants to test a more complicated group design (eg, multiple groups, covariates), then one must use a FreeSurfer Group Descriptor (FSGD) File; see surfer.nmr.mgh.harvard.edu/fswiki/FsgdExamples. Note: the order of the subjects in a stack must match that of its accompanying FSGD file.
mri_dualperm --o outputfolder --nperm 500 --map1 stack1.nii.gz --fsgd1 design1.fsgd --map2 stack2.nii.gz --fsgd2 design2.fsgd
The FSGD file must have a univariate (t) contrast specified; if multiple contrasts are specified, then DP is only run on the first one. The modalities do not have to have the same design.
3.2. Use Case 2: Passing only a single modality stack to create surrogates to be used at a later time
mri_dualperm --o outputfolder --nperm 500 --map1 stack1.nii.gz --fsgd1 design1.fsgd --map1-only --save-surrogates1
This will write out a file called surrogates1.nii.gz, which is a stack of 500 surrogates, which can be passed to mri_dualperm as below. These can also be distributed without privacy concern as they are essentially mean images. There will of course not be any correlation coefficients or p-values because this is only one modality. Note that --save-surrogates1 and --save-surrogates2 can be used in Use Case 1 to save surrogates for both modalities.
3.3. Use Case 3: Passing a stack from one modality and the surrogates from another modality created as in Use Case #2
mri_dualperm --o outputfolder --nperm 500 --surrogates1 surrogates1.nii.gz --map2 stack2.nii.gz --fsgd2 design2.fsgd
This will create the same output as Use Case 1. Note that the input surrogates1.nii.gz must have a least nperm (500) frames. A mask for modality 1 can also be passed.
3.4. Use Case 4: Passing surrogates for both modalities where the surrogates were created as in Use Case #2
mri_dualperm --o outputfolder --nperm 500 --surrogates1 surrogates1.nii.gz --surrogates2 surrogates2.nii.gz
This will create the same output as Use Cases 1 and 3. Note that the surrogates1.nii.gz and surrogates2.nii.gz must have a least nperm (500) frames.
4. Specifying the Type of Permutation
In theory, there are three ways that the permutation can done: (1) sign flipping, (2) shuffling (ie, randomly swapping rows of the design matrix), or (3) both. Specify the type with --ptype1 and/or --ptype2 (eg, --ptype2 3 to use both for modality 2). In an OSGM or any design where X*C is a constant vector, then only sign flipping is possible. Sign flipping may be sensitive to skew in the noise, though our experiments have not been able to find much or any effect of skew. Note that the type of permutation does not have to be the same for both modalities.
5. Masking
By default, an internal mask is created where, for a voxel to be in the internal mask, it must have non-zero values for all subjects in both modalities. Beyond that, the user can pass binary masks with the --mask1 and --mask2 options. The final mask will be an intersection of the internal mask and any passed masks; the final mask will be applied to both modalities. The spatial correlation will only be computed across the voxels in the final mask. Final masks are saved in the glm folders.
6. Other Options
- --help : run with this option to get more information on the usage.
- --threads N : run in parallel with N CPUs to speed up the execution
- --seed seedvalue : specify the seed used for the random number generator. By default, a random seed will be selected. Specifying the seed will cause deterministic output, which is mostly good for testing. The seed is written into a seed.txt file in the output folder.
- --tsgd : Use a two-sample group design (TSGD). Divides the subjects equally into two groups. This was included to make it easy to test and is generally not useful to the generic user unless your design is two group and the order in your stack is that the first N/2 subjects is in group 1 and the last N/2 are in group 2.
7. How to cite
Testing Spatial Correspondence Between Brain Maps Using Dual Permutation. D.N. Greve, A.M. Winkler, P.M. Fisher, T.E. Nichols. Submitted.
