forked from npnl/ENIGMA-Wrapper-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1a_enigma_runfreesurfer_loop.sh
64 lines (54 loc) · 1.61 KB
/
1a_enigma_runfreesurfer_loop.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#####
# 11/18/15
# Written by Sook-Lei Liew ([email protected])
#
# Purpose: Runs freesurfer recon-all on all subjects in inputs directory
#
# Usage: ./1a_enigma_runfreesurfer_loop.sh <parent directory of project>
# Ex: ./1_enigma_runfreesurfer.sh /Users/sliew/data/enigma_project_parent_directory
#
# NOTE: all subjects in input dir should start with "sub" (e.g., sub01, sub02..)
#
# Script assumes the following structure
# Project_parent_directory/
# -> inputs/
# -> subj01/ (contains nii input named subj01.nii.gz))
# -> subj02/ (contains nii input named subj02.nii.gz))
# ...
# -> outputs/
# -> subj01 (where freesurfer outputs will go)
# -> subj02 (where freesurfer outputs will go)
# -> cortical/subcortical output folders will also be directed here
# ...
#
# -> enigma_wrapscripts/ (from ENIGMA protocols; should be copied from the github)
##
# Troubleshooting questions can be directed to [email protected] and [email protected]
#
######
enigmadir=$1
if [ -z ${enigmadir} ]; then
echo "Parent directory of 'inputs' folder must be specified"
echo "Usage is: ./1a_enigma_runfreesurfer_loop.sh <parent directory of project>"
exit
fi
if [ $# -gt 1 ] ; then
echo "Too many arguments specified"
echo "Usage is: ./1a_enigma_runfreesurfer_loop.sh <parent directory of project>"
exit
fi
if [ ! -e ${enigmadir} ] ; then
echo "Input directory does not exist! Please check"
exit
fi
################
cd ${enigmadir}
pwd
cd ${enigmadir}/inputs
ls sub*
for SUB in sub*
do
echo Now running freesurfer on $SUB
${enigmadir}/1_enigma_runfreesurfer.sh $SUB ${enigmadir}
done