-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[processing] Add method for algorithms to preprocess parameter values #6658
Conversation
Allows algorithms to pre-processes a set of parameters, allowing the algorithm to clean their values. This method is automatically called after users enter parameters, e.g. via the algorithm dialog. This method should NOT be called manually by algorithms.
Pretty similar to what I am planning to do for the filter algorithm. But I think we will there not only require to return an updated variant map, but actually analyze it again for outputs etc.
I am still not completely sure about the best way to do it... |
@m-kuhn I'm not sure that's the same use case. Can you give some more details (or link to code)? |
@m-kuhn , its in the AlgorithmDialog getParameterValues method. So analyze can also be done at end of preprocessParameters() If you add a preprocessParameters in algorithm class, it could take care of situation where you have removing/adding output parameters and do the analyze. |
Also not sure about the use case, but it potentially affects the same API. What needs to be done is that outputs are created based on configuration, so I guess it's a bit more complicated in the requirements than the one here. What I was thinking about is a return value that gives instructions to the caller if the algorithm characteristics (parameters) have changed and need to be checked again. I think this would require a boolean return value instead of a modified map. Something like this, but there would be quite some variations possible as well:
|
I'd like to merge this if you're ok with it. It addresses an urgent current use case and is easily backportable. We could then move discussion about your requirements to a different PR when there's code available to visualise how you need things to work... |
@nyalldawson ok to backport as a hotfix. I'd be glad if possibly if you could give me a short feedback on the above if possible (as in: "no-go", "yes, but you could try ... instead", "yes please"), I'll be happy to continue with this soon. |
@m-kuhn I can't really comment without knowing the use case for it. It does seem a bit odd requiring iterative calls, but without seeing how you'd use it I can't suggest an alternative! |
@rkanavath I think all the PRs you needed are merged now, let me know if there's anything else you need. |
well, backport as a hotfix isn't equal to merge to master... |
@nyalldawson , All change needed for otb plugin to move on is ready. But, |
Allows algorithms to pre-processes a set of parameters, allowing the algorithm to clean their values.
This method is automatically called after users enter parameters, e.g. via the algorithm dialog. This method should NOT be called manually by algorithms.