|Op Finder (ImageJ)|
|Maintainer||Mark Hiner, Ctrueden|
|Initial release||April 2016|
|Latest version||April 2016|
The Op Finder is a utility for browsing, learning about and running all available Ops. Because Ops are plugins and can be dynamically extended and specialized for particular inputs, it is not practical to have static documentation on a given Op. By using the Op Finder, you explore the actual list of Ops available in your installation. The purpose of this guide is to familiarize you with the basic capabilities of the Op Finder, to enable you to learn and experiment with Ops.
There are two ways to start up the Op Finder:
- Using the shortcut: ⇧ Shift+L
- Using the menu path: › ›
Parts of the Op Finder
- Search bar for filtering the list of Ops.
- Toggle button to change between a user and developer view.
- Play button for running the selected Op.
- Copy button to copy the selected cell contents.
- Help button to open up the Wiki reference page in your browser.
- Status area showing success/failure notifications e.g., for copying or running Ops.
- Namespaces and Op types: these can be expanded to explore the tree-based organization of Ops.
- Op implementation: the leaves of this tree tell us what parameter options are available for each Op type. We interpret this particular example as "There is an Add Op in the Math namespace, that operates on an image and a numeric value".
- Progress area showing progress when performing lengthy operations, such as filtering the Ops.
- Details pane toggle. Click this button to show/hide a pane containing additional information about the currently selected Op.
- Hover your mouse over any part of the Op Finder to get a descriptive tool-tip.
- Double-click any cell to copy its contents to your clipboard.
There is a lot of information surrounding Ops. One goal of the Op Finder is to present this information in a way that can be easily understood. To facilitate this, multiple views are available, tailoring the content of the Op Finder to a particular audience.
Ops in this view are focused on answering the question "What can I do right now with Ops?" The following guidelines are used to create this list:
- Only Ops directly involving images are displayed
- Parameter types are generalized
- Optional parameters are hidden
- Details pane open by default
- Precise Op signature
- Optional parameters are shown
- Referring class is shown
Things to do
TODO fuzzy, no namespaces
TODO how does the play button work?
TODO take a code snippet and turn it into a script, step-by-step
1. The first thing to do is find an Op of interest. In this case, we start from the User view and see that there is a Convolve Op we want to try:
2. In the Script Editor, we need to add a reference to the
OpService which will be our entry point for Op usage:
# @OpService ops
- Note: this guide is written in Python but any scripting language will work
- and paste:
# @OpService ops ops.run("filter.convolve", Img, Img, RandomAccessibleInterval, long, OutOfBoundsFactory, OutOfBoundsFactory, RealType, ImgFactory)
4. Looking at the Op call, we see that there are a lot of parameters. To get a better idea of what these are, we look at the
Op Signature column of the Op Finder:
- All of the parameters with a ? are optional. For our purposes, let's just work with the input image, kernel, and returned image:
# @OpService ops out = ops.run("filter.convolve", Img, RandomAccessibleInterval)
5. Now we need to get inputs for our Op, and ensure the output is displayed. These tasks can all be handled with additional @Parameters to the script:
# @OpService ops # @Dataset input # @Dataset kernel # @OUTPUT ImgPlus out out = ops.run("filter.convolve", input, kernel)
- Note: the types we copied and pasted just represent a minimum requirement. Open images will almost always be
Datasets, which themselves have an
ImgPlus, which has an
Imgwhich is a
RandomAccessibleInterval. If you want multiple input images you should use
Dataset. A safe alternative for single inputs is
ImgPlus. Both of these classes contain additional metadata which can be useful in your script.
6. Our script is done! If we open a base image and kernel in ImageJ we can run our script. The
OpService is populated automatically by the ImageJ framework, and an input window is automatically created to select the images: