You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Let descriptions method operate on entire namespaces #136
Suppose I want to run a gaussian blur on an net.imglib2.img.Img but I don't know the op signature filter.gauss. Let's say that I know that the gaussian blur op is in the filter namespace but I'm unsure if its gauss or gaussian. In this scenario it would be great to have a mechanism to return all ops in a given namespace.
Current behavior:
# get op environmentfromorg.scijava.ops.apiimportOpEnvironmentops=OpEnvironment.getEnvironment()
print(ops.descriptions("filter"))
Output:
[]
Proposed behavior:
# get op environmentfromorg.scijava.ops.apiimportOpEnvironmentops=OpEnvironment.getEnvironment()
print(ops.descriptions("filter"))
With this behavior I can easily find that the op signature I want in the filter namespace is filter.gauss(). I don't think we need to return all the possible input parameters for the ops as that will create an unruly list. Instead I think just returning the signature is fine. The user can get the description of the specific op for parameter information if they desire.
For more advanced cases like substring searching, you could do ops.descriptions().stream().filter(...). I.e., let's not make the descriptions function too clever. I think only the following cases should work:
ops.descriptions("ns.op") – i.e. the fully qualified name of the op with namespace
ops.descriptions("ns") – i.e. the namespace name alone
ops.descriptions("op") – i.e. the short name of the op
changed the title [-]Lets descriptions method operate on entire namespaces[/-][+]Let descriptions method operate on entire namespaces[/+]on Nov 16, 2023
Implementation-wise, I think that the following is the way to go:
Set<String> set = newHashSet<>();
for (Strings : opNames) {
Stringprefix = s.substring(s.indexOf('.')); // if no dot then the whole thingset.add(prefix)
}
ops.descriptions(String name) will return:
First, each name contained within the namespace, like @elevans suggested in the initial comment.
Activity
[-]Improving searching/discovery for Ops[/-][+]Improve searching/discovery for Ops[/+][-]Improve searching/discovery for Ops[/-][+]Improve Op searching/discovery[/+][-]Improve Op searching/discovery[/-][+]Lets descriptions method operate on entire namespaces[/+]ctrueden commentedon Sep 26, 2023
For more advanced cases like substring searching, you could do
ops.descriptions().stream().filter(...). I.e., let's not make the descriptions function too clever. I think only the following cases should work:ops.descriptions("ns.op")– i.e. the fully qualified name of the op with namespaceops.descriptions("ns")– i.e. the namespace name aloneops.descriptions("op")– i.e. the short name of the opops.descriptions()– i.e. all ops[-]Lets descriptions method operate on entire namespaces[/-][+]Let descriptions method operate on entire namespaces[/+]ctrueden commentedon Nov 16, 2023
Another possibility would be to support the wildcard symbol
*to match as a glob.gselzer commentedon Nov 16, 2023
Here's my opinions:
ops.descriptions()returning all Ops would be too much to read. What if we just return the namespace?Implementation-wise, I think that the following is the way to go:
ops.descriptions(String name)will return:name.We probably also want to return a single string, not a
List<String>.gselzer commentedon Nov 28, 2023
Closed by scijava/incubator#95