Skip to content

Commit

Permalink
Fix second (and later) runs of Temporal-Color Code
Browse files Browse the repository at this point in the history
Noticed by Olivier Bardot in bug 606, the *second* run of the temporal
color coder macro will output a list of all LUTs to the Log window with
ImageJ >= 1.47n.

The problem is that we had to work around ImageJ < 1.47n always
returning null instead of the value of the last evaluated statement,
but ImageJ >= 1.47n *does* return said value, and even worse: if it
is not assigned anywhere, the value is printed to the Log window.

To keep the temporal color coder working both with old and new ImageJ
1.x versions (because some plugins do not work with newer ImageJ 1.x
any more), let's put a work-around in place.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Jul 8, 2013
1 parent 876b036 commit f4dfbb5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/Scripts/Image/Hyperstacks/Temporal-Color_Code.ijm
Expand Up @@ -163,8 +163,11 @@ function makeLUTsArray() {
+ " }\n"
+ " }\n"
+ "}\n"
+ "// ImageJ's eval('script', script) erroneously always returns null\n"
+ "System.setProperty('result', result.join('\\n'));\n");
+ "// ImageJ < 1.47n always returned null from eval('script', script)\n"
+ "// To work around this, we set a special system property. Hacky, but works.\n"
+ "System.setProperty('result', result.join('\\n'));\n"
+ "// ImageJ >= 1.47n *does* return the value of the last evaluated statement\n"
+ "null;\n");
return split(call("java.lang.System.getProperty", "result"), "\n");
}

Expand Down

0 comments on commit f4dfbb5

Please sign in to comment.