Re: Labels and default values for @parameter in scripts

Posted by Mark Hiner on
URL: http://imagej.273.s1.nabble.com/Labels-and-default-values-for-parameter-in-scripts-tp5012655p5012658.html

Hi Michael,

It's great to see people using script parameters. These are a new feature
introduced with ImageJ2[1], and thus are still relatively new - so feedback
like this is both helpful and necessary in making these features robust.
For ImageJ2-specific features like this, you can also use the imagej-devel
mailing list[2] or file issues directly on GitHub[3].

> Except this page I can't find any documentation on using script
parameters in ImageJ. Is there some more documentation, I was not able to
find?

This is the intended documentation page. It's definitely sparse right now.
I am updating it in response to your feedback, but if you have any more
suggestions/requests for what would be helpful here, please let us know.

> In plugins you can define labels and default values for parameters. In
scripts this is not possible.

I had to dig around for this a bit, but it actually is possible! It uses
the same Java syntax as plugins, but requires the properties (like labels
and default values) to be in a parenthetical expression. Examples are now
on the wiki[4].

>The default values are strange.

Agreed. I added an issue[5] for this.

> You can't select the full input field by using a double click.
> Using [Tab] to switch between fields works bad

These are UI-specific[6] issues and so shouldn't be problems with scripting
itself. I was able to confirm this behavior on a mac, so I'll look into it.

Thank you for the comments!

Best,
Mark

[1] http://imagej.net/ImageJ2
[2] http://imagej.net/Mailing_lists
[3] http://imagej.net/Source_code#Source_code
[4] http://imagej.net/Script_parameters#Parameter_properties
[5] https://github.com/scijava/scijava-common/issues/160
[6] https://github.com/scijava/scijava-ui-swing

On Thu, Apr 30, 2015 at 6:28 AM, Michael Entrup <
[hidden email]> wrote:

> Hi,
>
> using script parameters might be a nice solution to write small scripts
> that need user inputs. But there are some drawbacks that keep me away from
> using script parameters.
>
> In plugins you can define labels and default values for parameters. In
> scripts this is not possible.
>
> The default values are strange. When using @Integer the default value is '-
> 2.147.483.648'.
>
> You can't select the full input field by using a double click. The minus
> sign is not selected, when double clicking the number.
>
> Using [Tab] to switch between fields works bad. Normally I expect that the
> content of the next input field is selected, but only the cursor is placed
> at the next field. [Ctrl]+[A] is necessary to replace the default value.
>
> The attached screen shot shows the dialog that is shown, when using 4
> different script parameters.
>
> Is all this intended, or is still work in progress?
> Except this page [1] I can't find any documentation on using script
> parameters in ImageJ. Is there some more documentation, I was not able to
> find?
>
> Best regards
> Michael
>
>
> [1] http://imagej.net/Script_parameters
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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