Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for parameter validation #47

ctrueden opened this Issue May 1, 2014 · 1 comment


None yet
2 participants
Copy link

ctrueden commented May 1, 2014

Many RIA frameworks make it easy to validate a form's parameter values before executing some business logic. For example, if a string must conform to a certain regex, the UI can present a message to the user (ideally integrated with the form itself) informing them of the invalid value, and asking for a correction, rather than simply failing during execution.

We would like to provide similar functionality for ImageJ commands. One approach would be to have an optional validation callback for each parameter that returns an object describing any validation errors that occurred (error message, type of error, etc.), which the UI-specific input harvester can then present to the user.



This comment has been minimized.

Copy link

imagejan commented Jul 4, 2017

In a DynamicCommand, you can use a callback annotation to call methods that change values of inputs (and messages in case of visibility=MESSAGE).

For scripts, this is more difficult since the script methods are not yet known at preprocessing time, when the input harvesting happens. Maybe we could introduce some kind of "light" callbacks in the style of lambda expressions or simple boolean expressions, e.g.:

#@ boolean processDecimalPoint
#@ int    (visibility = "processDecimalPoint == false") integerInput
#@ double (visibility = "processDecimalPoint == true") doubleInput

#@ String (choices = {"files", "folder"}) folderChoice
#@ File   (style = "directory", visibility = "folderChoice.equals('folder')") singleFileInput
#@ File[] (visibility = "folderChoice.equals('files')") fileListInput

This requires improving the options for parameter visibility, see #42.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.