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/sh
##
## Copyright 2007-2011, 2014 SRI International
##
## This file is part of the Computational Morphometry Toolkit.
##
## http://www.nitrc.org/projects/cmtk/
##
## The Computational Morphometry Toolkit is free software: you can
## redistribute it and/or modify it under the terms of the GNU General Public
## License as published by the Free Software Foundation, either version 3 of
## the License, or (at your option) any later version.
##
## The Computational Morphometry Toolkit is distributed in the hope that it
## will be useful, but WITHOUT ANY WARRANTY; without even the implied
## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along
## with the Computational Morphometry Toolkit. If not, see
## <http://www.gnu.org/licenses/>.
##
## $Revision: 5378 $
##
## $LastChangedDate: 2015-01-17 11:31:55 -0800 (Sat, 17 Jan 2015) $
##
## $LastChangedBy: torstenrohlfing $
##
export CMTK_BINARY_DIR=${CMTK_BINARY_DIR:-@CMTK_BINARY_DIR_CONFIG@}
# Check whether we have "lockfile" tool available and include proper script with locking functions
if which lockfile > /dev/null; then
. ${CMTK_BINARY_DIR}/cmtk_locking_procmail.sh
else
. ${CMTK_BINARY_DIR}/cmtk_locking.sh
fi
# For convenience and readability
cmtk()
{
${CMTK_BINARY_DIR}/$*
}
#
# Given a .hdr file name, compress corresponding .img file.
#
gzip_hdr_img()
{
for i in $*; do
local img=`echo ${i} | sed 's/\.hdr/\.img/g'`
gzip -9f ${img}
done
}
#
# Echo a command line, then execute it.
#
echo_and_exec()
{
echo $*
$*
}
#
# Find file in list of paths
#
find_file()
{
local file=$1
shift
for d in $*; do
test -e ${d}/${file} && echo ${d}/${file} && return
done
echo "COULD NOT FIND: $file" > /dev/stderr
}
|