User Tools

Site Tools


neuroimagen:fs_group_analysis

This is an old revision of the document!


FreeSurfer Group Analysis

FSDG

https://surfer.nmr.mgh.harvard.edu/fswiki/FsgdExamples

https://surfer.nmr.mgh.harvard.edu/fswiki/FsgdFormat

Primero hay que construir el archivo de diseño del experimento,

[osotolongo@detritus fsdg]$ head codes.csv
Subject,PSubject
0001,F001
0002,F002
0003,F003
0004,F004
0005,F005
0006,F006
0007,F007
0008,F008
0009,F009
[osotolongo@detritus fsdg]$ head demographics.csv
PSubject,edat_v0,Anyos_Escolaridad_FAC_v0,Sex_1H_0M_v0
F001,71,8,0
F002,70,12,1
F003,70,8,0
F004,76,16,0
F005,68,20,1
F006,64,14,0
F007,59,19,1
F008,55,16,0
F009,67,16,0
[osotolongo@detritus fsdg]$ join -t"," -1 2 -2 1 codes.csv demographics.csv | awk -F"," '{print "facehbi_"$2","$3","$4","$5}' | sed 's/facehbi_Subject/Variables/;s/edat_v0/Age/;s/Anyos_Escolaridad_FAC_v0/Education/;s/Sex_1H_0M_v0/Gender/' | sed 's/facehbi_\([^,]*\),/Input facehbi_\1 Main /; s/,/ /g' > body.csv
[osotolongo@detritus fsdg]$ head body.csv
Variables Age Education Gender
Input facehbi_0001 Main 71 8 0
Input facehbi_0002 Main 70 12 1
Input facehbi_0003 Main 70 8 0
Input facehbi_0004 Main 76 16 0
Input facehbi_0005 Main 68 20 1
Input facehbi_0006 Main 64 14 0
Input facehbi_0007 Main 59 19 1
Input facehbi_0008 Main 55 16 0
Input facehbi_0009 Main 67 16 0
[osotolongo@detritus fsdg]$ cat headers.txt
GroupDescriptorFile 1
Title FACEHBI_all
Class Main
[osotolongo@detritus fsdg]$ cat headers.txt body.csv > facehbi.fsdg
[osotolongo@detritus fsdg]$ head facehbi.fsdg
GroupDescriptorFile 1
Title FACEHBI_all
Class Main
Variables Age Education Gender
Input facehbi_0001 Main 71 8 0
Input facehbi_0002 Main 70 12 1
Input facehbi_0003 Main 70 8 0
Input facehbi_0004 Main 76 16 0
Input facehbi_0005 Main 68 20 1
Input facehbi_0006 Main 64 14 0

GLM Analysis (mri_glmfit)

Primero construimos los contrastes, diciendole a FS cual es la variable que nos interesa, en este caso la edad,

https://surfer.nmr.mgh.harvard.edu/fswiki/Fsgdf1G2V

[osotolongo@detritus fsdg]$ cat facehbi.mtx
0 1 0 0

Ahora vamos a correr el modelo con este contraste,

[osotolongo@detritus fsdg]$ mris_preproc --fsgd facehbi.fsdg --cache-in thickness.fwhm10.fsaverage --target fsaverage --hemi lh --out lh.facehbi.age.thickness.10.mgh
[osotolongo@detritus fsdg]$ mri_glmfit --y lh.facehbi.age.thickness.10.mgh --fsgd facehbi.fsdg --C facehbi.mtx --surf fsaverage lh --cortex --glmdir lh.facehbi.age.glmdir

Para usar freeview me he tenido que ir a la FSL VM

[fsluser@FSLVm7_64 fsdg]$ freeview -f $SUBJECTS_DIR/fsaverage/surf/lh.inflated:annot=aparc.annot:annot_outline=1:overlay=lh.facehbi.age.glmdir/facehbi/sig.mgh:overlay_threshold=4,5 -viewport 3d

Cambiando el overlay threshold para que muestre toda la significancia,

Ejemplo, fijando uncorrected p<0.001,

Clusterwise Correction for Multiple Comparisons

Ahora voy a buscar los clusters con una p>0.05

[osotolongo@detritus fsdg]$ mri_glmfit-sim --glmdir lh.facehbi.age.glmdir --cache 4 neg --cwp 0.05 --2spaces

A ver,

freeview -f $SUBJECTS_DIR/fsaverage/surf/lh.inflated:overlay=lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.cluster.mgh:overlay_threshold=2,5:annot=lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.ocn.annot -viewport 3d

También hay un resumen de los clusters que se han encontrado a esta significancia,

