Image Arithmetic calculates an output data set from one or two input data sets using one of several arithmetic operations. The inputs may be any combination of windows or files.
To create the result, select the operation, the coefficients, and whether or not to force values less than zero to zero. Then select the file or files on which to operate and the region of the file to process (these controls are the same as other region processing applications; see the region processing interface documentation for more information). When the parameters have been set, press DoIt to generate the result.
Image Arithmetic performs its internal calculations in floating-point arithmetic, but by default, the output is converted to the same data type as the first input file. In several cases, this may not be what you want and you should explicitly set the output type with the Mode control.
Overview | Region processing | Operators | Coefficients | Clamping to zero | Command line
There a fixed set of operations that Image Arithmetic can apply. The operations are applied independently to each pixel in the selected region. In terms of the two coefficients, A and B, the pixel value in file 1, X, and the pixel value in file 2, the available operations are:
Abs in the sixth operation takes the absolute value of a real quantity and the magnitude of a complex quantity. Conj in the fifth and seventh operations returns the complex conjugate of its argument.
All the calculations are done in floating-point arithmetic. When an operation produces a complex result but the output file does not use a complex data type, the imaginary part of the result is discarded and only the real part is stored.
Overview | Region processing | Operators | Coefficients | Clamping to zero | Command line
Image Arithmetic's operators use two coefficients. Coefficient A is substituted for A in the operator expressions; in general, it is applied to values from the first file. Coefficient B is substituted for B in the operator expressions; in general, it is applied to values from the second file.
Overview | Region processing | Operators | Coefficients | Clamping to zero | Command line
Set this toggle on if you want values less than zero from the arithmetic operation to be set to zero in the output (clamping). Clamping is only performed if the output is stored in a pure real format (byte, short, float, ushort, or long); if the output is complex, no clamping is done. When clamping is used with an operation that generates a complex value and the output data set is real, the clamping is only applied to the real component of the intermediate value (the imaginary component is discarded).
Overview | Region processing | Operators | Coefficients | Clamping to zero | Command line
Image Arithmetic accepts the command-line arguments described in Region.html. In addition, Image Arithmetic has the following options (optional parts are shown in brackets):
-a=real_part[:imaginary_part]
-a is not specified, one
is substituted for the value of A.
-b=real_part[:imaginary_part]
-b is not specified, one
is substituted for the value of B.
-clamp
-operator=operator_name
a1+b2 is the
default if -operator does not appear on the command line.
a1+b2a1-b2a1b2a1/b2a1_conj_b2abs_a1conj_a1a1+ba1ba/b2As an example, the command line below computes the ratio of the second wavelength to the first wavelength in window 1 and writes the result to window 2:
ImgArith 1 1 2 -w1=1 -w2=0 -operator=a1/b2 -mode=float
Overview | Region processing | Operators | Coefficients | Clamping to zero | Command line