-
Notifications
You must be signed in to change notification settings - Fork 2
/
mapsproj
executable file
·69 lines (47 loc) · 1.15 KB
/
mapsproj
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
set -e
if [ ! -e $TOOLBOX_PATH/bart ] ; then
echo "\$TOOLBOX_PATH is not set correctly!" >&2
exit 1
fi
export PATH=$TOOLBOX_PATH:$PATH
export BART_COMPAT_VERSION="v0.4.04"
RVC=0
while getopts "c" opt; do
case $opt in
c)
RVC=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
shift $((OPTIND-1))
if [ $# -lt 3 ] ; then
echo "Usage: $0 <kspace> <maps> <output>"
exit 1
fi
kspace=$(readlink -f "$1")
maps=$(readlink -f "$2")
output=$(readlink -f "$3")
#WORKDIR=$(mktemp -d)
# Mac: http://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x
WORKDIR=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`
trap 'rm -rf "$WORKDIR"' EXIT
cd $WORKDIR
# Alternative implementation using pocsense
#pocsense 1. 1 $kspace $maps proj.coo
#sub $kspace proj.coo diff.coo
#fft -i -u 7 diff.coo idiff.coo
#rss 8 idiff.coo $output
bart fft -i -u 7 $kspace cimg.coo
bart fmac -C -s8 cimg.coo $maps img.coo
if [ $RVC = 1 ]; then
bart creal img.coo imgR.coo
bart fmac -s16 imgR.coo $maps proj.coo
else
bart fmac -s16 img.coo $maps proj.coo
fi
bart saxpy -- -1. cimg.coo proj.coo idiff.coo
bart rss 8 idiff.coo $output