|
Size: 6564
Comment:
|
Size: 8079
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 2: | Line 2: |
[[FreeSurferWiki|top]] | [[Tutorials|previous]] | [[FsFastTutorialV5.1|FSFAST Tutorial Top]] Group Level Analysis |
[[FreeSurferWiki|top]] | [[Tutorials|previous]] | [[FsFastTutorialV5.1|FSFAST Tutorial Top]] |
| Line 9: | Line 6: |
| In general, the group analysis for fMRI is very similar to that of the structural data. There is a tutorial for this at GroupAnalysis. There are several specific differences for fMRI which are described here. In the surface-based GroupAnalysis, you would run mris_preproc to create a single file with a 'stack' of all of your subjects (one subject for each frame) in the common surface space, smoothed the data on the surface, then run mri_glmfit. |
= Group Level Analysis = In general, the group analysis for fMRI is very similar to that of the structural data. There is a tutorial for this at GroupAnalysis. There are several specific differences for fMRI which are described here. |
| Line 17: | Line 9: |
| For the fMRI, the analyzed data are already in the common space and smoothed. You will need to |
In the '''__structrual__''' GroupAnalysis, you would: |
| Line 20: | Line 11: |
| * Concatenate them into one file | 1. Run mris_preproc to resample each subject into the common space and then concatenate all of your subjects (one subject for each frame) into one file. 1. Smoothed the data on the surface, then 1. Run mri_glmfit and mri_glmfit-sim For the '''__function MRI__''' group analysis you will need to: * Concatenate individuals into one file (isxconcat-sess) |
| Line 29: | Line 26: |
In the structural stream (see GroupAnalysis), the subject's data were concatenated into one file with mris_preproc . For the functional stream, the program is called isxconcat-sess: |
In the structural stream (see GroupAnalysis), the subject's data were concatenated into one file with mris_preproc . For the functional stream, the program is called isxconcat-sess: |
| Line 37: | Line 31: |
| Line 42: | Line 35: |
| * -all-contrasts can be used instead of -contrast | * Note: -all-contrasts can be used instead of -contrast * Gets the contrast values (ces.nii.gz) for each subject and concatenates them into one file * Does the same for the contrast variances (cesvar.nii.gz) * Creates other files as well that can be used for checking for quality {{attachment:isxconcat.jpg|junk|width=700}} |
| Line 45: | Line 44: |
| Line 50: | Line 50: |
| When this is complete, a directory called 'group' will be created. cd into this directory and see what's there: |
When this is complete, a directory called 'group' will be created. cd into this directory and see what's there: |
| Line 56: | Line 56: |
| Line 59: | Line 58: |
| * sess.info.txt : other information about each session | * sess.info.txt : other information about each session |
| Line 80: | Line 79: |
| Each of the volumes is in the output space, as can be verified with mri_info. |
Each of the volumes is in the output space (lh, rh, mni305), as can be verified with mri_info. |
| Line 84: | Line 83: |
| Line 88: | Line 88: |
| Line 91: | Line 90: |
| Line 95: | Line 94: |
Details on how to run the GLM are given in GroupAnalysis, including the use of FSGD files to construct complicated group-level design matrices. Here we are going to use a very simple design in which test whether the mean across the groups equals 0 (the One Sample Group Mean, or OSGM). This just requires a design matrix with a single column of all ones (created with the --osgm flag): |
Details on how to run the GLM are given in GroupAnalysis, including the use of FSGD files to construct complicated group-level design matrices. Here we are going to use a very simple design in which test whether the mean across the groups equals 0 (the One Sample Group Mean, or OSGM). This just requires a design matrix with a single column of all ones (created with the --osgm flag): |
| Line 104: | Line 97: |
| mri_glmfit --y ces.nii.gz --wls cesvar.nii.gz --osgm --surface fsaverage lh --glmdir my-glm.wls | mri_glmfit --y ces.nii.gz \ --wls cesvar.nii.gz \ --osgm \ --surface fsaverage lh \ --glmdir my-glm.wls \ --nii.gz |
| Line 106: | Line 104: |
| Line 112: | Line 109: |
| * --nii.gz : use compressed NIFTI as output format | |
| Line 113: | Line 111: |
| The one difference between this and the call in the structrual steam is the presence of the '--wls cesvar.nii.gz' option. cesvar.nii.gz is the variance of each session at each voxel. This is used to de-weight a session with high variance. This is not a true mixed effects analysis (this has been referred to as 'psuedo mixed effects'; see Thirion, 2007, Neuroimage). This step is not performed in the structural stream because we do not have variance information for each subject. |
The one difference between this and the call in the structrual steam is the presence of the '--wls cesvar.nii.gz' option. cesvar.nii.gz is the variance of each session at each voxel. This is used to de-weight a session with high variance. This is not a true mixed effects analysis (this has been referred to as 'psuedo mixed effects'; see Thirion, 2007, Neuroimage). This step is not performed in the structural stream because we do not have variance information for each subject. |
| Line 122: | Line 113: |
| = Visualizing the GLM = | = Visualizing the Results of the Group GLM = {{{ tksurfer fsaverage lh inflated -aparc -overlay my-glm.wls/osgm/sig.nii.gz }}} {{attachment:lh.group.encode.jpg}} = Correct for Multiple Comparisons = The correction is the same as for the structural group analysis. For example, run: |
| Line 125: | Line 124: |
| tksurfer fsaverage lh inflated -aparc -overlay glm.wls/osgm/sig.nii.gz | mri_glmfit-sim --glmdir my-glm.wls --cache 3 pos --cwpvalthresh .0166 }}} * --glmdir my-glm.wls : output from mri_glmfit command * --cache 2 pos * Use pre-cached simulation * Voxel-wise threshold of 2 (p<.01) * Use positive contrast values * --cwpvalthresh .0166 : Cluster-wise p-value threshold. Only keep clusters that have p<.0166 Using a cluster-wise p-value threshold of p < .0166 corrects across all three spaces for p<.05 (ie, .0166 = .05/3). This corrections for a whole brain (ie, lh, rh, and subcortical) analysis. This will create several outputs, though there are three that are most important: * cache.th30.pos.sig.cluster.summary - cluster summary table (simple ASCII text) * cache.th30.pos.sig.cluster.nii.gz - overlay with significant clusters * cache.th30.pos.ocn.annot - annotation of significant clusters View the [[FsFastGroupLevel/ClusterSummaryLh|cache.th30.pos.sig.cluster.summary]] table {{{ cat my-glm.wls/osgm/cache.th30.pos.sig.cluster.summary |
| Line 128: | Line 147: |
| = Correct for Multiple Comparisons = | {{{ tksurfer fsaverage lh inflated \ -overlay my-glm.wls/osgm/cache.th30.pos.sig.cluster.nii.gz \ -annot ./my-glm.wls/osgm/cache.th30.pos.sig.ocn.annot }}} {{attachment:lh.group.encode.cluster.jpg}} |
| Line 130: | Line 154: |
| The correction is the same as for the structural group analysis. For example, run: |
= Right Hemisphere = Perform the same operations above for the right hemisphere (ie, go into workmem.sm05.rh): |
| Line 134: | Line 158: |
| mri_glmfit-sim --glmdir my-glm.wls --cache 2 pos }}} Will find clusters defined by a cluster-wise threshold of 2 (p<.01) with a positive sign. = Right Hemisphere = Perform the same operations above for the right hemisphere (ie, go into workmem.sm05.rh): {{{ cd $FSFTUTDIR/group/workmem.sm05.rh |
cd $FSFTUTDIR/group/workmem.sm05.rh/encode-v-base mri_glmfit --y ces.nii.gz --wls cesvar.nii.gz --osgm --surface fsaverage rh --glmdir my-glm.wls --nii.gz mri_glmfit-sim --glmdir my-glm.wls --cache 3 pos --cwpvalthresh .0166 |
| Line 149: | Line 164: |
Perform the same operations above for the MNI 305 space analysis (ie, go into workmem.sm05.mni305). There are a couple of things that are different about this analysis. |
Perform the same operations above for the MNI 305 space analysis (ie, go into workmem.sm05.mni305). There are a couple of things that are different about this analysis. |
| Line 155: | Line 167: |
| cd $FSFTUTDIR/group/workmem.sm05.mni305 | cd $FSFTUTDIR/group/workmem.sm05.mni305/encode-v-base |
| Line 158: | Line 170: |
| This directory has the same files as the surface-based results, though their dimensions are different. All the volumes here are true volumes. |
|
| Line 159: | Line 174: |
| This directory has the same files as the surface-based results, though their dimensions are different. All the volumes here are true volumes. There is an addition file that is not in the surface-based results: * subcort.mask.nii.gz This is a mask that only covers the subcortical structures. This will be used to help prevent the re-analysis of cortical structures. |
The mri_glmfit command is the same as for the surface-based analysis but without the (--surface fsaverage lh) part and with the specification of a mask |
| Line 169: | Line 177: |
| tkmedit fsaverage orig.mgz -aparc+aseg -overlay subcort.mask.nii.gz -fthresh 0.5 | cd $FSFTUTDIR/group/workmem.sm05.mni305/encode-v-base mri_glmfit --y ces.nii.gz --wls cesvar.nii.gz --osgm --glmdir my-glm.wls --mask ../subcort.mask.nii.gz tkmedit fsaverage orig.mgz -aparc+aseg -overlay my-glm.wls/osgm/sig.nii.gz |
| Line 172: | Line 182: |
The mri_glmfit command is the same as for the surface-based analysis but without the (--surface fsaverage lh) part and with the specification of a mask |
|
| Line 178: | Line 183: |
| cd workmem.sm05.mni305/encode-v-base mri_glmfit --y ces.nii.gz --wls cesvar.nii.gz --osgm --glmdir glm.wls --mask ../subcort.mask.nii.gz tkmedit fsaverage orig.mgz -aparc+aseg -overlay glm.wls/osgm/sig.nii.gz |
mri_glmfit-sim --glmdir my-glm.wls --grf 3 pos --cwpvalthresh .0166 |
top | previous | FSFAST Tutorial Top
Contents
1. Group Level Analysis
In general, the group analysis for fMRI is very similar to that of the structural data. There is a tutorial for this at GroupAnalysis. There are several specific differences for fMRI which are described here.
In the structrual GroupAnalysis, you would:
- Run mris_preproc to resample each subject into the common space and then concatenate all of your subjects (one subject for each frame) into one file.
- Smoothed the data on the surface, then
- Run mri_glmfit and mri_glmfit-sim
For the function MRI group analysis you will need to:
- Concatenate individuals into one file (isxconcat-sess)
- Do not smooth (already smoothed during first-level analysis)
- Run mri_glmfit using weighted least squares (WLS)
- Correct for multiple comparisons
- Perform the above in each space (lh, rh, and mni305)
- Correct for multiple comparisons across the three spaces
- Optionally merge the three spaces into one volume space
2. Concatenating the Data
In the structural stream (see GroupAnalysis), the subject's data were concatenated into one file with mris_preproc . For the functional stream, the program is called isxconcat-sess:
isxconcat-sess -sf sessidlist -analysis workmem.sm05.lh -contrast encode-v-base -o group
- -sf sessidlist : use all the subjects listed in sessidlist (order is important!)
- -analysis workmem.sm05.lh : analysis from mkanalysis-sess and selxavg3-sess
- -contrast encode-v-base : contrast from mkcontrast-sess
- -o group : output folder is called 'group'
- Note: -all-contrasts can be used instead of -contrast
- Gets the contrast values (ces.nii.gz) for each subject and concatenates them into one file
- Does the same for the contrast variances (cesvar.nii.gz)
- Creates other files as well that can be used for checking for quality
Run the concatenation for the right hemisphere and mni305 spaces
isxconcat-sess -sf sessidlist -analysis workmem.sm05.rh -contrast encode-v-base -o group isxconcat-sess -sf sessidlist -analysis workmem.sm05.mni305 -contrast encode-v-base -o group
When this is complete, a directory called 'group' will be created. cd into this directory and see what's there:
cd $FSFTUTDIR/group ls
- grouplist.txt : list of the sessions
subjectlist.txt : list of the corresponding FreeSurfer subject IDs
- sess.info.txt : other information about each session
- workmem.sm05.lh - left hemisphere analysis output folder
- workmem.sm05.rh - right hemisphere analysis output folder
- workmem.sm05.mni305 - MNI 305 analysis output folder
Go into the workmem.sm05.lh and see what's there:
cd $FSFTUTDIR/group/workmem.sm05.lh ls
You will see several files and folders:
- analysis.info - copy of the analysis.info created by mkanalysis-sess
- meanfunc.nii.gz - a stack of the mean functional images for each session
- masks.nii.gz - a stack of the masks of all the individual subjects
- mask.nii.gz - a single mask based on the intersection of all masks
- fsnr.nii.gz - a stack of the functional SNRs for each session
- ffxdof.dat - text file with the total number of DOF summed over all sessions
- encode-v-base - group contrast folder
Each of the volumes is in the output space (lh, rh, mni305), as can be verified with mri_info.
Go into the contrast folder and see what's there:
cd $FSFTUTDIR/group/workmem.sm05.lh/encode-v-base ls
- ces.nii.gz - stack of all the contrast values from the lower level, one for each session
- cesvar.nii.gz - stack of all the contrast variances from the lower level, one for each session
These are going to be the inputs for the group GLM analysis.
3. Running the GLM
Details on how to run the GLM are given in GroupAnalysis, including the use of FSGD files to construct complicated group-level design matrices. Here we are going to use a very simple design in which test whether the mean across the groups equals 0 (the One Sample Group Mean, or OSGM). This just requires a design matrix with a single column of all ones (created with the --osgm flag):
mri_glmfit --y ces.nii.gz \ --wls cesvar.nii.gz \ --osgm \ --surface fsaverage lh \ --glmdir my-glm.wls \ --nii.gz
- --y ces.nii.gz : the input values to analyze
- --wls cesvar.nii.gz : variance weighting
- --osgm : use One-Sample Group Mean
- --surface fsaverage lh : indicates surface based data (not used for volume data)
- --glmdir my-glm.wls : output directory
- --nii.gz : use compressed NIFTI as output format
The one difference between this and the call in the structrual steam is the presence of the '--wls cesvar.nii.gz' option. cesvar.nii.gz is the variance of each session at each voxel. This is used to de-weight a session with high variance. This is not a true mixed effects analysis (this has been referred to as 'psuedo mixed effects'; see Thirion, 2007, Neuroimage). This step is not performed in the structural stream because we do not have variance information for each subject.
4. Visualizing the Results of the Group GLM
tksurfer fsaverage lh inflated -aparc -overlay my-glm.wls/osgm/sig.nii.gz
5. Correct for Multiple Comparisons
The correction is the same as for the structural group analysis. For example, run:
mri_glmfit-sim --glmdir my-glm.wls --cache 3 pos --cwpvalthresh .0166
- --glmdir my-glm.wls : output from mri_glmfit command
- --cache 2 pos
- Use pre-cached simulation
Voxel-wise threshold of 2 (p<.01)
- Use positive contrast values
--cwpvalthresh .0166 : Cluster-wise p-value threshold. Only keep clusters that have p<.0166
Using a cluster-wise p-value threshold of p < .0166 corrects across all three spaces for p<.05 (ie, .0166 = .05/3). This corrections for a whole brain (ie, lh, rh, and subcortical) analysis.
This will create several outputs, though there are three that are most important:
- cache.th30.pos.sig.cluster.summary - cluster summary table (simple ASCII text)
- cache.th30.pos.sig.cluster.nii.gz - overlay with significant clusters
- cache.th30.pos.ocn.annot - annotation of significant clusters
View the cache.th30.pos.sig.cluster.summary table
cat my-glm.wls/osgm/cache.th30.pos.sig.cluster.summary
tksurfer fsaverage lh inflated \ -overlay my-glm.wls/osgm/cache.th30.pos.sig.cluster.nii.gz \ -annot ./my-glm.wls/osgm/cache.th30.pos.sig.ocn.annot
6. Right Hemisphere
Perform the same operations above for the right hemisphere (ie, go into workmem.sm05.rh):
cd $FSFTUTDIR/group/workmem.sm05.rh/encode-v-base mri_glmfit --y ces.nii.gz --wls cesvar.nii.gz --osgm --surface fsaverage rh --glmdir my-glm.wls --nii.gz mri_glmfit-sim --glmdir my-glm.wls --cache 3 pos --cwpvalthresh .0166
7. Subcortical (MNI 305 Space)
Perform the same operations above for the MNI 305 space analysis (ie, go into workmem.sm05.mni305). There are a couple of things that are different about this analysis.
cd $FSFTUTDIR/group/workmem.sm05.mni305/encode-v-base ls
This directory has the same files as the surface-based results, though their dimensions are different. All the volumes here are true volumes.
The mri_glmfit command is the same as for the surface-based analysis but without the (--surface fsaverage lh) part and with the specification of a mask
cd $FSFTUTDIR/group/workmem.sm05.mni305/encode-v-base mri_glmfit --y ces.nii.gz --wls cesvar.nii.gz --osgm --glmdir my-glm.wls --mask ../subcort.mask.nii.gz tkmedit fsaverage orig.mgz -aparc+aseg -overlay my-glm.wls/osgm/sig.nii.gz
mri_glmfit-sim --glmdir my-glm.wls --grf 3 pos --cwpvalthresh .0166
