Ticket #1228 (closed defect: fixed)
Add functionality to OPS' EquationParser
Reported by: | bdezonia | Owned by: | bdezonia |
---|---|---|---|
Priority: | major | Milestone: | imagej2-unscheduled |
Component: | ImgLib2 OPS | Version: | |
Severity: | serious | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #1632 |
Description (last modified by bdezonia) (diff)
It is a simple matter to enhance the OPS' equation syntax by adding more unary functions to the unary operation packages and then adding their signature to reservedWordLookup() in OP's parse subpackage Lexer class.
By enhancing the language we make ImageJ2's Process > Math > Equation command more powerful. We also add power to Imglib OPS' TextSpecifiedPointSet class.
We could look at other packages to see common functions we do not yet support. Some such packages to consider would be numpy, scipy, gnu scientific library, the jscience library, apache commons math, etc.
Some functions already of interest might be sigmoid, logit, logistic, harmonic oscialltor, gamma, and exp2 (is this just 2^{x}?).
Change History
comment:2 Changed 7 years ago by bdezonia
And another function: step(x). step(x) = 0 if x < 0 and 1 otherwise. This matches Mathematica's implementation of the Heaviside Step Function. Note that step(0) == 1 here while using the textbook definition it should == 0.5.
comment:6 Changed 7 years ago by bdezonia
With imglib commit 0b39355b34f3dbb395f8b8033a358b248323940d tmin, tmax, and step added as equation tokens.
comment:7 Changed 7 years ago by bdezonia
- Blocking 1460 added; 1333 removed
- Milestone changed from imagej-2.0.0-beta4 to imagej-2.0.0-beta5
comment:8 Changed 7 years ago by bdezonia
Other funcs to add: min(x,y) (or x min y), max(x,y) or (x max y).
comment:9 Changed 7 years ago by bdezonia
With commit d80e2a8dc8d34054fb5ef2fe961c6bc081de60f3 min() and max() added to equation language
comment:10 Changed 6 years ago by bdezonia
- Blocking 1632 added; 1460 removed
- Milestone changed from imagej2-b7-ndim-data to imagej2-unscheduled
comment:11 Changed 5 years ago by curtis
- Status changed from new to closed
- Resolution set to fixed
ImgLib2 OPS has been supplanted by ImageJ OPS. The ImageJ OPS equation op cheats by using Javascript, so the syntax is very powerful at the expense of performance. That's good enough for me for now, and with the ImageJ OPS framework it is always possible to add other higher-priority special case ops for performance, should it become necessary.
Another simple extension: "tmin" and "tmax" which return the min and max possible values for the type of the input image. For instance a 16 bit unsigned image would return 0 for tmin and 65535 for tmax.