NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 900 - Headless mode incorect macro parsing (grid stitching)
Headless mode incorect macro parsing (grid stitching)
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
PC Windows
: P4 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2014-08-13 10:52 CDT by Stan Chlebicki
Modified: 2015-04-21 11:36 CDT
4 users (show)

See Also:

Description Stan Chlebicki 2014-08-13 10:52:32 CDT
I start app like this:
Fiji.app\\ImageJ-win64.exe -macro ..\\..\\tmp\\scan.ijm
or like this:
Fiji.app\\ImageJ-win64.exe --headless -macro ..\\..\\tmp\\scan.ijm
Results are different.

Macro file is:
run("Grid/Collection stitching", "type=[Positions from file] order=[Defined by TileConfiguration] directory=tmp layout_file=scan.pos fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50 compute_overlap=[false] computation_parameters=[Save computation time (but use more RAM)] image_output=[Fuse and display]");
saveAs("Jpeg", "map.jpg");
run("Quit");

In standard mode Fiji works as expected.
In headless mode Fiji automatically activates option "Compute overlap", although it is not specified.

Information about your version of Java:

  os.arch => amd64
  os.name => Windows 7
  os.version => 6.1
  java.version => 1.6.0_24
  java.vendor => Sun Microsystems Inc.
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.6.0_24-b07
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 19.1-b02
  java.vm.vendor => Sun Microsystems Inc.
  java.vm.info => mixed mode
  java.awt.graphicsenv => sun.awt.Win32GraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.6
  sun.cpu.endian => little
  sun.desktop => windows
  file.separator => \

The up-to-date check says: REMIND_LATER

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: C:\BADZIE~1\Fiji.app/java/win64/jdk1.6.0_24//jre
  imagej.dir => C:\BADZIE~1\Fiji.app

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20140802105300)
Fiji: http://fiji.sc/update/ (last check:20140730140634)
Comment 1 Johannes Schindelin 2014-08-16 05:32:38 CDT
This is probably caused by an incorrect emulation of the macro parameter parsing in headless mode: https://github.com/imagej/ij1-patcher/blob/master/src/main/java/net/imagej/patcher/HeadlessGenericDialog.java#L240-L251

If you have time to take care of the issue and file a pull request, that would be splendid. I would of course help you with advice as much as my time allows.
Comment 2 Stan Chlebicki 2014-09-01 04:26:08 CDT
> If you have time to take care of the issue

I have

> and file a pull request

what exactly should I do?
Comment 3 Curtis Rueden 2014-09-02 06:42:04 CDT
> > and file a pull request
>
> what exactly should I do?

If you haven't used pull requests before:

https://help.github.com/articles/using-pull-requests

The first step is to actually fix the issue in ij1-patcher though. You can clone https://github.com/imagej/ij1-patcher and import it into an IDE, and/or compile via Maven on the command line. Some guidance at: http://imagej.net/IDEs (just use ij1-patcher.git instead of imagej.git where applicable)
Comment 4 Johannes Schindelin 2014-09-02 07:53:58 CDT
Please note that the best way to debug ij1-patcher might be to write a unit test, for example imitating the booleanTest() method in the HeadlessEnvironmentTest class:

https://github.com/imagej/ij1-patcher/blob/52cf6a088e2e5df387c1ef8db1c5dfea04f80c50/src/test/java/net/imagej/patcher/HeadlessEnvironmentTest.java#L136-L143

A good way may be to add another boolean value, say, "parallel", defaulting to "true", to https://github.com/imagej/ij1-patcher/blob/52cf6a088e2e5df387c1ef8db1c5dfea04f80c50/src/test/java/net/imagej/patcher/Headless_Example_Plugin.java#L73-L82 and append some text to the "value" variable when it was turned off via "parallel=false". This could be tested in the booleanTest() method which you can run directly in Eclipse (or Netbeans or IntelliJ).
Comment 5 phsiao 2015-03-24 15:02:18 CDT
Is somebody actually working on this issue? If not I might jump to it cause I am having the same issue.
Comment 6 Curtis Rueden 2015-03-24 15:28:58 CDT
@phsiao - Nope, if someone were actively working on it, the status would be ASSIGNED. There are an overwhelming number of ImageJ tasks, bugs, etc., so if you want to see this addressed, working on it yourself would be absolutely amazing. I'm happy to help if you get stuck -- just comment here or use the imagej-devel mailing list.
Comment 7 phsiao 2015-03-25 15:37:16 CDT
I looked briefly on the HeadlessGenericDialog class (https://github.com/imagej/ij1-patcher/blob/master/src/main/java/net/imagej/patcher/HeadlessGenericDialog.java#L240-L251), especially getMacroParameter(String label, boolean defaultValue) in line 284, it seems that this is more like a logic decision rather than a bug.

According to the getMacroParameter function, if a check box name appears in a macro, its boolean value will be true. If there is no check box name specified, the boolean value will become the passed in default value.

But I think the macro should work in a way that if users don't specify a check box'a name in a macro, the boolean value for that check box should be false.
Comment 8 phsiao 2015-03-27 14:03:14 CDT
Curtis,

I fixed the code and created a pull request.
Comment 9 Curtis Rueden 2015-04-06 14:27:12 CDT
Thank you, Joe! I merged it. We'll release and upload before the end of next week.
Comment 10 Curtis Rueden 2015-04-21 11:36:23 CDT
The fix was uploaded long ago!