-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpost.sh
executable file
·77 lines (60 loc) · 1.35 KB
/
post.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
#!/bin/bash
#
# Copyright 2020. Uecker Lab, University Medical Center Goettingen.
#
# Author: Xiaoqing Wang, 2020
#
# Wang X et al.
# Model‐Based Reconstruction for Simultaneous Multi‐Slice T1 Mapping
# using Single‐Shot Inversion‐Recovery Radial FLASH.
# Magn Reson Med. 2020
#
set -e
usage="Usage: $0 [-R TR] [-r res] <reco> <t1map>"
if [ $# -lt 2 ] ; then
echo "$usage" >&2
exit 1
fi
while getopts "hR:r:" opt; do
case $opt in
h)
echo "$usage"
exit 0
;;
R)
TR=${OPTARG}
;;
r)
res=${OPTARG}
;;
\?)
echo "$usage" >&2
exit 1
;;
esac
done
shift $(($OPTIND -1 ))
reco=$(readlink -f "$1")
t1map=$(readlink -f "$2")
TR=$TR
res=$res
if [ ! -e $reco ] ; then
echo "Input file 'reco' does not exist." >&2
echo "$usage" >&2
exit 1
fi
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.7.00"
#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
t=$(echo $TR 1e-3 | awk '{printf "%4.4f\n",$1*$2}')
bart looklocker -t0.0 -D15.3e-3 $reco map
bart resize -c 0 $res 1 $res map $t1map