-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_test
executable file
·50 lines (41 loc) · 1.31 KB
/
run_test
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
#!/bin/bash
if [ $# == 0 ]; then
mrtrix_location=~/mrtrix3
else
mrtrix_location="$1"
fi
TMPFILE=/tmp/__mrtrix_testing_tmp_$$.mif
echo testing using MRtrix3 found in \"$mrtrix_location\"
(
cd "$mrtrix_location"/testing
../build ../bin/mrconvert ../bin/mrinfo bin/testing_diff_image bin/testing_diff_header
)
export PATH="$mrtrix_location"/bin:"$mrtrix_location"/testing/bin:$PATH
if [[ "$2"x != "x" ]]; then
target_folders=("$2")
else
target_folders=(*/)
fi
for folder in "${target_folders[@]}"; do (
echo in \"$folder\"...
cd "$folder"
for image in *; do
sequence=$(echo "${image%.*}" | mrinfo ../../"$folder" -property comments 2>/dev/null | grep '\[MR\]')
echo -n " [ ${image%.*} ] ${sequence#*\[MR\] }: "
rm -f $TMPFILE 2>/dev/null
{
echo "${image%.*}" | mrconvert ../../"$folder" $TMPFILE 2>/dev/null &&
testing_diff_image $TMPFILE "$image" -frac 1e-6 -quiet &&
testing_diff_header $TMPFILE "$image" -keyval -quiet &&
echo OK
} || {
echo ""
echo "############################################################"
echo " ERROR: image $image (${sequence#*\[MR\]}) in folder $folder"
echo "############################################################"
echo ""
}
#mv $TMPFILE "$image"
done
) done
rm -f $TMPFILE 2>/dev/null