Support @Parameter annotation for Ops (in scripts)
It would be great to be able to use ops with the @Parameter annotation and as script parameter, as pointed out in a forum thread.
Something like:
// @Threshold(label="What Threshold to use?") threshold
// @Img input
// @OUTPUT Img output
output = threshold.compute(img)
I guess this requires establishing a connection between the requested op and input to enable matching?
~~I'm not sure if I like this idea. Will we introduce special annotations for each and every type of input parameter? I think the idea with such plugins as Threshold was that there is something like a Threshold class which can be annotated. SciJava detects, that this actually a plugin of many types and offers you a drop-down to select the threshold. Basically the same idea, just on class or plugin level. Correct me if I'm wrong @ctrueden.~~~
I didn't recognize that we are in the script world.
Will we introduce special annotations for each and every type of input parameter?
@Threshold is an annotation just like @Img, isn't it? In the example, I am trying to request something like Ops.Threshold.*.
I think the idea with such plugins as
Threshold
About which plugin(s) are you talking? The deprecated ThresholdMethod et al?
Yes, I meant something like ThresholdMethod et al. If we introduce them, I think there are mechanisms in SciJava that @Threshold in the script world would deliver the plugins as a drop-down. I think the pattern is https://github.com/scijava/scijava-common/blob/master/src/main/java/org/scijava/plugin/SingletonService.java.
I think there are mechanisms in SciJava that
@Thresholdin the script world would deliver the plugins as a drop-down.
That's right. The following Groovy script produces the mentioned drop-down:
// @net.imagej.threshold.ThresholdMethod threshold
I was just thinking out loud about adding something like that on the Ops level (since ThresholdMethod el al are deprecated) as well. AFAICT, implementations of ThresholdMethod are Plugins themselves, that's why Scijava picks them up.
I definitely have thoughts, opinions and plans surrounding this, and have for a long time. I will try to elaborate in this here issue when I get a chance, but there will be some delay.