-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrun_all_in_dir.sh
executable file
·79 lines (63 loc) · 1.5 KB
/
run_all_in_dir.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
75
76
77
78
79
#!/bin/bash
set -x
# runs all images in images/ directory.
# puts per-image results in output/ directory.
# puts aggregate results in webpage/ directory.
indir="$1"
if [[ -z $indir ]]; then
indir="images"
fi
mkdir -p webpage
mkdir -p applications
mkdir -p output
html="webpage/index.html"
rows="/tmp/rows.html"
rm -f $rows
touch $rows
for p in 5 4 6; do
for image in $indir/*; do
base="`basename ${image%.*}`"
input="${base}.png"
dir="${base}-${p}"
if [ -d output/$dir ]; then
mv output/$dir $dir
else
./run_one_image.sh $image $p
fi
pattern="$dir/*-final_recursivelevel--fixed_KS-reconstructed.png"
files=( $pattern )
output="${files[0]}"
rmse="`grep RMSE $dir/log.txt | sed 's/RGB\ RMSE://' | tr -d ' ' | tr '\n' ' '`"
cat <<EOF >>$rows
<tr> \
<td><pre><a href="$dir/index.html">$dir</a></pre></td> \
<td><img width="300" src="$dir/$input"></td> \
<td><img height="50" style="border:10px solid gray" src="$dir/primary_pigments_color-${p}.png"></td> \
<td><pre>$rmse</pre></td> \
</tr>
EOF
mkdir -p webpage/$dir
mkdir -p applications/$dir
cp $dir/$input \
$dir/index.html \
$dir/log.txt \
$dir/primary_pigments_color-${p}.png \
$dir/primary_pigments_*_curve-*.png \
$dir/Application_Files/*-KM_*.png \
$dir/Application_Files/*-PD_*.png \
webpage/$dir
cp -r $dir/Application_Files applications/$dir
mv $dir output/
done
done
cat <<EOF >$html
<html>
<body>
<table width="100%">
EOF
cat $rows | sort >>$html
cat <<EOF >>$html
</table>
</body>
</html>
EOF