Macro in Plugin Menu fails to run

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Macro in Plugin Menu fails to run

Snider, Kaitlin
Hi All,


I've been working on a macro to automate selection of 3D ROIs.  The macro itself is working great; I can pull it up in the script editor and it runs correctly.  However, I'm going to need to call it from the plugin menu, and that isn't working. Right now I have it saved under Fiji ->  Fiji.app -> plugins as "Cell_nuclei_macro_x.ijm".  It shows up in the plugins menu as "Cell nuclei macro x".  If I click on that, the "status bar" on the Fiji main window reads "Command finished: cell nuclei macro x", but nothing actually happens.  I think this is something specific to my macro, not my Fiji install, as another macro I made (a simple macro that simply turns the image binary and saves it) works just fine under the same circumstances: saved under Fiji ->  Fiji.app -> plugins as "Sample_binary.ijm", shows up in the plugins menu as "Sample binary", runs correctly from the script editor AND from the plugins menu.  I'm pretty lost as to how to troubleshoot this issue.  Any ideas?


I have attached links to:

The macro that won't work from the plugin menu (https://docs.google.com/file/d/0Bw4MsPRmUoyIUGF3ejlWS2taOWs/edit)

The macro that does work from the plugin menu (https://docs.google.com/file/d/0Bw4MsPRmUoyIT0JYeHc2M1EwMTQ/edit)

A sample image that I've used to test these macros (https://docs.google.com/file/d/0Bw4MsPRmUoyINktTc1FhQlBKUVk/edit?)?


Thanks in advance!


Kaitlin Snider

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro in Plugin Menu fails to run

dscho
Hi Kaitlin,

On Wed, 25 Jun 2014, Snider, Kaitlin wrote:

> The macro that won't work from the plugin menu (https://docs.google.com/file/d/0Bw4MsPRmUoyIUGF3ejlWS2taOWs/edit)

I copied this into my (up-to-date) Fiji.app/plugins/ but when I run it, I
get a dialog box with

        Macro Error

        Number or numeric function expected in line 3.
        selectWindow ( <)> ;

Maybe I had to load an image first?

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro in Plugin Menu fails to run

Snider, Kaitlin
Yes - sorry, I should have specified, it does expect an image to be open.  Any idea why it would start in your Fiji and not do anything in mine?  If I try it in my Fiji with no image open, it gives me the same result as with an open image: reads "Command finished: Cell nuclei macro x" on the status line, no error message.  Am I possibly missing a .jar or plugin that it needs to run from the plugin menu?

Thanks!!

Kaitlin Snider
________________________________________
From: Johannes Schindelin <[hidden email]>
Sent: Wednesday, June 25, 2014 1:24 PM
To: Snider, Kaitlin
Cc: [hidden email]
Subject: Re: Macro in Plugin Menu fails to run

Hi Kaitlin,

On Wed, 25 Jun 2014, Snider, Kaitlin wrote:

> The macro that won't work from the plugin menu (https://docs.google.com/file/d/0Bw4MsPRmUoyIUGF3ejlWS2taOWs/edit)

I copied this into my (up-to-date) Fiji.app/plugins/ but when I run it, I
get a dialog box with

        Macro Error

        Number or numeric function expected in line 3.
        selectWindow ( <)> ;

Maybe I had to load an image first?

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro in Plugin Menu fails to run

dscho
Hi Kaitlin,

On Wed, 25 Jun 2014, Snider, Kaitlin wrote:

> Yes - sorry, I should have specified, it does expect an image to be
> open.

Even so, it still gives me that error... Are you using a custom version of
ImageJ 1.x? Or maybe another version than ImageJ 1.49b?

> Any idea why it would start in your Fiji and not do anything in mine?
> If I try it in my Fiji with no image open, it gives me the same result
> as with an open image: reads "Command finished: Cell nuclei macro x" on
> the status line, no error message.  Am I possibly missing a .jar or
> plugin that it needs to run from the plugin menu?

One thing you could do would be to run the updater and switch to advanced
mode to figure out whether there are locally-modified files, or local-only
ones that might interfere.

Another thing would be to start Fiji from the command-line and inspect the
console log:

        http://fiji.sc/Command-Line_Debugging

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro in Plugin Menu fails to run

Snider, Kaitlin
Hi Johannes and Wayne,

Re: Johannes suggestions and questions: I'm currently running ImageJ 1.49b.  I double-checked and I don't have any locally modified files.  I ran it through the debug mode and copied the output the debug log produced to a file, but I'm not sure how to read the debug report and haven't the faintest idea if it points to anything of interest - I've inserted that file if anyone else wants to take a look.  

Also, I glanced at my code again and I know exactly where the "Number or numeric function expected" error is coming from.  It's a new line I added today while trying to get it to run from the plugin menu.  Basically line 3 can just be removed.  I'm quite sure that line 3 has nothing to do with the failure to run from the plugin menu.

Re: Wayne's suggestion to report a bug: my apologies - I figured this was something odd in my macro code, I never considered that it could be a bug in Fiji.  I will certainly submit a bug report.

Thanks!

Kaitlin Snider
________________________________________
From: Johannes Schindelin <[hidden email]>
Sent: Wednesday, June 25, 2014 2:09 PM
To: Snider, Kaitlin
Cc: [hidden email]
Subject: RE: Macro in Plugin Menu fails to run

Hi Kaitlin,

On Wed, 25 Jun 2014, Snider, Kaitlin wrote:

> Yes - sorry, I should have specified, it does expect an image to be
> open.

Even so, it still gives me that error... Are you using a custom version of
ImageJ 1.x? Or maybe another version than ImageJ 1.49b?

> Any idea why it would start in your Fiji and not do anything in mine?
> If I try it in my Fiji with no image open, it gives me the same result
> as with an open image: reads "Command finished: Cell nuclei macro x" on
> the status line, no error message.  Am I possibly missing a .jar or
> plugin that it needs to run from the plugin menu?

One thing you could do would be to run the updater and switch to advanced
mode to figure out whether there are locally-modified files, or local-only
ones that might interfere.

Another thing would be to start Fiji from the command-line and inspect the
console log:

        http://fiji.sc/Command-Line_Debugging

Ciao,
Johannes
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro in Plugin Menu fails to run

Snider, Kaitlin
And I forgot to include the debug console log - here it is.

Thanks again everyone for your patience!

Kaitlin Snider
________________________________________
From: Snider, Kaitlin
Sent: Wednesday, June 25, 2014 3:09 PM
To: Johannes Schindelin; [hidden email]
Cc: [hidden email]
Subject: RE: Macro in Plugin Menu fails to run

Hi Johannes and Wayne,

Re: Johannes suggestions and questions: I'm currently running ImageJ 1.49b.  I double-checked and I don't have any locally modified files.  I ran it through the debug mode and copied the output the debug log produced to a file, but I'm not sure how to read the debug report and haven't the faintest idea if it points to anything of interest - I've inserted that file if anyone else wants to take a look.

Also, I glanced at my code again and I know exactly where the "Number or numeric function expected" error is coming from.  It's a new line I added today while trying to get it to run from the plugin menu.  Basically line 3 can just be removed.  I'm quite sure that line 3 has nothing to do with the failure to run from the plugin menu.

Re: Wayne's suggestion to report a bug: my apologies - I figured this was something odd in my macro code, I never considered that it could be a bug in Fiji.  I will certainly submit a bug report.

Thanks!

Kaitlin Snider
________________________________________
From: Johannes Schindelin <[hidden email]>
Sent: Wednesday, June 25, 2014 2:09 PM
To: Snider, Kaitlin
Cc: [hidden email]
Subject: RE: Macro in Plugin Menu fails to run

Hi Kaitlin,

On Wed, 25 Jun 2014, Snider, Kaitlin wrote:

> Yes - sorry, I should have specified, it does expect an image to be
> open.

Even so, it still gives me that error... Are you using a custom version of
ImageJ 1.x? Or maybe another version than ImageJ 1.49b?

> Any idea why it would start in your Fiji and not do anything in mine?
> If I try it in my Fiji with no image open, it gives me the same result
> as with an open image: reads "Command finished: Cell nuclei macro x" on
> the status line, no error message.  Am I possibly missing a .jar or
> plugin that it needs to run from the plugin menu?

One thing you could do would be to run the updater and switch to advanced
mode to figure out whether there are locally-modified files, or local-only
ones that might interfere.

Another thing would be to start Fiji from the command-line and inspect the
console log:

        http://fiji.sc/Command-Line_Debugging

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Cell Nuclei Macro X debug mode.txt (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Macro in Plugin Menu fails to run

dscho
In reply to this post by Snider, Kaitlin
Hi Kaitlin,

On Wed, 25 Jun 2014, Snider, Kaitlin wrote:

> Re: Johannes suggestions and questions: I'm currently running ImageJ
> 1.49b.  I double-checked and I don't have any locally modified files.  I
> ran it through the debug mode and copied the output the debug log
> produced to a file, but I'm not sure how to read the debug report and
> haven't the faintest idea if it points to anything of interest - I've
> inserted that file if anyone else wants to take a look.  

The debug log actually does not show anything suspicious, but it is
suspiciously short.

> Also, I glanced at my code again and I know exactly where the "Number or
> numeric function expected" error is coming from.  It's a new line I
> added today while trying to get it to run from the plugin menu.
> Basically line 3 can just be removed.  I'm quite sure that line 3 has
> nothing to do with the failure to run from the plugin menu.

Right. With line 2 removed, I actually can run it here (but it stops
eventually because your classifier cannot be found, of course).

In the report you submitted via Help>Report a Bug (thank you!), it looks
as if you have four versions of this macro, two in macros/ (one with spaces
and one with underscores), one in plugins/Macros/ and one in plugins/.
Could you press Ctrl+L to open the Command Launcher (which claims to be
the Command Finder nowadays, but the "L" is easier to remember if you
think of it as the Launcher), type in "Cell" and see what exactly it shows
as "class name"? It should show something like:

        Script:D:\GOOGLE~1\Fiji\Fiji.app\plugins\Macros\Cell_nuclei_macro_x.ijm

We will fix this problem together, I am certain!

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro in Plugin Menu fails to run

Thomas Boudier
In reply to this post by Snider, Kaitlin
Dear Kaitlin,

I tested the macro, it´s working fine. Just remove the command
selectWindow() at the beginning. SelectWindow requires the title of an
image.

Thomas


> Hi All,
>
>
> I've been working on a macro to automate selection of 3D ROIs.  The macro
> itself is working great; I can pull it up in the script editor and it runs
> correctly.  However, I'm going to need to call it from the plugin menu,
> and that isn't working. Right now I have it saved under Fiji ->  Fiji.app
> -> plugins as "Cell_nuclei_macro_x.ijm".  It shows up in the plugins menu
> as "Cell nuclei macro x".  If I click on that, the "status bar" on the
> Fiji main window reads "Command finished: cell nuclei macro x", but
> nothing actually happens.  I think this is something specific to my macro,
> not my Fiji install, as another macro I made (a simple macro that simply
> turns the image binary and saves it) works just fine under the same
> circumstances: saved under Fiji ->  Fiji.app -> plugins as
> "Sample_binary.ijm", shows up in the plugins menu as "Sample binary", runs
> correctly from the script editor AND from the plugins menu.  I'm pretty
> lost as to how to troubleshoot this issue.  Any ideas?
>
>
> I have attached links to:
>
> The macro that won't work from the plugin menu
> (https://docs.google.com/file/d/0Bw4MsPRmUoyIUGF3ejlWS2taOWs/edit)
>
> The macro that does work from the plugin menu
> (https://docs.google.com/file/d/0Bw4MsPRmUoyIT0JYeHc2M1EwMTQ/edit)
>
> A sample image that I've used to test these macros
> (https://docs.google.com/file/d/0Bw4MsPRmUoyINktTc1FhQlBKUVk/edit?)?
>
>
> Thanks in advance!
>
>
> Kaitlin Snider
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>


--
Thomas Boudier, Associate Prof. UPMC,
IPAL UMI 2955, Singapore.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro in Plugin Menu fails to run

dscho
In reply to this post by Snider, Kaitlin
Hi Kaitlin,

On Wed, 25 Jun 2014, Snider, Kaitlin wrote:

> And I forgot to include the debug console log - here it is.

And as a last resort, could you please call "Make Fiji Package" (use the
Ctrl+L trick for convenience), make a package and upload it via
Help/Upload Sample Image? I would then hopefully a better chance to
reproduce your problem.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: FW: Macro in Plugin Menu fails to run - FIXED!

dscho
In reply to this post by Snider, Kaitlin
Hi Kaitlin,

On Thu, 26 Jun 2014, Snider, Kaitlin wrote:

> I sent the below message last night, not sure why it never reached the list:

Oh, I must have missed it!

> "I was messing around with the plugin some more and discovered that
> simply renaming it to "Cell_" fixes the problem.  I'm not sure why
> "Cell_nuclei_macro_x" didn't work, but "Cell_" works fine, so I'll use
> that.

That is great news: you can run your macro again.

> I suspect this could have been because I had the same file with the same
> name under both the Plugins folder and the Macros folder.

Yes, this is what I pointed out when I listed the four different versions
of the macro. I understand that it is easy to get into that situation...

If you type Ctrl+L to open the Command Launcher and then type "Cell" into
the search box, do you see something like "Script:..." in the class name
column? I usually use the Command Launcher to diagnose such problems
because it lists exactly which file is responsible for running the command
associated with the menu item.

> Much thanks to everyone for all of your help and patience - as a person
> who is VERY new to any kind of programming, it's wonderful to have this
> level of support available!

That is great feedback, thank you!

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html