[osotolongo@detritus fsdg]$ cat lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.cluster.summary
# Cluster Growing Summary (mri_surfcluster)
# $Id: mri_surfcluster.c,v 1.57.2.3 2016/11/17 18:19:42 zkaufman Exp $
# $Id: mrisurf.c,v 1.781.2.6 2016/12/27 16:47:14 zkaufman Exp $
# CreationTime 2020/06/11-08:12:12-GMT
# cmdline mri_surfcluster.bin --in lh.facehbi.age.glmdir/facehbi/sig.mgh --mask lh.facehbi.age.glmdir/mask.mgh --cwsig lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.cluster.mgh --sum lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.cluster.summary --ocn lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.ocn.mgh --annot aparc --cwpvalthresh 0.05 --o lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.masked.mgh --no-fixmni --csd /usr/local/freesurfer/average/mult-comp-cor/fsaverage/lh/cortex/fwhm14/neg/th40/mc-z.csd --csdpdf lh.facehbi.age.glmdir/facehbi/cache.th40.neg.pdf.dat --vwsig lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.voxel.mgh --vwsigmax lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.voxel.max.dat --oannot lh.facehbi.age.glmdir/facehbi/cache.th40.neg.sig.ocn.annot --bonferroni 2 --surf white
# cwd /nas/data/facehbi/fsdg
# sysname  Linux
# hostname detritus.fundacioace.com
# machine  x86_64
# FixVertexAreaFlag 1
# FixSurfClusterArea 1
#
# Input      lh.facehbi.age.glmdir/facehbi/sig.mgh
# Frame Number      0
# srcsubj fsaverage
# hemi lh
# surface white
# group_avg_surface_area 82220
# group_avg_vtxarea_loaded 1
# annot aparc
# SUBJECTS_DIR /nas/data/subjects
# SearchSpace_mm2 75610.7
# SearchSpace_vtx 147840
# Bonferroni 2
# Minimum Threshold 4
# Maximum Threshold infinity
# Threshold Sign    neg
# AdjustThreshWhenOneTail 1
# CW PValue Threshold: 0.05
# Area Threshold    0 mm^2
# CSD thresh  4.000000
# CSD nreps    10000
# CSD simtype  null-z
# CSD contrast NA
# CSD confint  90.000000
# Overall max 2.34317 at vertex 124430
# Overall min -11.9208 at vertex 75951
# NClusters          27
# FixMNI = 0
#
# ClusterNo  Max   VtxMax   Size(mm^2)  MNIX   MNIY   MNIZ    CWP    CWPLow    CWPHi   NVtxs    WghtVtx   Annot
   1       -6.017   60982    491.13    -47.9  -18.5   -2.1  0.00020  0.00000  0.00040   1098    -5034.35  superiortemporal
   2      -11.921   75951    428.53    -31.7  -41.3   -9.1  0.00020  0.00000  0.00040    941    -6762.90  parahippocampal
   3       -7.640  112606    361.05    -20.6  -99.6   -2.3  0.00020  0.00000  0.00040    432    -2179.37  lateraloccipital
   4       -5.486  105941    331.99    -17.1  -32.3   56.5  0.00020  0.00000  0.00040    865    -3748.97  precentral
   5       -5.449   35788    316.75    -44.9    6.5  -23.4  0.00020  0.00000  0.00040    611    -2771.80  superiortemporal
   6       -7.472   67375    290.75    -20.6   30.7   50.4  0.00020  0.00000  0.00040    424    -2270.56  superiorfrontal
   7       -4.824  159440    286.63     -8.8  -58.3   11.9  0.00020  0.00000  0.00040    622    -2552.03  precuneus
   8       -6.970  138044    273.27    -30.3  -20.0   68.2  0.00020  0.00000  0.00040    626    -3090.95  precentral
   9       -6.527   35125    264.21    -35.4  -12.7   18.8  0.00020  0.00000  0.00040    820    -4057.14  insula
  10       -5.259  113827    256.47    -58.3  -17.5  -17.2  0.00020  0.00000  0.00040    522    -2207.87  middletemporal
  11       -6.063  142574    227.96    -18.1  -91.7   16.1  0.00020  0.00000  0.00040    329    -1494.23  lateraloccipital
  12       -4.901  142130    215.89    -61.7  -35.5    5.4  0.00020  0.00000  0.00040    478    -2005.09  bankssts
  13       -7.124   88387    197.22    -10.7  -56.5   26.6  0.00020  0.00000  0.00040    436    -2167.82  precuneus
  14       -5.977  112248    187.37    -31.2  -83.9    6.5  0.00040  0.00000  0.00080    312    -1449.31  lateraloccipital
  15       -5.741  127670    174.29    -54.6   -0.9  -30.3  0.00080  0.00040  0.00140    210     -946.11  middletemporal
  16       -5.957  110612    155.97    -44.6   23.1   18.8  0.00180  0.00100  0.00260    258    -1195.22  parsopercularis
  17       -5.156  102514    136.16    -22.9   56.1   15.5  0.00459  0.00340  0.00579    163     -710.54  rostralmiddlefrontal
  18       -5.618   43104    128.92    -24.3    6.2   48.4  0.00619  0.00479  0.00759    289    -1317.77  caudalmiddlefrontal
  19       -5.445   91005    128.90    -21.8  -66.5    0.5  0.00619  0.00479  0.00759    285    -1241.01  lingual
  20       -4.760   47386    121.71     -8.2   33.1   33.9  0.00759  0.00599  0.00918    190     -780.64  superiorfrontal
  21       -4.778  107013    120.23    -19.8  -83.3   38.4  0.00798  0.00639  0.00958    223     -941.62  superiorparietal
  22       -4.954   58975    118.93    -10.8   25.6  -17.8  0.00818  0.00659  0.00978    269    -1155.28  medialorbitofrontal
  23       -4.799   38711    117.04    -60.9  -46.0   -1.9  0.00898  0.00739  0.01077    232     -956.50  bankssts
  24       -6.095    1815    116.62    -47.1  -19.1   56.1  0.00918  0.00739  0.01097    319    -1485.15  postcentral
  25       -4.976   77509    113.61    -35.6   37.8   13.2  0.01057  0.00878  0.01236    190     -814.05  rostralmiddlefrontal
  26       -4.228   51760     87.69    -45.5  -72.1   10.1  0.02524  0.02247  0.02800    140     -552.81  inferiorparietal
  27       -6.056  126177     68.80    -27.1  -68.1   22.7  0.04898  0.04508  0.05288    181     -854.08  superiorparietal
neuroimagen/fs_group_analysis.1591882060.txt.gz · Last modified: 2020/08/04 10:47 (external edit)