Skip to content

Commit

Permalink
Fix bug (macro not recorded for timelapse)
Browse files Browse the repository at this point in the history
  • Loading branch information
uschmidt83 committed Apr 7, 2020
1 parent dd20147 commit bd98a4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions src/main/java/de/csbdresden/CommandFromMacro.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemVisibility> SKIP_VISIBILITY = Arrays.asList(ItemVisibility.MESSAGE, ItemVisibility.INVISIBLE);
Expand All @@ -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;

// ---------

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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));
}


Expand Down
6 changes: 3 additions & 3 deletions src/main/java/de/csbdresden/stardist/StarDist2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ public void run() {

final Future<CommandModule> 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 {
Expand Down

0 comments on commit bd98a4e

Please sign in to comment.