Login  Register

Re: run Bio-Formats importer from command line?

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

Hi Nick,

> Basically, how can I open an image without the image actually showing?

What does it mean to "open" the image, if a window doesn't show?

Do you want to write a script/macro/plugin that has a variable referencing
that image?

In other words: what state do you want the software to be in after opening
your image?

A common workflow is to write a macro with setBatchMode(true) at the top,
which opens an image, does some processing, saves some results somewhere
(either images or textual or both) and then completes. If that is not what
you want to do, please describe in detail what you *do* want to do.

-Curtis


On Wed, Apr 30, 2014 at 1:05 PM, Nick X. Tsui <[hidden email]> wrote:

> Sorry.
> Basically, how can I open an image without the image actually showing?
> Thanks.
> Nick
>
>
> On Wed, Apr 30, 2014 at 1:49 PM, Curtis Rueden <[hidden email]> wrote:
>
> > Hi Nick,
> >
> > > OK. So is there any chance using command line to open an image without
> > > showing the image window? Not headless motion, but ImageJ launches,
> > > image selected, opened, but now really its window is showing. Can this
> > > be done using something like in a C++ script?
> >
> > My apologies, but I do not understand the question. Can you please
> > elaborate?
> >
> > Thanks,
> > Curtis
> >
> >
> > On Wed, Apr 30, 2014 at 11:58 AM, Nick X. Tsui <[hidden email]>
> > wrote:
> >
> > > OK. So is there any chance using command line to open an image without
> > > showing the image window?
> > > Not headless motion, but ImageJ launches, image selected, opened, but
> now
> > > really its window is showing.
> > > Can this be done using something like in a C++ script?
> > >
> > > imagej.exe - run "run(open...)"
> > >
> > > Thanks.
> > > Nick
> > >
> > >
> > > On Wed, Apr 30, 2014 at 12:36 PM, Curtis Rueden <[hidden email]>
> > wrote:
> > >
> > > > 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
> > > >
> > >
> > > --
> > > 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