script parameter for popup menu

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

script parameter for popup menu

JonNathan
Is there a way to implement a dialog popup menu using the "@parameter" notation in Fiji's script editor?  I couldn't find an example for this in the documentation.

Jon Marsh
Reply | Threaded
Open this post in threaded view
|

Re: script parameter for popup menu

Mark Hiner
Hi Jon,

The ImageJ wiki contains the documentation for script parameters[1]. It
mentions that dialogs are created automatically, but I think it could be a
bit clearer. I'll take a look.

Best,
Mark


[1] http://imagej.net/Script_parameters

On Fri, Mar 18, 2016 at 9:36 AM, JonNathan <
[hidden email]> wrote:

> Is there a way to implement a dialog popup menu using the "@parameter"
> notation in Fiji's script editor?  I couldn't find an example for this in
> the documentation.
>
> Jon Marsh
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/script-parameter-for-popup-menu-tp5015936.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: script parameter for popup menu

bnorthan
Hi Mark and Jon

a) if you are having trouble with script parameters in general the resource
Mark gave is good.  As well as http://imagej.net/Presentations (scroll down
to workshops->Parameterized Scripting + Ops).  Slides for that presentation
are here
https://imagej.github.io/presentations/2015-09-04-imagej2-scripting/#/

b) Perhaps you want a "menu" on your pop-up dialog??  Like a drop down that
gives you choices??

if so in java that is easy to do...

@Parameter(required = false, label = "Method", choices = { "Manual",
"Automatic" })
 private String method = "Automatic";

I couldn't get that to work in the script editor... do you know how Mark??
This is what I tried using Groovy

// @String(label="test",choices={"a","b"}) choicetest





On Fri, Mar 18, 2016 at 11:30 AM, Mark Hiner <[hidden email]> wrote:

> Hi Jon,
>
> The ImageJ wiki contains the documentation for script parameters[1]. It
> mentions that dialogs are created automatically, but I think it could be a
> bit clearer. I'll take a look.
>
> Best,
> Mark
>
>
> [1] http://imagej.net/Script_parameters
>
> On Fri, Mar 18, 2016 at 9:36 AM, JonNathan <
> [hidden email]> wrote:
>
> > Is there a way to implement a dialog popup menu using the "@parameter"
> > notation in Fiji's script editor?  I couldn't find an example for this in
> > the documentation.
> >
> > Jon Marsh
> >
> >
> >
> > --
> > View this message in context:
> >
> http://imagej.1557.x6.nabble.com/script-parameter-for-popup-menu-tp5015936.html
> > Sent from the ImageJ mailing list archive at Nabble.com.
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: script parameter for popup menu

Mark Hiner
On Fri, Mar 18, 2016 at 10:39 AM, Brian Northan <[hidden email]> wrote:

> // @String(label="test",choices={"a","b"}) choicetest
>

I feel like this is how it SHOULD work. Looks like a bug![1]

[1] https://github.com/scijava/scijava-common/issues/234

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

Re: script parameter for popup menu

JonNathan
In reply to this post by bnorthan
Yes to part "b" of your reply.  To be specific, I'm looking for the equivalent of the GenericDialog class addChoice method, but implemented using the @parameter notation. The script parameters make it easy to add inputs for primitives, Strings, etc. to a dialog, but I didn't see an easy way to add a drop-down list or combo-box to a dialog.

Thanks for any info you can provide.

Cheers,

Jon
Reply | Threaded
Open this post in threaded view
|

Re: script parameter for popup menu

JonNathan
In reply to this post by bnorthan
Sorry, I should have added that I want to do this using Fiji's script editor with a Jython script.

Jon
Reply | Threaded
Open this post in threaded view
|

Re: script parameter for popup menu

bnorthan
Hi Jon

I think the following will eventually work (there might be a bug right now)

# @String(label="typer", choices=["a","b"]) test

On Fri, Mar 18, 2016 at 11:59 AM, JonNathan <
[hidden email]> wrote:

> Sorry, I should have added that I want to do this using Fiji's script
> editor
> with a Jython script.
>
> Jon
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/script-parameter-for-popup-menu-tp5015936p5015941.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: script parameter for popup menu

ctrueden
Hi Jon,

> I think the following will eventually work (there might be a bug right
now)
>
> # @String(label="typer", choices=["a","b"]) test

Just wanted to quickly note that as of the new release of ImageJ2 a couple
of weeks ago, the above should work!

At the moment, any of parentheses, square brackets or curly braces will
work for the grouping, though it may be most future-proof to use curly
braces.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Fri, Mar 18, 2016 at 11:19 AM, Brian Northan <[hidden email]> wrote:

> Hi Jon
>
> I think the following will eventually work (there might be a bug right now)
>
> # @String(label="typer", choices=["a","b"]) test
>
> On Fri, Mar 18, 2016 at 11:59 AM, JonNathan <
> [hidden email]> wrote:
>
> > Sorry, I should have added that I want to do this using Fiji's script
> > editor
> > with a Jython script.
> >
> > Jon
> >
> >
> >
> > --
> > View this message in context:
> >
> http://imagej.1557.x6.nabble.com/script-parameter-for-popup-menu-tp5015936p5015941.html
> > Sent from the ImageJ mailing list archive at Nabble.com.
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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