[ImageJ-bugs] [Bug 835] Fiji hangs when installing macro tool

bugzilla at fiji.sc bugzilla at fiji.sc
Wed Jul 23 01:23:20 CDT 2014


http://fiji.sc/bugzilla/show_bug.cgi?id=835

--- Comment #5 from Ilan Tal <ilan.tal at gmail.com> ---
My debugging environment is NetBeans and I use ImageJ, not Fiji for memory
considerations. For example there have been cases where a large whole body scan
would not fit into memory for debugging.

With this restriction, I was able to find out what goes on inside ImageJ when I
install a macro tool. I can verify that ImageJ works properly but Fiji fails. I
would like to be able to work with someone who can check the Fiji environment.

I will describe what happens in 3 different cases:
1) installing using the toolbar "More" command and choosing the macro.
2) installing using Plugins -> Tools and choosing the macro.
3) restarting ImageJ where the tools are reinstalled from the registry values.

In Fiji case 1 causes a crash which freezes the keyboard. Fiji case 2 causes
the macro to run but it doesn't get installed to the toolbar. Case 3 cannot be
checked in Fiji since installation of the tool always fails.

In the case of both a plugin jar file as well as a macro, both receive the run
command. The plugin jar is simpler since its run does the install. The macro
runs through some 6 different run commands. The stack dumps are shown in the 3
attachments.

The crucial point is the macro name. Here is the code in macro runner which
does the job
        else if (name.endsWith("Tool.ijm") || name.endsWith("Tool.txt")
        || name.endsWith("Menu.ijm") || name.endsWith("Menu.txt"))
            (new MacroInstaller()).installTool(Menus.getPlugInsPath()+name);

My tool is called Postage_Action_Tool.ijm and the Tool.ijm is the key. In
ImageJ all works correctly so that it reaches this point. In case 2 of Fiji, it
won't reach this point - instead of installing the tool, it runs it. In case 1
Fiji just crashes.

Now to consider the different cases. In case 1 the interesting things start at

            String label = item.getLabel();
            String cmd = item.getActionCommand();
            boolean isTool = cmd.equals("Tool") || cmd.equals("Plugin Tool");
            if (!(label.equals("Help...")||label.equals("Remove Custom Tools"))
&& !isTool)
                currentSet = label;
            if (isTool) {
                if (cmd.equals("Tool")) // built in tool
                    installBuiltinTool(label);
                else  // plugin or macro tool in ImageJ/plugins/Tools
                    IJ.run(label);
                return;

in itemStateChanged. The cmd is "Plugin Tool" and not "Tool" so that it skips
the installBuiltinTool and does the IJ.run(label). In Fiji is it Tool, or
Plugin Tool?

Case 2 does a run directly which in ImageJ ends up checking the file name and
causing the install, whereas in Fiji it just runs with no install. Why does
Fiji act differently?

Case 3 is the startup which works in ImageJ and can't be reached in Fiji. The
code is

    public void installStartupTools() {
        if (IJ.debugMode) IJ.log("Toolbar.installStartupTools");
        for (int i=0; i<=6; i++) {
            String name = Prefs.get(TOOL_KEY + (i/10)%10 + i%10, "");
            if (IJ.debugMode) IJ.log("  "+i+" "+name);
            if (name.equals("")) continue;
            installingStartupTool = true;
            boolean ok = installBuiltinTool(name);
            if (!ok) {
                if (name.endsWith("Menu Tool"))
                    name = name.substring(0, name.length()-5);
                Hashtable commands = Menus.getCommands();
                if (commands!=null && commands.get(name)!=null)
                    IJ.run(name);
            }
            installingStartupTool = false;
        }
    }

The 6 additional keys are checked from the registry. Clearly this is not a
built in tool so installBuiltinTool will fail. It then sees that commands are
not null and commands.get(name) is in the hashtable, so the IJ.run(name) takes
over. This reaches the same point as cases 1 and 2 causing the tool to be
installed.

Again, my question is: who has a Fiji environment and can check what the
difference is in Fiji?

Hoping to hear from someone,
Ilan

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-bugs/attachments/20140723/333201ec/attachment.html>


More information about the Imagej-bugs mailing list