-
Notifications
You must be signed in to change notification settings - Fork 6
/
tree_for_mrds_flow.sh
executable file
·48 lines (41 loc) · 1.43 KB
/
tree_for_mrds_flow.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
#!/usr/bin/env bash
usage() { echo "$(basename $0) [-t tractoflow/results] [-o output] [-s tracking]" 1>&2; exit 1; }
while getopts "t:o:s:" args; do
case "${args}" in
t) t=${OPTARG};;
o) o=${OPTARG};;
s) s=${OPTARG};;
*) usage;;
esac
done
shift $((OPTIND-1))
if [ -z "${t}" ] || [ -z "${o}" ] || [ -z "${s}" ]; then
usage
fi
if [ "${s}" != "local_tracking" ] && [ "${s}" != "pft_tracking" ]; then
echo "Invalid tracking type: ${s}"
echo "Valid options for -s are 'local_tracking' or 'pft_tracking'."
exit 1
fi
echo "tractoflow folder: ${t}"
echo "Output folder: ${o}"
echo "Tracking type: ${s}"
echo "Building tree for the following folders:"
cd $t
for i in *[!{FRF}];
do
echo $i
mkdir -p $o/$i
ln -s ${t}/${i}/Resample_DWI/*dwi_resampled.nii.gz ${o}/${i}/dwi.nii.gz
ln -s ${t}/${i}/Eddy_Topup/*dwi_eddy_corrected.bvec ${o}/${i}/dwi.bvec
ln -s ${t}/${i}/Eddy_Topup/*bval_eddy ${o}/${i}/dwi.bval
if [ "$s" == "local_tracking" ]; then
ln -s ${t}/${i}/Local_Tracking/*local_tracking*.trk ${o}/${i}/local_tracking.trk
ln -s ${t}/${i}/Local_Tracking_Mask/*local_tracking_mask.nii.gz ${o}/${i}/mask.nii.gz
elif [ "$s" == "pft_tracking" ]; then
ln -s ${t}/${i}/PFT_Tracking/*pft_tracking*.trk ${o}/${i}/pft_tracking.trk
ln -s ${t}/${i}/PFT_Tracking_Maps/*map_include.nii.gz ${o}/${i}/mask.nii.gz
fi
done
rm -rf ${o}/Readme*
rm -rf ${o}/Read_BIDS