-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspiromics.sh
executable file
·105 lines (68 loc) · 2.15 KB
/
spiromics.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# the new version script to modulize the spiromics
# module1: lung segmentation: (final result: smoothlungs ==> separate.nii.gz)
# module2: compute individual metric
# module3: segment vessels
# module4: segment airways
# compute the metric
# http://ntustison.wikidot.com/gsk-pipeline:spiromics-pipeline-on-gsk-data
make_metric_dir(){
local RESDIR=$1
if [ -f $RESDIR ]
then
echo 'As a file: ' $RESDIR
rm $RESDIR
fi
if [ ! -d $RESDIR ]
then
echo creating $RESDIR
mkdir -p $RESDIR
fi
}
func(){
dList
for mysubject in $subjectlist
do
echo process: $dbroot/$mysubject
for myphase in $phaselist
do
myimg=$myphase
echo ===========================================================
echo image: $myimg
LUNGIMG=$dbroot/$mysubject/$myphase'.nii.gz'
LUNGNAME=$myimg
SEGDIR=$RESROOT/$mysubject/segmentation/$myimg
LUNGMASK=$SEGDIR/$myimg'_smooth.nii.gz'
PREDIR=$RESROOT/$mysubject/preprocess/$myimg
LUNGONLYMASK=$PREDIR/$myimg'_lungonlymask.nii.gz'
MASKEDLUNG=$PREDIR/$myimg'_masked.nii.gz'
if [ ! -f $IMG ]
then
echo $IMG does not exist!
continue
fi
make_metric_dir $SEGDIR
make_metric_dir $PREDIR
make_metric_dir $CURDIR/tmp_script
TMPQSUB_FILE=$CURDIR/"tmp_script/feature-"$myimg".sh"
touch $TMPQSUB_FILE
echo "#!/bin/bash" > $TMPQSUB_FILE
echo bash $CURDIR/seglungc.sh $LUNGIMG $SEGDIR $LUNGMASK $LUNGNAME >> $TMPQSUB_FILE
echo bash $CURDIR/masklungc.sh $LUNGIMG $LUNGMASK $LUNGONLYMASK $MASKEDLUNG >> $TMPQSUB_FILE
# sleep 2
# /bin/bash $TMPQSUB_FILE
# itksnap -g $LUNGIMG -s $AIRWAYMASK
# qsub -q mac -S /bin/bash -N "leakage-"${myimg}".sh" -j y -o $CURDIR/"tmp_script" $TMPQSUB_FILE
ssh compute-1-13 bash $TMPQSUB_FILE
# break
done
# break
done
}
# to obtain $dbroot $mydate $myimg
# . dblist.sh
. dblist.sh
RESROOT=/home/songgang/picsl/project/GermanLung/output
CURDIR=`pwd`
echo $datelist
func