Image Expression
This action allows you to specify an image analytically, map channels, combine images etc.
In its simplest form you specify the grid and an expression for a single channel, here named ‘channel’.
The fallback grid is because you don’t have any images defined as input, more on that later. The grid is specified in terms of ‘xmin,xmax,ymin,ymax’ and one or two steps. If you just specify one, the grid space in x and y are the same.
For the channel, the field on the left specify the name of the channel. It has to be non-empty and names can not be repeated. On the right is an analytic expression. This expression is evaluated at each grid point in your image. The variable x and y are defined for each grid point.
The return field is the type of the final grid. All evaluations are done in double precision but at the end the values are changed into either 64 bit (double) or 32 (float/single precision) numbers or non-negative 16/8 bit integers.
Map an Image
You can apply a transformation to an image using this action. In the gear menu for an existing image, select the ‘Image Computation’ action.
This will create this object and automatically set up a local variable that selects the original image.
This hides the ‘Fallback grid’ option that was next to the return type menu. The grid from the input image is used to define the grid.
What this does is to add the channel name as a local variable that can be used in an expression. When you use this in expressions. Just like the x and y variables that are defined, this varies for each element.
Build up expressions
The local variables are the variables above the dividing line. You can add additional variables by using the + button.
This variable has to have a specified name. You can specify a constant like 4, but you can also specify an expression, as long as it only includes entries that have been defined up to that point in the local variable list. The variables x and y are defined implicitly, and the first local variable defines the channel variable.
Note that it might be tempting to use one of the output channel names in an expression, but it is not valid.
Groups
You can import variables from groups. For example if you want to use the same parameter values in several object and don’t want to have to change them in all of them each time. Create a Group object and then drag that onto the plus button or select the ‘Add Group’ entry from the pop-up menu that shows up when you click on the + button. This imports all of the constants that are defined in the group. Note how the N variable is used in the grid definition. The grid definition is evaluated after all of the local variables have been defined.
Mask
You can use mask variables in expressions. Add it to the local variables, specify a name and then use in expression. The on values are 1 and the off values are 0, but are treated just like a channel. The if function takes three variables, first is the value that is checked if it is non-zero or not, the second is what is used if the first value is non-zero and the third when it is zero.
Prefix
There is an action that subtracts two images from one another. It requires the channel names and order to be the same. This is what you should use for this situation, since it is a lot simpler than using the expression mechanism, but to show the use of the prefixes, here is a simple example that replicates the subtract functionality. When you specify a prefix the name becomes prefix.Name. This also applies when you have a group variable.