http://imagej.273.s1.nabble.com/Headless-ImageJ2-rc2-Analyze-Particles-returns-no-result-tp5008127p5008135.html
> Thirdly, the option "-macro" seems to be undocumented. Is this the
> beanshell).
> Hi Paul,
>
> On Wed, 11 Jun 2014, Paul van Schayck wrote:
>
> > I'm running into several problems running ImageJ2-rc2 headless. I'm
> > using this command:
> >
> > ./ImageJ-linux64 --headless -macro scripts/test.ijm
> >
> > The first one is that the new "Open images using scifio" breaks image
> opening through open("image.png"):
> > java.lang.NullPointerException
> > at
> net.imagej.legacy.IJ1Helper.updateRecentMenu(IJ1Helper.java:307)
>
> Could I ask you to test my fix? If you replaced your
> jars/imagej-legacy-*.jar with the version from
>
>
>
http://jenkins.imagej.net/job/ImageJ-legacy/lastSuccessfulBuild/artifact/target/imagej-legacy-0.5.10-SNAPSHOT.jar>
> it should address that problem.
>
> > This can be fixed by disabling the new SCIFIO option.
>
> Note that we are currently stabilizing this code, with the enormous and
> outstanding help by the community, such as you!
>
> The idea of using SCIFIO is to make it possible to just File>Open just
> about anything and get the correct images. The built-in TIFF reader of
> ImageJ 1.x cuts a few corners, which is fast, but fails to open a couple
> of valid TIFF files correctly, and it also does not heed extensions such
> as OME-TIFF. SCIFIO addresses that.
>
> I have no doubt that with the help of the community, we can make the
> support code in ImageJ2 robust so that everybody can gain the benefits of
> the SCIFIO library.
>
> > The second one, is that this macro:
> >
> > open(imagePath);
> > run("8-bit");
> > setThreshold(1, 255);
> > run("Analyze Particles...", "size=300-Infinity circularity=0.40-1.00");
> > print(nResults);
> >
> > Will return 0. No particles seem to be found. Running the same macro not
> headless:
> > ./ImageJ-linux64 -macro scripts/test.ijm
> > Will return a number of particles in a log window
>
> Have you tried with
>
> ./ImageJ-linux64 -batch scripts/test.ijm
>
> ? This is a way to call macros in batch mode that is admittedly not
> documented very well... At least that will get you going again if all you
> need is to call the script from the command line and let it obtain the
> results via stdout.
>
> I just tried to reproduce that headless mode problem and get a different
> problem instead. Will keep you posted.
>
> > Thirdly, the option "-macro" seems to be undocumented. Is this the
> > preferred way to start macros? How about new scripts (.js or beanshell).
>
> The -macro option is a standard IamgeJ 1.x option, documented
> unfortunately only in the developer part of the documentation, far from
> regular users' hunting grounds:
>
>
>
http://jenkins.imagej.net/job/ImageJ1-javadoc/javadoc/ij/ImageJ.html>
> Note that it is also not *quite* correct: you can pass -batch as last
> argument *without* a path, which comes in handy if you want to *evaluate*
> an expression -- as opposed to a file containing macro code -- in batch
> mode.
>
> So hopefully this addresses two of your questions; I will keep you updated
> on the remaining one.
>
> Ciao,
> Johannes
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>