User Tools

Site Tools


mbstring extension must be loaded in order to run mPDF
neuroimagen:bioface_vbm

VBM para BIOFACE y FACEMemory

El procedimiento general para VBM puede verse aqui y aqui. Esta pagina solo recoge las particularidades para BIOFACE.

Limpiando, cortando, pegando y haciendo la tabla

[osotolongo@detritus vbmmem]$ awk -F"," '{print $3","$5","$6","$7","$24}' ../bioface_np.csv > bioface_mem.csv
[osotolongo@detritus vbmmem]$ head bioface_mem.csv
Subjecte,Edad,Sexo,Años_Estudios,Resultado
B001,64,1,11,13
B002,53,2,9,48
B003,60,2,8,10
B004,64,2,7,21
B005,62,2,16,30
B006,64,2,5,25
B007,62,2,11,39
B008,58,2,11,45
B009,51,2,11,28

que guay, mezcla de catalan,castellano, una Ñ! en los headers, pa volverse loco. Esto lo edito a mano.

[osotolongo@detritus vbmmem]$ head bioface_mem.csv
PSubject,Edad,Sexo,Estudios,FACEmem
B001,64,1,11,13
B002,53,2,9,48
B003,60,2,8,10
B004,64,2,7,21
B005,62,2,16,30
B006,64,2,5,25
B007,62,2,11,39
B008,58,2,11,45
B009,51,2,11,28

Los codigos estan aqui:

[osotolongo@detritus vbmmem]$ head ../bioface_mri.csv
0001;B001
0002;B002
0003;B003
0004;B004
0005;B005
0006;B006
0007;B007
0008;B008
0009;B009
0010;B010

Damos formato y unimos,

[osotolongo@detritus vbmmem]$ sed 's/;/,/g' ../bioface_mri.csv > bioface_join.csv
[osotolongo@detritus vbmmem]$ sed -i '1iSubject,PSubject' bioface_join.csv
[osotolongo@detritus vbmmem]$ head -n 5 bioface_join.csv
Subject,PSubject
0001,B001
0002,B002
0003,B003
0004,B004
[osotolongo@detritus vbmmem]$ join -t"," -1 2 -2 1 bioface_join.csv bioface_mem.csv > bioface_data.csv
[osotolongo@detritus vbmmem]$ head -n 5 bioface_data.csv
PSubject,Subject,Edad,Sexo,Estudios,FACEmem
B001,0001,64,1,11,13
B002,0002,53,2,9,48
B003,0003,60,2,8,10
B004,0004,64,2,7,21

Data Matrix

Aqui construimos la matriz de design.mat,

[osotolongo@detritus vbmmem]$ awk -F"," '{print $3,$4,$5,$6}' bioface_data.csv | tail -n+2 > vbm_data.dat
[osotolongo@detritus vbmmem]$ head vbm_data.dat
64 1 11 13
53 2 9 48
60 2 8 10
64 2 7 21
62 2 16 30
64 2 5 25
62 2 11 39
58 2 11 45
51 2 11 28
62 2 6 17
[osotolongo@detritus vbmmem]$ Text2Vest vbm_data.dat design.mat
[osotolongo@detritus vbmmem]$ head design.mat
/NumWaves 4
/NumPoints 94
/Matrix
64 1 11 13
53 2 9 48
60 2 8 10
64 2 7 21
62 2 16 30
64 2 5 25
62 2 11 39

y el design.con,

[osotolongo@detritus vbmmem]$ cat contrast_model.txt
0 0 0 1
0 0 0 -1
[osotolongo@detritus vbmmem]$ Text2Vest contrast_model.txt design.con
[osotolongo@detritus vbmmem]$ cat design.con
/NumWaves 4
/NumPoints 2
/Matrix
0 0 0 1
0 0 0 -1

BET

Trae las imagenes de FS,

[osotolongo@detritus vbmmem]$ for x in `awk -F"," {'print $2'} bioface_data.csv | tail -n +2`; do get_fsbrain.sh bioface ${x} /nas/data/bioface/vbmmem/struc; done
[osotolongo@detritus vbmmem]$ cd struc/
[osotolongo@detritus struc]$ for x in `awk -F"," {'print $2'} ../bioface_data.csv | tail -n +2`; do a="$a ${x}_struc ${x}_struc_brain"; done
[osotolongo@detritus struc]$ slicesdir -o -e 0.1 $a

parece OK, asi que seguimos,

Template

[osotolongo@brick01 vbmmem]$ fslvbm_2_template -n
0001_struc
0002_struc
0003_struc
...
...
...
0093_struc
0094_struc
0095_struc
Running segmentation: ID=10918
Running initial registration: ID=14147
Creating first-pass template: ID=21513
Running registration to first-pass template: ID=23634
Creating second-pass template: ID=44624
Study-specific template will be created, when complete, check results with:
fslview struc/template_4D_GM
and turn on the movie loop to check all subjects, then run:
fslview  /usr/local/fsl/data/standard/tissuepriors/avg152T1_gray  struc/template_GM
to check general alignment of mean GM template vs. original standard space template.

Esto no funciona.Hay problemas con FAST y estas imagenes. Workaround: Hacking FSLVBM

Traigo la GM de FS,

