-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_pipeline.sh
49 lines (39 loc) · 1.34 KB
/
run_pipeline.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
#!/bin/bash
SELF_DIR=$(dirname "$(readlink -f "$0")")
# Required folders
SETUP_DIR=${SELF_DIR}/setup
SCRIPTS_DIR=${SELF_DIR}/scripts
DATA_DIR=${SELF_DIR}/Original
# File structure folders
REG_DIR=${SELF_DIR}/Registered
DOFS_DIR=${REG_DIR}/dofs
MNI_SPACE_DIR=${REG_DIR}/MNI_space
MPRAGE_SPACE_DIR=${REG_DIR}/MPRAGE_space
if [[ ! -d ${DATA_DIR} ]]; then
echo "ERROR: No original data folder found!"
exit 1
fi
# Create necessary structure directories if they do not exist
mkdir -p ${DOFS_DIR}
mkdir -p ${MNI_SPACE_DIR}
mkdir -p ${MPRAGE_SPACE_DIR}
# Load enviromental variables and neuromelanin-sensitive sequence types
source ${SETUP_DIR}/SetUpVariables.sh
source ${SETUP_DIR}/SetUpNMTypes.sh
# Run pipeline for all subjects
for img_file in ${DATA_DIR}/sub-*_T1w.nii.gz; do
sub_id=`basename ${img_file} | sed s/_T1w.nii.gz//g`
flag_file=`echo ${img_file} | sed s/_T1w.nii.gz/.processed/g`
if [[ ! -f ${flag_file} ]]; then
${SCRIPTS_DIR}/process_t1w_image.sh ${sub_id}
${SCRIPTS_DIR}/t1w_to_mni_registration.sh ${sub_id}
for seq_type in ${NM_TYPE_ARRAY[@]}; do
${SCRIPTS_DIR}/process_nm_image.sh ${sub_id} ${seq_type}
${SCRIPTS_DIR}/create_synth_image.sh ${sub_id} ${seq_type}
${SCRIPTS_DIR}/propagate_image.sh ${sub_id} ${seq_type}
done
touch ${flag_file}
else
echo "Subject '${sub_id}' has already been processed. Skipping."
fi
done