The Calculator enables you perform mathematical operations using entire images or profiles as operands.
It has a pocket calculator look alike user interface including an Expression Editor.
The calculator is available for curves and images and the Calculator can be activated by clicking on the Calculator button located in the Math Pane of the Image Tools > Modify tab and for curves in the Calculate Pane of the Profile Tools > Analyze tab:
from the as a dockable pane like shown below and can be turned on/off from the menu bar by clicking on the Calculator button
The calculator pane is divided into three parts:
The Expression Editor
The Operands List
The Operator Buttons
As supplement to the pocket calculator interface you use the Expression Editor to build your algebraic expression by entering text directly into the editor using the keyboard. When clicking the buttons in the lower parts of the pane the expression field will be updated accordingly.
Pressing ENTER in the editor triggers evaluation of the expression (like pressing the Calculate button). To insert a line feed, use CTRL+ENTER.
To include one or more images or profiles to the operands list, click the Enter Current button. This is where data of the active data window is added to the calculator's memory and associated with an operator symbol (A, B, C...), so that it can addressed and used in the expression.
When data windows have been entered they appear as a list with one row per window with their filename and associated operator symbol.
The first item on a row is a button showing the “operator symbol” assigned to the window data. To reference a data set in an expression, simply enter the operator symbol of the data set into the expression, or click the button to have it inserted automatically at the cursor position in the expression editor.
The second item on a row is the file name of the image. This is merely a mnemonic.
The third item is a “Refresh” button. If you change the contents of an image window (e.g., by rotating the image) and you wish to use the updated image instead of the stored image in the calculator memory, then press the “Refresh” button to reload the image from the window. If the source window is closed, the “Refresh” button will be deactivated.
The last item is the “Delete” button, which removes the image from the calculator's memory.
By clicking the buttons, the relevant operator text is inserted into the expression at the current cursor position. Clicking Calculate triggers evaluation of the expression in the Expression Editor and calculation.
Expressions are evaluated for each pixel separately, and can contain numerical values, source image references, mathematical operators and functions. Parentheses can be used to group parts of the expression.
The Buttons View shows all the available operators and functions, and the Source Image List shows the currently available images. Neither image references nor function names are case sensitive.
Examples:
Expression |
Result |
min(2*A,B)
|
For each pixel, the minimum of 2 times the corresponding pixel in source image A, and the corresponding pixel in source image B. |
max(A,200) |
Identical to source image A, except that pixels in A below 200 will be set to 200. |
A^2 |
For each pixel, the square of the corresponding pixel in source image A. |
The result data has physical and pixel dimensions identical to the first source data (typically “A”). For the remaining source data the physical dimensions are ignored; they are assumed to match the first source image. If the pixel dimensions differ, the remaining source data are resampled to match the first source data.
The description text for the result data describes the expression and source data sets used to generate it; this can be viewed in the property dialog of the data window.
The result is shown in a dedicated result image window, and successive evaluations will be shown in the same window. To keep the result of a calculation, you should duplicate the calculation result window before performing the next calculation.