Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to select output file format #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions dalliclick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ HEIGHT=766
GENERATE_MASK=0
NUMSEGMENTS=10
RESULTIMAGEBASE_GIVEN=1
OUTPUTFILEFORMAT=png
# do all output operations in a temporary dir? where should this be located?
GENTMPDIR=0
# OUTPUTDIR=`pwd`
Expand All @@ -72,6 +73,7 @@ function usage {
echo "-b background (canvas) image"
echo "-m maskimage (with label gray values 1,2,3,...)"
echo "-t do not generate temporary directory (working dir is used)"
echo "-O format of output files (png)"
[[ $# -eq 1 ]] && exit $1 || exit $EXIT_FAILURE
}

Expand Down Expand Up @@ -174,7 +176,7 @@ fi
# parse options
# Option -h (help) should always be there
# if you have an option argument to be parsed use ':' after option
while getopts ':n:i:b:m:o:vht' OPTION ; do
while getopts ':n:i:b:m:o:O:vht' OPTION ; do
case $OPTION in
v) VERBOSE=0
;;
Expand All @@ -189,6 +191,8 @@ while getopts ':n:i:b:m:o:vht' OPTION ; do
RESULTIMAGEBASE_GIVEN=0
echo "given basename: "$RESULTIMAGEBASE;
;;
O) OUTPUTFILEFORMAT="$OPTARG"
;;
b) BACKGROUNDIMAGENAME="$OPTARG"
GENERATE_BACKGROUND=1
;;
Expand Down Expand Up @@ -261,7 +265,7 @@ do

for THRESHOLD in `seq -w 0 1 "$NUMSEGMENTS"`
do
RESULTIMAGE="${RESULTIMAGEBASE}_$THRESHOLD.png"
RESULTIMAGE="${RESULTIMAGEBASE}_$THRESHOLD.$OUTPUTFILEFORMAT"
# debug: THRESHOLD=2
# generate black/white image from mask
# this is something to be worked out:
Expand Down