From bd98a4eea2655d2fb8d470c28316cba1795df787 Mon Sep 17 00:00:00 2001 From: Uwe Schmidt Date: Wed, 8 Apr 2020 00:25:11 +0200 Subject: [PATCH] Fix bug (macro not recorded for timelapse) --- src/main/java/de/csbdresden/CommandFromMacro.java | 13 ++++++------- .../java/de/csbdresden/stardist/StarDist2D.java | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/csbdresden/CommandFromMacro.java b/src/main/java/de/csbdresden/CommandFromMacro.java index 122ceb1..de4b09c 100644 --- a/src/main/java/de/csbdresden/CommandFromMacro.java +++ b/src/main/java/de/csbdresden/CommandFromMacro.java @@ -37,7 +37,7 @@ import net.imglib2.RandomAccessibleInterval; -@Plugin(type = Command.class, label = "CommandFromMacro", menuPath = "Plugins > StarDist > Other > CommandFromMacro") +@Plugin(type = Command.class, label = "Command From Macro", menuPath = "Plugins > StarDist > Other > Command From Macro") public class CommandFromMacro implements Command { private static final List SKIP_VISIBILITY = Arrays.asList(ItemVisibility.MESSAGE, ItemVisibility.INVISIBLE); @@ -46,10 +46,10 @@ public class CommandFromMacro implements Command { private String command; @Parameter - private boolean process; + private String args; @Parameter - private String args; + private boolean process; // --------- @@ -157,11 +157,10 @@ public static boolean record(final Command command, final CommandService command if (Recorder.getInstance() == null) return false; final String recorded = Recorder.getCommand(); - // System.out.println("RECORDED: " + recorded); final CommandInfo info = commandService.getCommand(command.getClass()); // only proceed if this command is being recorded final String name = info.getMenuPath().getLeaf().getName(); - // final String cmdName = info.getLabel(); + // System.out.printf("RECORDED: %s, COMMAND: %s\n", recorded, name); if (recorded==null || !recorded.equals(name)) return false; // prevent automatic recording @@ -237,8 +236,8 @@ else if (clazz == ImagePlus.class) argsStr = sb.toString(); final String execName = commandService.getCommand(CommandFromMacro.class).getMenuPath().getLeaf().getName(); - return String.format("run(\"%s\", \"command=[%s], process=[%s], args=[%s]\");\n", - execName, commandClass.getName(), String.valueOf(process), argsStr); + return String.format("run(\"%s\", \"command=[%s], args=[%s], process=[%s]\");\n", + execName, commandClass.getName(), argsStr, String.valueOf(process)); } diff --git a/src/main/java/de/csbdresden/stardist/StarDist2D.java b/src/main/java/de/csbdresden/stardist/StarDist2D.java index 35289a5..8c490d3 100644 --- a/src/main/java/de/csbdresden/stardist/StarDist2D.java +++ b/src/main/java/de/csbdresden/stardist/StarDist2D.java @@ -317,10 +317,10 @@ public void run() { final Future futureNMS = command.run(StarDist2DNMS.class, false, paramsNMS); label = (Dataset) futureNMS.get().getOutput("label"); - - // call at the end of the run() method - CommandFromMacro.record(this, this.command); } + // call at the end of the run() method + CommandFromMacro.record(this, this.command); + } catch (InterruptedException | ExecutionException | IOException e) { e.printStackTrace(); } finally {