Login  Register

Re: run Bio-Formats importer from command line?

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

Hi Nick,

> It seems to me in this way if there are escaping characters, it cannot
> handle it?

You will need to learn about how the Windows command shell handles escaped
quotes:
http://stackoverflow.com/q/7760545

The increased complexity is one reason to consider writing the macro to a
file and executing it that way.

Regards,
Curtis


On Wed, Apr 30, 2014 at 11:28 AM, Nick X. Tsui <[hidden email]> wrote:

> Hi Curtis:
> Thanks. What if I have more than 1 parameters, for example I want to open a
> file using bio-format importer, like this if in macro:
>
>  "run("Bio-Formats Importer",
>
> 'open=['C:\\Users\\nickt\\Documents\\Untitled013\\ChanA_0001_0001_0001_0001.tif']')";
>
> It seems to me in this way if there are escaping characters, it cannot
> handle it?
>
> Thanks a lot.
>
> Nick
>
>
>
>
> On Wed, Apr 30, 2014 at 10:45 AM, Curtis Rueden <[hidden email]> wrote:
>
> > 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
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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