PreviousNext

Theory of Operation

The arithmetic operations fall into two categories:

  • One-operand - Operates on one input ROI. The one-operand operations are:
  • ABS
  • BINARIZE
  • COPY
  • MASKSHIFT
  • NEGATE
  • NOT
  • PASSRANGE
  • Two-operand - Operates on two input ROIs on single or separate images. Two-operand operations are:
  • ADD
  • AND
  • DIFF
  • MAX
  • MIN
  • MULTIPLY
  • OR
  • SUB
  • XOR

Four types of processing may be applied to the input and/or the output image of the arithmetic operation:

  • Gain - A floating point value, ranging from -255.0 to 255.0, is a multiplier to the gray value of each pixel in the image.
  • Offset - A number, ranging from -255 to 255, is being added to the gray value of each pixel in the image.
  • Sign - An image can be treated as unsigned or signed. For an unsigned image, the pixel values range from 0 to 255. For signed image, the pixel values range from -128 and 127. Converting an unsigned image to a signed image means treating the pixel values higher than 127 in the unsigned image as negative values in the signed image. The negative pixel value can be calculated in the following formula:

128 - [Pixel Value in Unsigned Image] +1

  • Clip - For an unsigned image, some pixel values may become larger than 255 after arithmetic operations or gain and offset processing. The term Clip Overflow describes setting the pixel value to 255 for any pixel where overflow occurs. For a signed image, the term Clip Negative describes setting the pixel value to 0 for any negative pixel value in the image.

ImageArith Tool produces an output image through three processing stages:

  • Pre-processing - Applying any applicable Gain, Offset, Sign, and Clip operations on the input image before the selected arithmetic operation. For all operators of the ImageArith Tool, a Gain and Offset can be applied before the selected arithmetic operation is executed. Gain and Offset processing may cause overflow. When the input image is treated as unsigned, Clip Input Overflow is selectable. When the input image is treated as signed, Clip Input Negative is selectable. Selecting these decide the ImageArith Tool handling of overflow situations.
  • The selected arithmetic operation on the pre-processed input image.
  • Post-processing - Applying any applicable Gain, Offset, Sign, and Clip operations on the arithmetic-operated image. For all operators of the ImageArith Tool, an arithmetic-operated image can be applied to Gain and Offset processing. Gain and Offset processing may cause overflow. When the image is treated as unsigned, Clip Output Overflow is selectable. When the image is treated as signed, Clip Output Negative is selectable. Selecting these decide the ImageArith Tool handling of overflow situations. Arithmetic operators COPY, ADD, SUB, and DIFF allow the input image and the arithmetic-operated image to be treated as signed or unsigned, and provide parameters for Sign and Clip processing.

For all other operators, the input images have to be treated as unsigned. Clip Input Overflow is provided. For these operators, the arithmetic-operated image is also treated as unsigned, but Clip Output Overflow depends on individual operators.

The remainder of the ImageArith section describes the following:


PreviousNext