Login  Register

Re: run Bio-Formats importer from command line?

Posted by ctrueden on Apr 30, 2014; 2:45pm
URL: http://imagej.273.s1.nabble.com/run-Bio-Formats-importer-from-command-line-tp5007445p5007512.html

Hi Nick,

> Any chance I can run with command line, but without any macro file
> involved?

Yes, you can use the "-eval" option to pass a macro string directly. E.g.:

   ImageJ-win32.exe -eval "print('Hello world');"

Launches ImageJ and prints "Hello world" to the log.

   ImageJ-win32.exe -eval "print('Hello world');" -batch

Launches ImageJ and prints "Hello world" to the log, then immediately exits.

   ImageJ-win32.exe --headless -eval "print('Hello world');"

Launches ImageJ in headless mode and prints "Hello world" to the console.

Regards,
Curtis


On Fri, Apr 25, 2014 at 4:52 PM, Nick X. Tsui <[hidden email]> wrote:

> Hi Curtis:
> Thanks a lot. Any chance I can run with command line, but without any macro
> file involved? I prefer not to create an additional macro. Just command
> line. Thanks.
> Best,
> Nick
>
>
> On Fri, Apr 25, 2014 at 5:09 PM, Curtis Rueden <[hidden email]> wrote:
>
> > Hi Nick,
> >
> > > I am wondering how I can run Bio-Formats importer from command line?
> >
> > 1) Use the Macro Recorder [1] to record the line of macro code that runs
> > Bio-Formats that way you want.
> >
> > 2) Click "Create" to pop up the Script Editor [2], edit as desired, then
> > save the macro as a .ijm macro file.
> >
> > 3) Run the macro from the command line:
> >
> >     ImageJ-win32.exe -macro myMacro.ijm -batch
> >
> > Leave off the "-batch" flag if you want Fiji to remain open afterward.
> >
> > Note that you cannot use the "--headless" option [3] because Bio-Formats
> > does not work in headless mode, even when running as a macro. (You will
> see
> > "VerifyError" on the console if you try.)
> >
> > I have added this information to the Bio-Formats wiki page:
> > http://fiji.sc/Bio-Formats#Calling_Bio-Formats_from_the_command_line
> >
> > Regards,
> > Curtis
> >
> > [1] http://fiji.sc/Introduction_into_Macro_Programming#The_recorder
> > [2] http://fiji.sc/Script_Editor
> > [3] http://fiji.sc/Headless#Running_macros_in_headless_mode
> >
> >
> > On Fri, Apr 25, 2014 at 3:24 PM, Nick X. Tsui <[hidden email]>
> wrote:
> >
> > > Dear ImageJ fellows:
> > > Thanks for reading my questions.
> > > I am wondering how I can run Bio-Formats importer from command line?
> > > Suppose I know what image I want to load, and no need to pop the
> > > Bio-Formats importer window.
> > > something like this?
> > >
> > > imagej.exe myImage.tif -run ""Bio-Formats..., Bio-Formats importer" ?
> > >
> > > Thanks a lot.
> > > Best regards,
> > > Nick
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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