Fiji equivalent to ImageJ command line?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Fiji equivalent to ImageJ command line?

Emmanuel Levy
Hello,

I would like to run (multiple instance of) Fiji from the command line, in batch.

In imageJ I use:
ImageJ -m '~/Downloads/ID.ijm 1-1' &

Where 1-1 is the argument.

Is there an equivalent in Fiji?

Many thanks,

Emmanuel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji equivalent to ImageJ command line?

dscho
Hi Emmanuel,

On Sun, 10 Mar 2013, Emmanuel Levy wrote:

> I would like to run (multiple instance of) Fiji from the command line,
> in batch.
>
> In imageJ I use:
> ImageJ -m '~/Downloads/ID.ijm 1-1' &
>
> Where 1-1 is the argument.
>
> Is there an equivalent in Fiji?

Since Fiji is just ImageJ, I do not see why the same command-line should
not work:

        ImageJ-linux64 -m '~/Downloads/ID.ijm 1-1' &

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji equivalent to ImageJ command line?

Emmanuel Levy
Hello Johannes,

I actually tried but I got the following error:

$ /home/elevy/Downloads/Fiji.app/ImageJ-linux64 -m '~/Downloads/ID.ijm 1-1'
$ Unrecognized option: -m
Warning: falling back to System JVM
Unrecognized option: -m
Could not create the Java virtual machine

I  also got another error (with ImageJ after it starts) so I'll post a
question about that too.

Thank for your help,

Emmanuel



On 12 March 2013 03:00, Johannes Schindelin <[hidden email]> wrote:

> Hi Emmanuel,
>
> On Sun, 10 Mar 2013, Emmanuel Levy wrote:
>
>> I would like to run (multiple instance of) Fiji from the command line,
>> in batch.
>>
>> In imageJ I use:
>> ImageJ -m '~/Downloads/ID.ijm 1-1' &
>>
>> Where 1-1 is the argument.
>>
>> Is there an equivalent in Fiji?
>
> Since Fiji is just ImageJ, I do not see why the same command-line should
> not work:
>
>         ImageJ-linux64 -m '~/Downloads/ID.ijm 1-1' &
>
> Ciao,
> Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji equivalent to ImageJ command line?

dscho
Hi Emmanuel,

On Tue, 12 Mar 2013, Emmanuel Levy wrote:

> I actually tried but I got the following error:
>
> $ /home/elevy/Downloads/Fiji.app/ImageJ-linux64 -m '~/Downloads/ID.ijm 1-1'
> $ Unrecognized option: -m
> [...]

From reading the source code:

        https://github.com/fiji/ImageJA/blob/master/src/main/java/ij/ImageJ.java#L673

I cannot see that -m is an ImageJ option. It is probably an option that is
specific to the ImageJ launcher you use (Linux?).

One of the reasons to try to come up with the grand unified ImageJ
launcher (formerly Fiji launcher) is to do away with those
platform-specific options and offer them to all platforms.

In your particular case, you should use -macro, not -m, as the former is
an ImageJ option, while the latter is not (but might become at some
stage).

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji equivalent to ImageJ command line?

Emmanuel Levy
Hello Johannes,

Thank you for your reply. The -m is indeed present in the linux
version (together with -b, which is really convenient!) Is there a
-batch equivalent in Fiji by the way? I tried -batch but it did not
work.

I tried the -macro option and was told that the macro was not found
(it searched in the "macro" folder). Moving the code to that directory
fixed the problem (so an absolute/relative path does not seem to be
tolerated). I also needed not to use an argument in the command line,
otherwise it would not find the macro (even if it's in the proper
directory).

All the best,

Emmanuel



On 12 March 2013 16:35, Johannes Schindelin <[hidden email]> wrote:

> Hi Emmanuel,
>
> On Tue, 12 Mar 2013, Emmanuel Levy wrote:
>
>> I actually tried but I got the following error:
>>
>> $ /home/elevy/Downloads/Fiji.app/ImageJ-linux64 -m '~/Downloads/ID.ijm 1-1'
>> $ Unrecognized option: -m
>> [...]
>
> From reading the source code:
>
>         https://github.com/fiji/ImageJA/blob/master/src/main/java/ij/ImageJ.java#L673
>
> I cannot see that -m is an ImageJ option. It is probably an option that is
> specific to the ImageJ launcher you use (Linux?).
>
> One of the reasons to try to come up with the grand unified ImageJ
> launcher (formerly Fiji launcher) is to do away with those
> platform-specific options and offer them to all platforms.
>
> In your particular case, you should use -macro, not -m, as the former is
> an ImageJ option, while the latter is not (but might become at some
> stage).
>
> Ciao,
> Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji equivalent to ImageJ command line?

dscho
Hi Emmanuel,

On Wed, 13 Mar 2013, Emmanuel Levy wrote:

> On 12 March 2013 16:35, Johannes Schindelin <[hidden email]>
> wrote:
> > On Tue, 12 Mar 2013, Emmanuel Levy wrote:
> >
> >> I actually tried but I got the following error:
> >>
> >> $ /home/elevy/Downloads/Fiji.app/ImageJ-linux64 -m '~/Downloads/ID.ijm 1-1'
> >> $ Unrecognized option: -m
> >> [...]
> >
> > From reading the source code:
> >
> >         https://github.com/fiji/ImageJA/blob/master/src/main/java/ij/ImageJ.java#L673
> >
> > I cannot see that -m is an ImageJ option. It is probably an option
> > that is specific to the ImageJ launcher you use (Linux?).
> >
> > One of the reasons to try to come up with the grand unified ImageJ
> > launcher (formerly Fiji launcher) is to do away with those
> > platform-specific options and offer them to all platforms.
> >
> > In your particular case, you should use -macro, not -m, as the former
> > is an ImageJ option, while the latter is not (but might become at some
> > stage).
>
> Thank you for your reply. The -m is indeed present in the linux
> version (together with -b, which is really convenient!) Is there a
> -batch equivalent in Fiji by the way? I tried -batch but it did not
> work.

