Login  Register

Re: run Bio-Formats importer from command line?

Posted by nickxtsui on May 08, 2014; 9:00pm
URL: http://imagej.273.s1.nabble.com/run-Bio-Formats-importer-from-command-line-tp5007445p5007641.html

I actually a for loop, and that solves the problem. No additional
script/macro needed.
Thanks a lot.
Best,
Nick


On Thu, May 8, 2014 at 3:23 PM, Curtis Rueden <[hidden email]> wrote:

> Hi Nick,
>
> > I am wondering can I run Bio-Formats Windowless Importer using command
> > line to open multiple files at one time?
>
> You will need to write a script or plugin that does this, and then invoke
> that script or plugin from the command line.
>
> Regards,
> Curtis
>
>
> On Thu, May 8, 2014 at 2:02 PM, Nick X. Tsui <[hidden email]> wrote:
>
> > Hi Curtis and ImageJ Users:
> > I am wondering can I run Bio-Formats Windowless Importer using command
> line
> > to open multiple files at one time?
> > I have done the single-file case, thanks for your help, as something like
> > this
> >
> > imagej-win64.exe -eval Bio-Formats Windowless Importer
> open=[D:\image1.tif]
> > display_ome-xml
> >
> > but when I do
> > imagej-win64.exe -eval Bio-Formats Windowless Importer
> open=[D:\image1.tif
> > D:\image2.tif D:\image3.tif] display_ome-xml
> >
> > it seems not working. Any suggestions?
> >
> > Thanks  a lot.
> >
> > Best,
> > Nick
> >
> >
> > On Wed, Apr 30, 2014 at 2:40 PM, Curtis Rueden <[hidden email]>
> wrote:
> >
> > > Hi Nick,
> > >
> > > > If I know what file I want to open, and I know I want to open it with
> > > > OME-XML, why do I have to click so many times navigating among
> folders
> > > > and choosing options?
> > >
> > > You can use the Bio-Formats Windowless Importer to skip the big options
> > > dialog that Bio-Formats normally presents.
> > >
> > > You can enable "Windowless" mode per file format using the Bio-Formats
> > > Plugins Configuration dialog, or use it globally by executing the
> > > "Bio-Formats Windowless Importer" plugin.
> > >
> > > > display_ome-xml_metadata=True");
> > > > to open an image, but no OME-XMl is showing.
> > >
> > > You need to remove the "=True" from your "display_ome-xml" if you want
> > the
> > > OME-XML to show.
> > >
> > > -Curtis
> > >
> > >
> > > On Wed, Apr 30, 2014 at 1:34 PM, Nick X. Tsui <[hidden email]>
> > wrote:
> > >
> > > > Hi Curtis:
> > > > Sorry for the confusion. I simply want to using command line to open
> an
> > > > image with its OME-XML displaying, but I don't want to write a macro,
> > > just
> > > > the command line, and it should be one click for all, assuming the
> path
> > > of
> > > > the file is already know.
> > > >
> > > > I can use something like
> > > > run("Bio-Formats Importer","open=[myimage.tif] display_metadata=True
> > > > display_ome-xml_metadata=True");
> > > > to open an image, but no OME-XMl is showing. That is the closest I
> can
> > > get.
> > > >
> > > > Conceptually as long as he file path is know, one click should be
> > doable
> > > I
> > > > suppose? If I know what file I want to open, and I know I want to
> open
> > it
> > > > with OME-XML, why do I have to click so many times navigating among
> > > folders
> > > > and choosing options?
> > > >
> > > > Best,
> > > > Nick
> > > >
> > > >
> > > > On Wed, Apr 30, 2014 at 2:14 PM, Curtis Rueden <[hidden email]>
> > > wrote:
> > > >
> > > > > 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
> > > > >
> > > >
> > > > --
> > > > 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