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
* Entry point for convenient Op calls, providing a builder-style interface
153
+
* to walk through the process step-by-step.
154
+
* <br/>
155
+
* The general order of specification:
156
+
* <ol>
157
+
* <li>The op name (and {@link Hints}, if desired)</li>
158
+
* <li>The number of input(s)</li>
159
+
* <li>The type or value(s) of input(s)</li>
160
+
* <li>One of:
161
+
* <ul>
162
+
* <li>The type or value of the output</li>
163
+
* <li>Which input should be modified in-place</li>
164
+
* </ul>
165
+
* </li>
166
+
* </ol>
167
+
* The first two steps are required, at a minimum. The choices you make will
168
+
* determine the <i>type</i> of Op that is matched:
169
+
* <ul>
170
+
* <li>No inputs → <code>Producer</code> or <code>Computer</code></li>
171
+
* <li>Inputs with an output <i>value</i> → <code>Computer</code></li>
172
+
* <li>Inputs with an output <i>type</i> → <code>Computer</code> or <code>Function</code></li>
173
+
* <li>Inputs with no output → <code>Inplace</code> or <code>Function</code> with unknown (<code>Object</code>) return</li>
174
+
* </ul>
175
+
* <br/>
176
+
* <p>
177
+
* Examples:
178
+
* {@code OpEnvironment env = new DefaultOpEnvironment();}
179
+
* <ul>
180
+
* <li>{@code env.op("create").arity0().outType(DoubleType.class).create();} — run an Op creating an instance of the ImgLib2 {@code DoubleType}</li>
181
+
* <li>{@code env.op("create").arity0().outType(Img.class).create();} — run an Op creating a raw instance of an ImgLib2 {@code Img}.</li>
182
+
* <li>{@code env.op("create").arity0().outType(new Nil<Img<DoubleType>>(){}).create();} — run an Op creating an instance of an ImgLib2 {@code Img<DoubleType>}.</li>
183
+
* <li>{@code env.op("math.add").arity2().inType(Integer.class, Integer.class).function();} — get an instance of an Op to add two integers together. Return type will be {@code Object}.</li>
184
+
* <li>{@code env.op("math.add").arity2().input(1, 1).outType(Double.class).apply();} — run an Op combining two integers. Return type will be {@code Double}.</li>
185
+
* <li>{@code env.op("math.add").arity2().input(img1, img2).output(result).compute();} — run an Op combining two images and storing the result in a pre-allocated image.</li>
186
+
* <li>{@code env.op("filter.addPoissonNoise").arity1().input(img1).mutate();} — run an Op adding poisson noise to an input image.</li>
187
+
* </ul>
188
+
* </p>
189
+
*
190
+
* @param opName The name of the Op to run
191
+
* @return The {@link OpBuilder} instance for builder chaining.
192
+
* @throws org.scijava.ops.api.features.OpMatchingException if the Op request cannot be satisfied
193
+
* @see <a href="#op-java.lang.String-org.scijava.ops.api.Hints-" title="To specify a Hints instance to use">op(String, Hints)</a>
194
+
* @see OpBuilder
195
+
*/
151
196
defaultOpBuilderop(finalStringopName) {
152
197
returnnewOpBuilder(this, opName);
153
198
}
154
199
200
+
/**
201
+
* As {@link #op(String)} but using a provided {@link Hints}.
202
+
*
203
+
* @param opName The name of the Op to run
204
+
* @param hints The {@code Hints} instance to use for Op matching
205
+
* @return The {@link OpBuilder} instance for builder chaining.
206
+
* @throws org.scijava.ops.api.features.OpMatchingException if the Op request cannot be satisfied
207
+
* @see <a href="#op-java.lang.String-" title="To use the default Hints for this OpEnvironment">op(String)</a>
* Convenience class for looking up and/or executing ops using a builder
50
-
* pattern. The general order of specification:
51
-
* <ol>
52
-
* <li>The op name</li>
53
-
* <li>The number of input(s)</li>
54
-
* <li>The type or value(s) of input(s)</li>
55
-
* <li>One of:
56
-
* <ul>
57
-
* <li>The type or value of the output</li>
58
-
* <li>Which input should be modified in-place</li>
59
-
* </ul>
60
-
* </li>
61
-
* </ol>
62
-
* The first two steps are required, at a minimum. The choices you make will
63
-
* determine the <i>type</i> of Op that is matched:
64
-
* <ul>
65
-
* <li>No inputs → <code>Producer</code> or <code>Computer</code></li>
66
-
* <li>Inputs with an output <i>value</i> → <code>Computer</code></li>
67
-
* <li>Inputs with an output <i>type</i> → <code>Computer</code> or <code>Function</code></li>
68
-
* <li>Inputs with no output → <code>Inplace</code> or <code>Function</code> with unknown (<code>Object</code>) return</li>
69
-
* </ul>
50
+
* pattern. Typical entry point is through {@link OpEnvironment#op(String)}
51
+
* - which contains full usage information.
70
52
* <br/>
71
-
* <p>
72
53
* Note that the intermediate builder steps use the following acronyms:
73
54
* <ul>
74
55
* <li><b>IV/OV:</b> Input/Output Value. Indicates instances will be used for matching; ideal if you want to directly run the matched Op, e.g. via <code>apply</code>, <code>compute</code>, <code>mutate</code> or <code>create</code> methods.</li>
75
56
* <li><b>IT/OT:</b> Input/Output Types. Indicates {@code Classes} will be used for matching; matching will produce an Op instance that can then be (re)used. There are two "Type" options: raw types or {@code Nil}s. If you are matching using a parameterized type use the {@code Nil} option to preserve the type parameter.</li>
76
57
* <li><b>OU:</b> Output Unknown. Indicates an output type/value has not been specified to the builder yet. The output, if any, will simply be an {@code Object}</li>
77
58
* </ul>
78
59
* </p>
79
-
* <p>
80
-
* Examples:
81
-
* {@code OpEnvironment env = new DefaultOpEnvironment();}
82
-
* <ul>
83
-
* <li>{@code env.op("create").arity0().outType(DoubleType.class).create();} — run an Op creating an instance of the ImgLib2 {@code DoubleType}</li>
84
-
* <li>{@code env.op("create").arity0().outType(Img.class).create();} — run an Op creating a raw instance of an ImgLib2 {@code Img}.</li>
85
-
* <li>{@code env.op("create").arity0().outType(new Nil<Img<DoubleType>>(){}).create();} — run an Op creating an instance of an ImgLib2 {@code Img<DoubleType>}.</li>
86
-
* <li>{@code env.op("math.add").arity2().inType(Integer.class, Integer.class).function();} — get an instance of an Op to add two integers together. Return type will be {@code Object}.</li>
87
-
* <li>{@code env.op("math.add").arity2().input(1, 1).outType(Double.class).apply();} — run an Op combining two integers. Return type will be {@code Double}.</li>
88
-
* <li>{@code env.op("math.add").arity2().input(img1, img2).output(result).compute();} — run an Op combining two images and storing the result in a pre-allocated image.</li>
89
-
* <li>{@code env.op("filter.addPoissonNoise").arity1().input(img1).mutate();} — run an Op adding poisson noise to an input image.</li>
0 commit comments