I found the original source code for your ImageJ launcher. It is included
in

http://ftp.de.debian.org/debian/pool/main/i/imagej/imagej_1.47a-1.debian.tar.gz

as imagej.sh (i.e. a Shell script, to be precise, a Bash script, therefore
not portable to Windows).

> I tried the -macro option and was told that the macro was not found
> (it searched in the "macro" folder). Moving the code to that directory
> fixed the problem (so an absolute/relative path does not seem to be
> tolerated). I also needed not to use an argument in the command line,
> otherwise it would not find the macro (even if it's in the proper
> directory).

It is relatively hard in a Bash script to parse and quote arguments
properly. Therefore, you had to quote your macro together with the option.
I believe that

        ImageJ-linux64 -batch /path/to/macro.ijm 1-1

does exactly what you want. In my test, it worked, at least (I used the
single line "print(getArgument());" as macro.ijm).

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji equivalent to ImageJ command line?

Emmanuel Levy
Dear Wayne and Johannes,

Yes indeed, this was the problem: ImageJ linux requires the macro path
and arguments to be quoted together, while the ImageJ Fiji does not
require any quote.

Now it works :)

Many thanks,
All the best,

Emmanuel



On 13 March 2013 22:38, Johannes Schindelin <[hidden email]> wrote:

> Hi Emmanuel,
>
> On Wed, 13 Mar 2013, Emmanuel Levy wrote:
>
>> On 12 March 2013 16:35, Johannes Schindelin <[hidden email]>
>> wrote:
>> > On Tue, 12 Mar 2013, Emmanuel Levy wrote:
>> >
>> >> I actually tried but I got the following error:
>> >>
>> >> $ /home/elevy/Downloads/Fiji.app/ImageJ-linux64 -m '~/Downloads/ID.ijm 1-1'
>> >> $ Unrecognized option: -m
>> >> [...]
>> >
>> > From reading the source code:
>> >
>> >         https://github.com/fiji/ImageJA/blob/master/src/main/java/ij/ImageJ.java#L673
>> >
>> > I cannot see that -m is an ImageJ option. It is probably an option
>> > that is specific to the ImageJ launcher you use (Linux?).
>> >
>> > One of the reasons to try to come up with the grand unified ImageJ
>> > launcher (formerly Fiji launcher) is to do away with those
>> > platform-specific options and offer them to all platforms.
>> >
>> > In your particular case, you should use -macro, not -m, as the former
>> > is an ImageJ option, while the latter is not (but might become at some
>> > stage).
>>
>> Thank you for your reply. The -m is indeed present in the linux
>> version (together with -b, which is really convenient!) Is there a
>> -batch equivalent in Fiji by the way? I tried -batch but it did not
>> work.
>
> I found the original source code for your ImageJ launcher. It is included
> in
>
> http://ftp.de.debian.org/debian/pool/main/i/imagej/imagej_1.47a-1.debian.tar.gz
>
> as imagej.sh (i.e. a Shell script, to be precise, a Bash script, therefore
> not portable to Windows).
>
>> I tried the -macro option and was told that the macro was not found
>> (it searched in the "macro" folder). Moving the code to that directory
>> fixed the problem (so an absolute/relative path does not seem to be
>> tolerated). I also needed not to use an argument in the command line,
>> otherwise it would not find the macro (even if it's in the proper
>> directory).
>
> It is relatively hard in a Bash script to parse and quote arguments
> properly. Therefore, you had to quote your macro together with the option.
> I believe that
>
>         ImageJ-linux64 -batch /path/to/macro.ijm 1-1
>
> does exactly what you want. In my test, it worked, at least (I used the
> single line "print(getArgument());" as macro.ijm).
>
> Ciao,
> Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji equivalent to ImageJ command line?

dscho
Hi,

On Sat, 16 Mar 2013, Emmanuel Levy wrote:

> On 13 March 2013 22:38, Johannes Schindelin <[hidden email]> wrote:
> >
> > On Wed, 13 Mar 2013, Emmanuel Levy wrote:
> >
> >> On 12 March 2013 16:35, Johannes Schindelin <[hidden email]>
> >> wrote:
> >> > On Tue, 12 Mar 2013, Emmanuel Levy wrote:
> >> >
> >> >> I actually tried but I got the following error:
> >> >>
> >> >> $ /home/elevy/Downloads/Fiji.app/ImageJ-linux64 -m '~/Downloads/ID.ijm 1-1'
> >> >> $ Unrecognized option: -m
> >> >> [...]
> >>
> > I found the original source code for your ImageJ launcher. It is
> > included in
> >
> > http://ftp.de.debian.org/debian/pool/main/i/imagej/imagej_1.47a-1.debian.tar.gz
> >
> > as imagej.sh (i.e. a Shell script, to be precise, a Bash script, therefore
> > not portable to Windows).
> >
> > [...]
> >
> > I believe that
> >
> >         ImageJ-linux64 -batch /path/to/macro.ijm 1-1
> >
> > does exactly what you want. In my test, it worked, at least (I used the
> > single line "print(getArgument());" as macro.ijm).
>
> Yes indeed, this was the problem: ImageJ linux requires the macro path
> and arguments to be quoted together, while the ImageJ Fiji does not
> require any quote.

To be precise, it is not ImageJ linux but Debian's own ImageJ. If my dream
comes true, the next ImageJ version will ship with the grand unified
ImageJ launcher (which you call the Fiji launcher).

> Now it works :)

Great!
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html