diff --git a/Makefile b/Makefile index 4258f06..e84de6b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ export CFLAGS = -O1 -.PHONY: all default clean test +.PHONY: all default clean test bin default: all @@ -11,7 +11,12 @@ all: clean: $(MAKE) clean -C src/regions $(MAKE) clean -C src/czinspect + $(RM) ./bin/get_region ./bin/czinspect test: $(MAKE) test -C src/regions $(MAKE) test -C src/czinspect + +bin: all + ln -s ./src/regions/get_region ./bin/get_region + ln -s ./src/czinspect/czinspect ./bin/czinspect diff --git a/bin/batch.sh b/bin/batch.sh index 871052d..7e3312d 100755 --- a/bin/batch.sh +++ b/bin/batch.sh @@ -2,17 +2,19 @@ set -e -DECZI="deczi.sh" +CZINSPECT="czinspect" usage () { cat< - Options: - -d Directory to extract image tiles to (implies extraction should be performed) - -f Specify subsampling level to filter for - -p Convert extracted images to PNG after converting from JXR to TIFF - -h Print this help message +This a wrapper script around czinspect, and will pass most options directly to +czinspect. + +czinspect's help text: +--- +$($CZINSPECT $opts -h $*) +--- EOF } @@ -21,21 +23,24 @@ error () { exit 1 } -while getopts ":d:f:ph" opt; do +outdir="" +opts="" + +while getopts "Ehd:aes:" opt; do case $opt in d) outdir="$OPTARG" ;; - f) - decziopts="$decziopts -$opt $OPTARG" - ;; - p) - decziopts="$decziopts -$opt" - ;; h) usage exit 0 ;; + E|a|e) + opts="$opts -$opt" + ;; + s) + opts="$opts -$opt $OPTARG" + ;; esac done @@ -45,10 +50,14 @@ if (( $# == 0 )); then error "Missing input directory" fi +if [[ -z "$outdir" ]]; then + error "Missing output directory" +fi + INDIR="$1" indirsafe="$(echo $INDIR | sed 's/[[\.*^$,]/\\&/g')" -find $INDIR -name '*.czi' \ +find $INDIR -maxdepth 1 -name '*.czi' \ | xargs -I'{}' sh -c "out=\"\$(echo '{}' \ | sed 's,$indirsafe/*\(.*\).czi\$,$outdir/\1,g')\" ; \ - mkdir -p \"\$out\" ; '$DECZI' -d\"\$out\" '{}'" + mkdir -p \"\$out\" ; '$CZINSPECT' $opts -d\"\$out\" '{}'" diff --git a/bin/deczi.sh b/bin/deczi-extractjxr.sh similarity index 100% rename from bin/deczi.sh rename to bin/deczi-extractjxr.sh