-
Notifications
You must be signed in to change notification settings - Fork 6
/
FSaverage2FSnative.sh
44 lines (34 loc) · 1.51 KB
/
FSaverage2FSnative.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
#First paratemer $sub is the name of the folder of the subject that want to be processed
#Second parameter is the folder where the freesurfer folders are located
sub=$1
SUBJECTS_DIR=$2
fsaverage_subid=fsaverage
cd $SUBJECTS_DIR
if [ -f ${SUBJECTS_DIR}/${sub}/label/rh.aparc.annot ] && [ ! "${sub}" = 'fsaverageSubP' ]; then
echo ${SUBJECTS_DIR}/${sub}
for parcellation in 500.aparc ; do
for hemi in lh rh ; do
if [ ! -f ${SUBJECTS_DIR}/${sub}/label/${hemi}.${parcellation}.annot ]; then
mri_surf2surf --srcsubject ${fsaverage_subid} \
--sval-annot ${SUBJECTS_DIR}/${fsaverage_subid}/label/${hemi}.${parcellation} \
--trgsubject ${sub} \
--trgsurfval ${SUBJECTS_DIR}/${sub}/label/${hemi}.${parcellation} \
--hemi ${hemi}
fi
done
if [ ! -f ${SUBJECTS_DIR}/${sub}/parcellation/${parcellation}.nii.gz ]; then
mkdir ${SUBJECTS_DIR}/${sub}/parcellation/
mri_aparc2aseg --s ${sub} \
--o ${SUBJECTS_DIR}/${sub}/parcellation/${parcellation}.nii.gz \
--annot ${parcellation} \
--rip-unknown \
--hypo-as-wm
fi
for hemi in lh rh ; do
if [ ! -s ${SUBJECTS_DIR}/${sub}/stats/${hemi}.${parcellation}.log ]; then
mris_anatomical_stats -a ${SUBJECTS_DIR}/${sub}/label/${hemi}.${parcellation}.annot -b ${sub} ${hemi} > ${SUBJECTS_DIR}/${sub}/stats/${hemi}.${parcellation}.log
fi
done
done
fi