-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfabber_var
More file actions
48 lines (40 loc) · 1.27 KB
/
fabber_var
File metadata and controls
48 lines (40 loc) · 1.27 KB
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
#!/bin/sh
# fabber_var
# Calculate variances from fabber results (using zstat and mean images)
# M Chappell 1/11/2007
# Analysis Group, FMRIB, University of Oxford
# HISTORY
# 13-12-2007 Update to use mvntool to get varainces directly from the saved mvn (rather than from the z-stat)
# 26-11-2008 Add option to only extract varaince of a specified parameter
# 29-8-2013 Add anchors to grep expression to find exact match for a parameter name
#deal with options
# Copyright (C) 2007-2012 University of Oxford
#
# SHCOPYRIGHT
until [ -z $1 ]; do
case $1 in
-d) dirflag=1 datdir=$2;;
-m) maskflag=1 mask=$2;;
-p) paramflag=1 params=$2;; #parameter name, or comma separated list
esac
shift
done
echo "Fabber variance calculator"
echo "Working in $datdir"
if [ -z $paramflag ]; then
params=`cat $datdir/paramnames.txt`
else
params=`echo $params | sed 's:,: :g'`
fi
#index=1
for param in $params; do
index=`grep -n ^$param$ $datdir/paramnames.txt | sed -n 's/^\([0-9]*\)[:].*/\1/p'`
if [ -z $index ];then
echo "Parameter $param not found - skipping"
else
echo "Calculating variance for: $param"
mvntool --input=$datdir/finalMVN --mask=$mask --output=$datdir/var_$param --param=$index --var
fi
#index=`echo "$index +1" | bc`
done
echo "Done."