Image Calculator: OR

From MIPAV
Revision as of 18:06, 15 February 2012 by Angelfish100 (Talk)

Jump to: navigation, search

OR

If the pixel value from a chosen pixel in Image A equals zero, then the result pixel value is set equal to the corresponding Image B pixel value. Otherwise, the result pixel value is the same as for the Image A (i.e. stays unchanged).

Result=Image B, if Image A=0;
otherwise, Result=Image A.
Figure 31. OR(Image A; Image B)

AndImageA.jpg

AndImageB.jpg

ORImageAImageB.jpg

Image A
Image B
(Image A OR Image B)

XOR

It overlays two images together, but then clears the area that is overlapped back to transparency. If both Image A and Image B pixel values are nonzero, then the result image is set to zero. If both Image A and Image B pixel values are zero, then the result image remains zero. If only one of Image A and Image B is nonzero, then the result retains or assumes the nonzero value.

Figure 252. XOR(Image A; Image B)


{| align="center"

AndImageA.jpg



|


{| align="center"

| XORImageB.jpg

|}

|


{| align="center"

| XORIMageAImageB.jpg

|}

|- |

Image A

|

Image B

|

(Image A XOR Image B)

|}


Subtract

Subtracts the pixel values of Image B from the corresponding pixel values of Image A.

Figure 253. Subtract(Image A; Image B)


{| align="center"

AndImageA.jpg



|


{| align="center"

| XORImageB.jpg

|}

|


{| align="center"

| SubtractImageBImageA.jpg

|}

|- |

Image A

|

Image B

|

Image A-Image B

|}

1.2

Advanced math options

Abs

Generates the absolute value of the active image or selection.

Exp

Applies the function f(p) = exp(p) to each pixel (p) in the image or selection. For RGB images, this function is applied to all three color channels.

Ln

Applies the function f(p) = ln(p) to each pixel (p) of the image or selection. For RGB images, this function is applied to all three color channels.

Log

Applies the function f(p) = log(p) to each pixel (p) in the image or selection. For RGB images, this function is applied to all three color channels.

Pow

The function pow (x,y) produces a value of x raised to the power of y, e.g., pow(2,3) gives 8. For RGB images, this function is applied to all three color channels. In clip mode, for RGB images with byte values, results greater than 255 are set to 255. In promote destination image mode, the image will be promoted to ARGB_USHORT and capable of storing color values of up to 65535.

Sin, cos, tan

Apply the functions sin(p), cos(p), and tan(p) to each pixel (p) of the image or selection. For RGB images, the chosen function is applied to all three color channels.

Figure 254. Image A after applying f(p)=pow(Image A;3). The function was applied for all three color channels. The result values greater than 255, as for the B channel, were set to 255


{| align="center"

AndImageA.jpg



|


{| align="center"

| ImageAPow3.jpg

|}

|- |

Image A

|

f(p)=pow(Image A;3)

|}


Applying the Image Calculator to images

To run this algorithm, complete the following steps:

1 Open at least two images. The images must have the same dimensions.
2 Select Utilities >Image Calculator. The dialog box opens. See [MIPAV_Utilities.html#1206525 Figure 255].
3 Use the Operator list box to select the math operator (Add, AND, Average, etc.).
4 Use the Image B list box to select Image B.
5 Check the Clip option if you want to clamp result data to the bounds of the input image type. Check the Promote option to promote image type so that the range of the result fits into the new image type. Refer to [MIPAV_Utilities.html#1176469 "clip mode" on page 438] and [MIPAV_Utilities.html#1176475 "promotion mode" on page 438].
6 Click OK. The algorithm begins to run.
7 Depending on whether you selected New Image or Replace Image A, the result appears in a new window or replaces the image to which the algorithm was applied.


Image A
Image A.

{| align="center"

ImageCalculatorDB.jpg



Â
Â
Â
Â
Â
Â
Â
Â
Â

|- |

Operator

|

Select the math operator from the list.

|- |

Image B

|

Select Image B from the list.

|- |

Clip

|

Select this option if you want the result image to be clamped at the maximum (minimum) value of Image A data type.
See also [MIPAV_Utilities.html#1176469 "clip mode" on page 438].

|- |

Promote destination image type

| rowspan="1" colspan="2" |

When this mode is selected and the result value is out of the legal range of Image A 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 [MIPAV_Utilities.html#1176475 "promotion mode" on page 438].

|- | rowspan="1" colspan="3" |

Destination

|- |

New image

| rowspan="1" colspan="2" |

The result image will open in a new image frame.

|- |

Replace image

| rowspan="1" colspan="2" |

The result image will replace Image A.

|- |

OK

| rowspan="1" colspan="2" |

Applies the algorithm according to the specifications in this dialog box.

|- |

Advanced

| rowspan="1" colspan="2" |

Calls the Enter Advanced Operator dialog box.

|- |

Cancel

| rowspan="1" colspan="2" |

Disregards any changes that you made in this dialog box and closes it.

|- |

Help

| rowspan="1" colspan="2" |

Displays online help for this dialog box.

|- | rowspan="1" colspan="3" |

Figure 255. The Image Calculator dialog box options

|}