Login  Register

Accepting multiple args in batch processing mode

Posted by Lincoln Bryant on Aug 03, 2015; 3:07pm
URL: http://imagej.273.s1.nabble.com/Accepting-multiple-args-in-batch-processing-mode-tp5013870.html

Greetings ImageJ experts,

I’m attempting to pass multiple arguments to an ImageJ macro via the commandline. However, it seems that getArgument() can only be called once, and only accepts one argument from the CLI. Here’s a simple demonstration of what I mean:

My macro file:

        dir = getArgument();
        print("Processing directory: "+dir);

        range = getArgument();
        print("Range: "+range);

Then I execute it:

        $ ImageJ-linux64 -batch test.ijm foo bar
        No GUI detected.  Falling back to headless mode.
        No GUI detected.  Falling back to headless mode.
        Processing directory: foo
        Range: foo
        Unsupported format or not found

Is there any way to do this nicely? I have considered using bash getopts to hack around this by editing the macro file in situ, but I’d really prefer a cleaner solution.

This is for a batch processing environment, so using the GUI isn’t possible.

Thanks much,
Lincoln
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html