Open
Description
As proposed by @Stefan-Posch on imagej-devel, we may be able to get rid of the concept of module initialization completely, in favor of only callbacks. When a preprocessor populates a parameter value, its callback is called.
Potential obstacles:
- At the moment, callbacks only happen when the
InputHarvester
UI changes a value, not whenModule#setInput
is called. This is not necessarily intuitive though—we would change that in order to switch to only callbacks. - If a parameter value needs to be derived from application state via service method calls, the callback would have to go on the relevant service(s). And in practice, those service values would never change beyond initially being set. But that wouldn't really hurt anything.
- If a "secondary" parameter value needs to be derived from multiple "primary" parameter values, each of those primary parameters would need a callback that includes a recalculation of the secondary parameter value. That is also fine, though.
- Chaining callbacks is not currently supported. That is, if a "tertiary" parameter is computed from a secondary parameter which is itself computed from a primary parameter, the primary parameter's callback would set the secondary parameter value directly, thus not triggering the secondary parameter's callback. It would be the programmer's responsibility to keep track of their "transitive parameter dependencies"—e.g., in the earlier example, the primary parameter's callback would need to update both the secondary and tertiary values.