-
Notifications
You must be signed in to change notification settings - Fork 0
/
C.run_T1fit_TIGER.sh
executable file
·78 lines (73 loc) · 2.53 KB
/
C.run_T1fit_TIGER.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
78
#! /bin/bash
#Usage: ./run_T1fit_TIGER.sh
#A pipenv with python 2.7 and nipype package installed is used to run this script
fp=/Volumes/group/proc/TIGERanalysis/qT1/subjDir
scpt=/Volumes/group/proc/TIGERanalysis/qT1/scripts
cd $fp
subs=$(ls)
for sub in $subs ; do
pe1=$fp/$sub/raw/qt1_pe1.nii.gz
pe0=$fp/$sub/raw/qt1_pe0.nii.gz
#if running Lucas data, use --cal = 1
#if running CNI ddata, use --cal = 2 or don't include --cal
if [ -e $fp/$sub/qt1_T1fit_final.nii.gz ] ; then
echo '** T1fit already computed for' $sub '**'
else
cd $scpt
#python2.7 t1fit_unwarp_2.7.py --tr 3000 --ti 50 --cal 2 --pe1 $pe1 $pe0 $fp/$sub/
echo '<><><> Attempting to run' $sub '<><><>'
python old_t1fitter_scripts/t1fit_unwarp.py --tr 3000 --ti 50 --cal 2 --pe1 $pe1 $pe0 $fp/${sub}/
fi
cd $fp/$sub
if [ -e *_t1.nii.gz ] ; then
mv *_t1.nii.gz qt1_T1fit_final.nii.gz
# echo '** Files already tarred for' $sub '**'
# if [ -e *.tgz ] ; then
# rm *.tgz
# echo 'Tarring extra files'
# mv *_t1.nii.gz qt1_T1fit_final.nii.gz
# tar -cvzf t1fit_other.tgz _*
# mkdir $fp/delete
# mkdir $fp/$sub/${sub}_delete
# mv _* $fp/$sub/${sub}_delete
# mv $fp/$sub/${sub}_delete $fp/delete/
# echo 'Successfully completed' $sub
# else
# echo 'T1fitter output exists, tarring extra files'
# mv *_t1.nii.gz qt1_T1fit_final.nii.gz
# tar -cvzf t1fit_other.tgz _*
# mkdir $fp/delete
# mkdir $fp/$sub/${sub}_delete
# mv _* $fp/$sub/${sub}_delete
# mv $fp/$sub/${sub}_delete $fp/delete/
# echo 'Successfully completed' $sub
# fi
elif [ -e *_t1.nii ] ; then
mv *_t1.nii qt1_T1fit_final.nii
gzip qt1_T1fit_final.nii
# if [ -e *.tgz ] ; then
# rm *.tgz
# echo 'T1fitter output exists, tarring extra files'
# mv *_t1.nii qt1_T1fit_final.nii
# gzip qt1_T1fit_final.nii
# tar -cvzf t1fit_other.tgz _*
# mkdir $fp/delete
# mkdir $fp/$sub/${sub}_delete
# mv _* $fp/$sub/${sub}_delete
# mv $fp/$sub/${sub}_delete $fp/delete/
# echo 'Successfully completed' $sub
# else
# echo 'T1fitter output exists, tarring extra files'
# mv *_t1.nii qt1_T1fit_final.nii
# gzip qt1_T1fit_final.nii
# tar -cvzf t1fit_other.tgz _*
# mkdir $fp/delete
# mkdir $fp/$sub/${sub}_delete
# mv _* $fp/$sub/${sub}_delete
# mv $fp/$sub/${sub}_delete $fp/delete/
# echo 'Successfully completed' $sub
# fi
else
echo 'Could not find T1fitter output for' $sub
fi
done