Skip to content

Commit da0424f

Browse files
committed
Introspecting Ops: Minor edits
1 parent f7d5697 commit da0424f

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

docs/ops/doc/IntrospectingOps.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# Reasoning about Ops
22

3-
The declarative nature of Ops is convenient for matching and execution, however there are times where it is necessary to understand where an Op comes from. This page describes the tools provided by SciJava Ops to understand the code underneath.
3+
The declarative nature of Ops is convenient for matching and execution, but sometimes it is necessary to know where an Op comes from. This page describes the tools provided by SciJava Ops to understand the code underneath.
44

55
Naturally, to understand where an Op came from, you first need an Op:
66

77
```java
88
var img = ...;
99
var out = ...;
1010
var sigma = 5.0;
11+
1112
// This Op call finds a "filter.gauss Op" that blurs an image using a provided
12-
// sigma, placing the result in out.
13+
// sigma, placing the result in the output container "out".
14+
//
15+
// NB the Op is saved within the variable "op"
1316
var op = ops.op("filter.gauss").input(img, sigma).output(out).computer();
1417
```
1518

@@ -26,51 +29,49 @@ var info = Ops.info(op);
2629
The `OpInfo` often provides all needed information, but if `op` utilizes dependencies or other framework features, you may wish to introspect the "rich" Op instead, using the method `Ops.rich`.
2730

2831
```java
29-
import org.scijava.ops.api.Ops;
30-
3132
var richOp = Ops.rich(op);
3233
```
3334

3435
These two methods provide gateways into learning more about where your Op came from!
3536

36-
## Code and Versions
37+
## Implementations and Versions
3738

38-
For reproducibility, it is important to know not only the underlying lines of code backing each executed Op, but additionally the *version* of that line of code, as different versions of the same codebase can produce different results. Fortunately, SciJava Ops provides mechanisms to determine both!
39+
For reproducibility, it is important to know not only the underlying implementations, or discrete lines of code, backing each executed Op, but additionally the *version* of that implementation if it changes over time. Fortunately, SciJava Ops provides mechanisms to determine both!
3940

40-
A unique identifier to the lines of code can be obtained from each Op's `OpInfo`, using the method `OpInfo.implementationName()`. For example, the following
41+
A unique identifier to an Op's implementation can be obtained from its `OpInfo` using the method `OpInfo.implementationName()`. For example, the following
4142

4243
```java
4344
System.out.println(Ops.info(op).implementationName());
4445
```
4546