[osotolongo@detritus vbmmem]$ for x in `awk -F"," {'print $2'} bioface_data.csv | tail -n +2`; do get_gm.sh bioface ${x} /nas/data/bioface/vbmmem/struc; done

y hago el procedimiento alternativo

[osotolongo@detritus vbmmem]$ fslvbm_2_template_alt -n

PreProc

esta parte es igual,

$ fslvbm_3_proc

no tiene problemas porque lo que se hace es registrar al template comun que ya hemos creado.

randomise

Aqui es donde esta el meollo de los modelos. Podemos cambiar la variable de estudio, los contrastes, etc, siempre y cuando los sujetos a estudiar no cambien.

osotolongo@detritus:vbmmem$ head design_rlpp.mat
/NumWaves 4
/NumPoints 94
/Matrix
64 1 11 13
53 2 9 48
60 2 8 10
64 2 7 21
62 2 16 30
64 2 5 25
62 2 11 39
osotolongo@detritus:vbmmem$ randomise -i stats/GM_mod_merg_s2.nii.gz -o stats/fslvbm_rlpp_s2 -m stats/GM_mask -d design_rlpp.mat -t design.con -n 5000 -T -V
osotolongo@detritus:vbmmem$ autoaq -i stats/fslvbm_rlpp_s2_tfce_corrp_tstat1.nii.gz -t 0.95 -o reports/hoca_rlpp_s2_report.txt -a "Harvard-Oxford Cortical Structural Atlas" 2>/dev/null
osotolongo@detritus:vbmmem$ autoaq -i stats/fslvbm_rlpp_s2_tfce_corrp_tstat1.nii.gz -t 0.95 -o reports/hosa_rlpp_s2_report.txt -a "Harvard-Oxford Subcortical Structural Atlas" 2>/dev/null
=====[ stats/fslvbm_rlpp_s2_tfce_corrp_tstat1.nii.gz | Harvard-Oxford Cortical Structural Atlas ]=====
ClusterIndex    Voxels  MAX     MAX X (mm)      MAX Y (mm)      MAX Z (mm)      COG X (mm)      COG Y (mm)      COG Z (mm)
16      14080   0.996   56      6       -16     -0.145  -26.3   -7.85
15      1133    0.984   12      -30     48      -1.25   -42.3   38.7
14      449     0.984   48      -56     32      52.2    -58.3   28.6
....

Structures to which each center of mass belongs to:
16,-0.145,-26.3,-7.85,Harvard-Oxford Cortical Structural Atlas,No label found!
15,-1.25,-42.3,38.7,Harvard-Oxford Cortical Structural Atlas,69% Cingulate Gyrus, posterior division, 23% Precuneous Cortex
14,52.2,-58.3,28.6,Harvard-Oxford Cortical Structural Atlas,41% Angular Gyrus, 30% Lateral Occipital Cortex, superior division
.....

O cambiamos a otra variable,

osotolongo@detritus:vbmmem$ head design_rlpn.mat 
/NumWaves 4
/NumPoints 94
/Matrix
64 1 11 0
53 2 9 2
60 2 8 0
64 2 7 0
62 2 16 0
64 2 5 0
62 2 11 5
osotolongo@detritus:vbmmem$ randomise -i stats/GM_mod_merg_s2.nii.gz -o stats/fslvbm_rlpn_s2 -m stats/GM_mask -d design_rlpn.mat -t design.con -n 5000 -T -V

Amnesico y no amnesico

Amnesico,

[osotolongo@brick03 grupos]$ awk -F"," '{if ($2=="1") print $1}' amnesia.csv > amnesico.list
[osotolongo@brick03 grupos]$ grep -f amnesico.list bioface_data.csv > amnesico_bioface_data.csv
[osotolongo@brick03 grupos]$ header=`head -n 1 bioface_data.csv`
[osotolongo@brick03 grupos]$ sed -i "1i$header" amnesico_bioface_data.csv 
[osotolongo@brick03 grupos]$ head amnesico_bioface_data.csv
PSubject,Subject,Edad,Sexo,Estudios,FACEmem
B002,0002,53,2,9,48
B004,0004,64,2,7,21
B005,0005,62,2,16,30
B010,0010,62,2,6,17
B012,0012,61,1,12,16
B013,0013,58,2,10,51
B014,0014,62,1,8,22
B017,0016,64,2,20,4
B018,0017,62,2,8,15

No amnesico,

[osotolongo@brick03 grupos]$ awk -F"," '{if ($2=="2") print $1}' amnesia.csv > noamnesico.list
[osotolongo@brick03 grupos]$ grep -f noamnesico.list bioface_data.csv > noamnesico_bioface_data.csv
[osotolongo@brick03 grupos]$ sed -i "1i$header" noamnesico_bioface_data.csv
[osotolongo@brick03 grupos]$ head noamnesico_bioface_data.csv
PSubject,Subject,Edad,Sexo,Estudios,FACEmem
B001,0001,64,1,11,13
B003,0003,60,2,8,10
B006,0006,64,2,5,25
B007,0007,62,2,11,39
B008,0008,58,2,11,45
B009,0009,51,2,11,28
B011,0011,54,2,16,67
B015,0015,59,2,14,57
B020,0019,64,2,8,13
neuroimagen/bioface_vbm.txt · Last modified: 2021/03/22 15:23 by osotolongo