From f4dfbb51ac8a38375dc588811eb0342f2effc4e2 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 8 Jul 2013 10:10:56 -0500 Subject: [PATCH] Fix second (and later) runs of Temporal-Color Code 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 --- plugins/Scripts/Image/Hyperstacks/Temporal-Color_Code.ijm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/Scripts/Image/Hyperstacks/Temporal-Color_Code.ijm b/plugins/Scripts/Image/Hyperstacks/Temporal-Color_Code.ijm index 2b174e9bef..044f4a16ad 100644 --- a/plugins/Scripts/Image/Hyperstacks/Temporal-Color_Code.ijm +++ b/plugins/Scripts/Image/Hyperstacks/Temporal-Color_Code.ijm @@ -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"); }