-
Notifications
You must be signed in to change notification settings - Fork 1
/
basil_var.in
executable file
·67 lines (55 loc) · 1.57 KB
/
basil_var.in
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
#!/bin/sh
# basil_var
# Variance calculator for BASIL
# Calculates variance for all parameters in all the steps using fabber_var
# M Chappell 1/11/2007 and M Webster
# Analysis Group, FMRIB, University of Oxford
#HISTORY
#13-12-2007 Update to work with new fabber_var (requries mask)
#deal with options
# Copyright (C) 2007-2012 University of Oxford
# SHCOPYRIGHT
# Make script use local copies of helper scripts/programs in the same
# directory, if present. This allows for multiple versions of the scripts
# to be used, possibly with bundled dependencies
PATH=`dirname $0`:${FSLDIR}/bin:${PATH}
if [ -z $1 ]; then
echo "Variance calculator for BASIL @GIT_SHA1@ (@GIT_DATE@)"
echo ""
echo "Usage:"
echo "-d : BASIL results directory"
echo "-m : mask"
echo ""
break
else
fabber_var=fabber_var
until [ -z $1 ]; do
case $1 in
-d) dirflag=1 datdir=$2;;
-m) maskflag=1 mask=$2;;
-c) trashflag=1;;
esac
shift
done
echo "BASIL variance calcualtor '@GIT_SHA1@' '@GIT_DATE@'"
echo "Working in $datdir"
steps=`ls -d $datdir/step[0-9]`
if [ ! -z $trashflag ]; then
# Remove extra NLLS outputs
echo "Delting model fit and residual images from NLLS to save space"
rm $datdir/step?/residuals.nii.gz
rm $datdir/step?/modelfit.nii.gz
fi
for step in $steps; do
echo "Calculating variances in $step"
$fabber_var -d $step -m $mask
if [ ! -z $trashflag ]; then
#echo "Deleting z-stat images to save space"
#rm $step/zstat_*
echo "Compacting logfile"
zip $step/logfile $step/logfile
rm $step/logfile
fi
done
fi
echo "Done."