-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
executable file
·111 lines (86 loc) · 2.51 KB
/
run.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
startTime=`date +%s`
function launch {
echo "*************************************************************"
echo "Executing : $1 "
$1
echo "*************************************************************"
}
# Inspired by NiftyReg script : https://sourceforge.net/p/niftyreg/git/ci/master/tree/reg-apps/groupwise_niftyreg_run.sh
if [ $# -lt 1 ]
then
echo ""
echo "*******************************************************************************"
echo "One argument is expected to run this script:"
echo "- File with contains parameters"
echo "example: $0 params.sh "
echo "*******************************************************************************"
echo ""
exit
fi
# read input parameters
. $1
# check arguments
if [ ${#IMG_INPUT[@]} -lt 2 ]
then
echo "Less than 2 images have been specified"
echo "Exit ..."
exit
fi
IMG_NUMBER=${#IMG_INPUT[@]}
echo ""
echo "******************************************************"
echo ">>> There are ${IMG_NUMBER} input images to register :"
for (( CUR_IT=0; CUR_IT<${IMG_NUMBER}; CUR_IT++ ))
do
echo ${IMG_INPUT[CUR_IT]}
done
echo "******************************************************"
# SETUP EXECUTABLES
ROOT_DIR=$(cd `dirname $0` && pwd)
SURF=$ROOT_DIR/bin/surf3d
MATCH=$ROOT_DIR/bin/match
REG=$ROOT_DIR/bin/frog
# CREATE THE RESULT FOLDER
if [ ! -d ${RES_FOLDER} ]
then
echo "The output image folder (${RES_FOLDER}) does not exist"
mkdir ${RES_FOLDER}
if [ ! -d ${RES_FOLDER} ]
then
echo "Unable to create the ${RES_FOLDER} folder"
echo "Exit ..."
exit
else
echo "The output image folder (${RES_FOLDER}) has been created"
fi
fi
cd $RES_FOLDER
PointsFile=points.txt;
if [ -f ${PointsFile} ]
then
rm ${PointsFile}
fi
for (( CUR_IT=0; CUR_IT<${IMG_NUMBER}; CUR_IT++ ))
do
IMG=${IMG_INPUT[CUR_IT]};
OUTPUT_POINTS=$RES_FOLDER/points$CUR_IT
launch "$SURF $IMG -o $OUTPUT_POINTS -s $SPACING -t $THRESHOLD -n $NPOINTS $SURF_OTHER_PARAMS"
echo ${OUTPUT_POINTS}.csv.gz>> ${PointsFile}
done
matchTime=`date +%s`
OUTPUT_PAIRS=pairs.bin
launch "$MATCH $PointsFile -o $OUTPUT_PAIRS -d $MAX_DISTANCE $MATCH_OTHER_PARAMS"
if [ -n "$LANDMARKS" ]
then
LOPTIONS="-l ${LANDMARKS}"
else
LOPTIONS=""
fi
registrationTime=`date +%s`
launch "$REG $OUTPUT_PAIRS $LOPTIONS $REGISTRATION_OTHER_PARAMS"
endTime=`date +%s`
echo "Keypoint extraction time : $((matchTime-startTime)) seconds"
echo "Match time : $((registrationTime-matchTime)) seconds"
echo "Registration time : $((endTime-registrationTime)) seconds"
echo "Total registration time : $((endTime-startTime)) seconds"