46-
might print out (if you're using `scijava-ops-image`):
47+
might print out (if you're using `scijava-ops-image` version `1.0.0`):
4748

4849
```
49-
> org.scijava.ops.image.filter.gauss.Gaussians.gaussRAISingleSigma(net.imglib2.RandomAccessibleInterval<I>,double,net.imglib2.outofbounds.OutOfBoundsFactory<I, net.imglib2.RandomAccessibleInterval<I>>,net.imglib2.RandomAccessibleInterval<O>)Reduction1
50+
org.scijava.ops.image.filter.gauss.Gaussians.gaussRAISingleSigma(net.imglib2.RandomAccessibleInterval<I>,double,net.imglib2.outofbounds.OutOfBoundsFactory<I, net.imglib2.RandomAccessibleInterval<I>>,net.imglib2.RandomAccessibleInterval<O>)Reduction1
5051
```
5152

5253
Note that in many cases, including the case above, the implementation name may not itself be an explicit piece of code, however it must always explain how an explicit piece of code became the Op you've matched.
5354

5455
Similarly, the method `OpInfo.version()` describes **the version of the Op**, which is set by whichever component declares the Op. This version might change due to:
55-
* An update in the version of the underlying implementation (such as a bump in the version of OpenCV)
56+
* An update in the version of the underlying implementation (such as a bump in the version of `scijava-ops-image`)
5657
* An update to the Op itself (such as the inclusion of an additional alias, or a change in the Op priority)
5758

58-
SciJava Ops guarantees users identical outputs from an Op execution given identical Op inputs **and** an identical `OpEnvironment`. Notably, your results may differ slightly if you:
59-
* Add new Ops into your `OpEnvironment`, usually by adding new Ops. This might cause a new Op to take precedence over an existing Op.
60-
* Change the version of an Op within the `OpEnvironment`
61-
* Pass different inputs to the Op.
59+
SciJava Ops guarantees identical outputs from an Op execution given identical inputs **and** an identical `OpEnvironment`. Your results may differ slightly if you:
60+
* Add new Ops into your `OpEnvironment`, if a new Op takes precedence over an existing Op
61+
* Change the version of an Op within the `OpEnvironment` by updating a component
62+
* Pass different inputs to the Op
6263

6364
## Op Signatures
6465

65-
While SciJava Ops requires the aforementioned constraints to ensure reproducible Op *matches*, the concept of **Op Signatures** enables SciJava Ops to **reproducibly reconstruct prior matches** in *new environments* (assuming the prior Op is still available). Op signatures allow users to enforce reproducibility when e.g. adding new Ops to the `OpEnvironment`.
66+
While SciJava Ops requires the aforementioned constraints to ensure reproducible Op *matches*, the concept of **Op Signatures** enables SciJava Ops to **reproducibly reconstruct prior matches in new environments** (assuming all required Ops are still available).
6667

6768
Given an matched Op `op`, its signature can be obtained using the static method `Ops.signature()`, which *distills* all Op implementation names and versions into a single string. For example, the following
6869

6970
```java
7071
System.out.println(Ops.signature(op));
7172
```
7273

73-
might print out (again using `scijava-ops-image`):
74+
might print out (again using `scijava-ops-image` version `1.0.0`):
7475

7576
```
7677
|Reduction:|ParamsReduced:1|OriginalInfo:|Info:org.scijava.ops.image.filter.gauss.Gaussians.gaussRAISingleSigma(net.imglib2.RandomAccessibleInterval<I>,double,net.imglib2.outofbounds.OutOfBoundsFactory<I, net.imglib2.RandomAccessibleInterval<I>>,net.imglib2.RandomAccessibleInterval<O>)@1.0.0{}
@@ -98,7 +99,7 @@ There still exist limitations with reconstructive features, including:
9899

99100
## Info Trees
100101

101-
Often, Ops contain Op dependencies, which may have dependencies themselves. As such, the Ops returned by SciJava Ops are best thought of as a [Tree](https://en.wikipedia.org/wiki/Tree_(data_structure)). While an Op's signature, described above, describes the entire Tree, it is often more convenient to interrogate dependencies using the `InfoTree` data structure, obtained using the method `Ops.infoTree()`:
102+
Ops often utilize Op dependencies, which may have dependencies themselves. As such, the Ops returned by SciJava Ops are best thought of as a [tree](https://en.wikipedia.org/wiki/Tree_(data_structure)). While an Op's signature, described above, describes the entire Tree, it is often more convenient to interrogate dependencies using the `InfoTree` data structure, obtained using the method `Ops.infoTree()`:
102103

103104
```java
104105
var tree = Ops.infoTree(op);
@@ -108,11 +109,9 @@ The `InfoTree` API allows users to interrogate:
108109
* The root `OpInfo`, accessible using `InfoTree.info()`
109110
* All dependencies, which are each themselves an `InfoTree`, using `InfoTree.dependencies()`.
110111

111-
The `InfoTree` allows users to answer the question of which Ops are being used as dependencies, providing access to an otherwise unavailable feature of SciJava Ops.
112-
113112
## Op History
114113

115-
A final task essential to Op reproducibility is determining the list of Ops responsible for the current state of a given Object, which is helpful when many Ops contribute to some final state. To answer this question, each `OpEnvironment` records Op executions within an `OpHistory` object, accessible using the method `OpEnvironment.history()`.
114+
It is often useful to determine the list of Ops responsible for the current state of a given Object. To aid in this task, each `OpEnvironment` records Op executions within an `OpHistory` object, accessible using the method `OpEnvironment.history()`.
116115

117116
```java
118117
// OpEnvironment.history() provides access to a OpHistory object

0 commit comments

Comments
 (0)