-
Notifications
You must be signed in to change notification settings - Fork 4
/
example_wrapper.sh
executable file
·77 lines (68 loc) · 2.93 KB
/
example_wrapper.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
#=============================================================================
# This script is a little loop that downloads the code from GitHub
# and runs the dti_processing and mprage and registrations scripts.
# You should download this to your data directory, and then edit it
# as needed.
#
# There should be a file called sublist in your data directory (where you save
# this wrapper script) that contains the subject IDs.
#
# In this example your data is in a folder called SUB_DATA (which is inside
# the data directory) and then inside folders named using the subject IDs
# (as listed in the sublist file described above).
#
# Every subject has a directory called DTI, which contains the DTI data,
# MPRAGE which contains the high resolution data, and REG, which will contain
# the registrations from the various spaces to each other.
#
# If you have any questions please do email Kirstie at kw401@cam.ac.uk
#
# October 25th 2013
#=============================================================================
####
# Set up the test directory variables
dir=`pwd`
sublist=${dir}/sublist
####
# Create the SCRIPTS directory
mkdir -p ${dir}/SCRIPTS
####
# Download the code from GitHub
rm -f ${dir}/SCRIPTS/DTI_PROCESSING
wget -O ${dir}/SCRIPTS/DTI_PROCESSING https://github.com/HappyPenguin/DTI_PROCESSING/archive/master.zip
####
# Unzip the DTI_PROCESSING
#+ -o option forces overwrite
#+ -f option only refreshes files that have changed
unzip -o ${dir}/SCRIPTS/DTI_PROCESSING -d ${dir}/SCRIPTS/
####
# Make all files executable
chmod +x ${dir}/SCRIPTS/DTI_PROCESSING-master/*
####
# Convert all files from dos to unix
dos2unix ${dir}/SCRIPTS/DTI_PROCESSING-master/*
# This is a really important step btw
#+ you get uninteligable error messages if you don't run it!
####
# Decide on your bedpostx and freesufer options
bedpostx_option=yes
freesurfer_option=yes
####
# Run the code!
for sub in `cat ${sublist}`; do
echo ${sub}
${dir}/SCRIPTS/DTI_PROCESSING-master/dti_preprocessing.sh ${dir}/SUB_DATA/${sub}/DTI/ ${sub} ${bedpostx_option}
${dir}/SCRIPTS/DTI_PROCESSING-master/mprage_processing.sh ${dir}/SUB_DATA/${sub}/MPRAGE/ ${sub} ${freesurfer_option}
if [[ ${freesurfer_option} == 'yes' ]]; then
${dir}/SCRIPTS/DTI_PROCESSING-master/registrations.sh ${dir}/SUB_DATA/${sub}/DTI/ \
${dir}/SUB_DATA/${sub}/MPRAGE/ \
${dir}/SUB_DATA/${sub}/SURFER/ \
${dir}/SUB_DATA/${sub}/REG/
else
${dir}/SCRIPTS/DTI_PROCESSING-master/registrations.sh ${dir}/SUB_DATA/${sub}/DTI/ \
${dir}/SUB_DATA/${sub}/MPRAGE/ \
NO \
${dir}/SUB_DATA/${sub}/REG/
fi
done