diff --git a/scripts/larvatagger b/scripts/larvatagger index db34a6ccdfeaa2001095bb07d9ec88d562b1fda7..6cf6f487c58bc205f2da46ecb5076f3af731d5fd 100755 --- a/scripts/larvatagger +++ b/scripts/larvatagger @@ -52,7 +52,7 @@ import|merge|--version|-V) LarvaTagger Usage: - larvatagger open <file-path> [--backends=<path>] [--port=<number>] [--quiet] [--viewer] [--browser] [--view-factor=<real>] [--manual-label=<label>] + larvatagger open [<file-path>] [--backends=<path>] [--port=<number>] [--quiet] [--viewer] [--browser] [--view-factor=<real>] [--manual-label=<label>] larvatagger import <input-path> [<output-file>] [--id=<id>] [--framerate=<fps>] [--pixelsize=<μm>] [--overrides=<comma-separated-list>] [--default-label=<label>] [--manual-label=<label>] [--decode] [--copy-labels] larvatagger train <backend-path> <data-path> <model-instance> [--pretrained-model=<instance>] [--labels=<comma-separated-list>] [--sample-size=<N>] [--balancing-strategy=<strategy>] [--class-weights=<csv>] [--manual-label=<label>] [--layers=<N>] [--iterations=<N>] [--seed=<seed>] [--debug] larvatagger train <backend-path> <data-path> <model-instance> --fine-tune=<instance> [--balancing-strategy=<strategy>] [--manual-label=<label>] [--iterations=<N>] [--seed=<seed>] [--debug] @@ -101,6 +101,7 @@ Commands: open Launch the server-based GUI. + The optional positional argument <file-path> can also be the data root directory. Backends defined in LarvaTagger project root directory are automatically found. Other backend locations can be specified with the --backends argument. diff --git a/scripts/larvatagger-gui.jl b/scripts/larvatagger-gui.jl index 8cadce79670ac92b648fccb5e093f32ec6ffa402..36ac2abbfd3b0379a3e28d9d6bd84a44444d9d56 100755 --- a/scripts/larvatagger-gui.jl +++ b/scripts/larvatagger-gui.jl @@ -9,7 +9,9 @@ fi FLAGS= if [ "$1" = "--sysimage" -o "$1" = "-J" ]; then FLAGS="--sysimage $2 "; shift 2; fi if [ "${1:0:2}" = "-J" ]; then FLAGS="$1 "; shift; fi -if [ -n "$1" -a -f "$1" -o "$1" = "blank" ]; then FLAGS="$FLAGS -iq "; fi +HELP= +for i in "$@"; do if [ "$i" = "-h" -o "$i" = "--help" ]; then HELP=1; break; fi; done +if [ -z $HELP ]; then FLAGS="$FLAGS -iq "; fi if [ -z "$JULIA" ]; then JULIA=julia; fi exec $JULIA --project="$PROJECT_DIR" --color=yes --startup-file=no $FLAGS\ "${BASH_SOURCE[0]}" "$@" diff --git a/src/cli.jl b/src/cli.jl index c0a25fbc05090bc4e0ee55eb5c23388c8b7e62d6..23e8fdb34ca5ea3b672fe5da51891cb9c72a8d57 100644 --- a/src/cli.jl +++ b/src/cli.jl @@ -9,7 +9,7 @@ using .Toolkit usage = """Larva Tagger. Usage: - larvatagger.jl open <file-path> [--backends=<path>] [--port=<number>] [--quiet] [--viewer] [--browser] [--view-factor=<real>] [--manual-label=<label>] + larvatagger.jl open [<file-path>] [--backends=<path>] [--port=<number>] [--quiet] [--viewer] [--browser] [--view-factor=<real>] [--manual-label=<label>] larvatagger.jl import <input-path> [<output-file>] [--id=<id>] [--framerate=<fps>] [--pixelsize=<μm>] [--overrides=<comma-separated-list>] [--default-label=<label>] [--manual-label=<label>] [--decode] [--copy-labels] larvatagger.jl train <backend-path> <data-path> <model-instance> [--pretrained-model=<instance>] [--labels=<comma-separated-list>] [--sample-size=<N>] [--balancing-strategy=<strategy>] [--class-weights=<csv>] [--manual-label=<label>] [--layers=<N>] [--iterations=<N>] [--seed=<seed>] [--debug] larvatagger.jl train <backend-path> <data-path> <model-instance> --fine-tune=<instance> [--balancing-strategy=<strategy>] [--manual-label=<label>] [--iterations=<N>] [--seed=<seed>] [--debug] @@ -58,6 +58,7 @@ Commands: open Launch the server-based GUI. + The optional positional argument <file-path> can also be the data root directory. Backends defined in LarvaTagger project root directory are automatically found. Other backend locations can be specified with the --backends argument. diff --git a/src/cli_open.jl b/src/cli_open.jl index c72ecf9bea881fd7afd4f1699b87d3abd3da1fb3..6f10ed66ad59f670a10d2e9d4e5e60061321ac3c 100644 --- a/src/cli_open.jl +++ b/src/cli_open.jl @@ -9,7 +9,7 @@ export main usage = """LarvaTagger.jl - launch the server-based GUI. Usage: - larvatagger-gui.jl <file-path> [--backends=<path>] [--port=<number>] [--quiet] [--viewer] [--browser] [--view-factor=<real>] [--manual-label=<label>] + larvatagger-gui.jl [<file-path>] [--backends=<path>] [--port=<number>] [--quiet] [--viewer] [--browser] [--view-factor=<real>] [--manual-label=<label>] larvatagger-gui.jl -h | --help Options: @@ -22,6 +22,7 @@ Options: --view-factor=<real> Scaling factor for the larva views; default is 2 on macOS, 1 elsewhere. --manual-label=<label> Secondary label for manually labelled data [default: edited]. +The optional positional argument <file-path> can also be the data root directory. Backends defined in LarvaTagger project root directory are automatically found. Other backend locations can be specified with the --backends argument. """ @@ -47,11 +48,17 @@ function main(args=ARGS; exit_on_error=false) verbose = !parsed_args["--quiet"] infile = parsed_args["<file-path>"] - if infile == "blank" + if isempty(infile) infile = nothing elseif !isfile(infile) - @error "File not found; did you specify a file path?" infile - exit() + if isdir(infile) + dataroot = infile + infile = nothing + cd(dataroot) + else + @error "File not found; did you specify a file path?" infile + exit() + end end kwargs = Dict{Symbol, Any}()