# Image Math

Algorithm that adds, subtracts, multiplies, or divides an image by some user specified value. In addition, the square root, absolute value, or log of an image can be calculated. If the new image exceeds the range that can be stored in an image of that type, the data is either clipped and stored in the original image or a new image of a type (int, float...) that can store the range of new data is generated.

## Image types

You can apply Image Calculator to all 2D and 3D grayscale images. And here is the difference between Image Math and Image Calculator (refer to "Image Calculator"). The last one you can ally to all types of images 2D, 3D, 4D color and grayscale.

## Applying the Image Math to images

To run this algorithm, complete the following steps: 1 Open an image of interest.
2 Select Utilities >Image Math. The dialog box opens. See Figure 39.
3 Use the Operator list box to select the math operator (Absolute value, Add, Average, etc.).
4 Use the Value text box to enter a numerical value.
5 Select the Clip option if you want to clamp result data to the bounds of the input image type. Select the Promote option to promote image type so that the range of the result fits into the new image type. Select the Convert to Float option to convert the result into float image type.
6 Click OK. The algorithm begins to run.
7 Depending on whether you selected New Image or Replace Image, the result appears in a new window or replaces the image to which the algorithm was applied. See also Figure 39.

 Value Enter the numerical value here. Note that the text box become available after you select the math operator. Operator Select the math operator from the list. Clip Select this option if you want the result image to be clamped at the maximum (minimum) value of the original image data type. See also "clip mode". Promote image type When this mode is selected and the result value is out of the legal range of the original image data type, then the result image type is promoted to a new data type with a data type range capable of expressing the minimum and maximum values. See also "promotion mode". Convert to float When this mode is selected and the result value is out of the legal range of the original image data type, then the result image type is converted to float data type. Destination New image The result image will open in a new image frame. Replace image The result image will replace the original image. Process Whole image The algorithm applies to the selected VOI(s) region. VOI region The algorithm applies to the whole image. OK Applies the algorithm according to the specifications in this dialog box. Advanced Calls the Enter Advanced Operator dialog box. Cancel Disregards any changes that you made in this dialog box and closes it. Help Displays online help for this dialog box.

#### Examples of using Image Math

 Absolute value Add 100 Average Constant Divide by 100 Log Multiply by 5 Square Square root Subtract 5 Sum