An overview of the Logical Math toolset in Image Analyst

Available with Spatial Analyst license.

The Logical Math tools evaluate the values of the inputs and determine the output values based on a defined logic. The tools are grouped into four main categories: Bitwise, Boolean, Combinatorial, Logical, and Relational.

The following is a list of all the tools within each grouping:

  • Bitwise:

    Bitwise And, Bitwise Left Shift, Bitwise Not, Bitwise Or, Bitwise Right Shift, Bitwise XOr

  • Boolean:

    Boolean And, Boolean Or, Boolean XOr, Boolean Not

  • Combinatorial:

    Combinatorial And, Combinatorial Or, Combinatorial XOr

  • Relational:

    Equal To, Not Equal, Greater Than, Greater Than Equal, Less Than, Less Than Equal

  • Logical:

    Diff, InList, Is Null, Over, Test

Boolean logic generally applies a binary condition to the inputs and evaluates to a binary condition for the output. The binary condition can be expressed in several ways: "1" and "0", "True" and "False", "yes" and "no", "on" and "off", and so forth. In the Logical Math tools, the False condition is represented with a value of 0, and the True condition as any value other than 0.

The bitwise tools compute on the binary representation of the input values. The Boolean tools evaluate the inputs only as True or False conditions and return the result of the particular tool as a 1 or 0 (True or False) Boolean value. The Combinatorial tools identify unique combinations of input values based on the logic of the particular tool and return a different value for each unique combination. The Relational tools compare the values of one input relative to another and return the result of the particular tool as 1 or 0 Boolean value. The Logical tools have different ways to apply Boolean logic, such as identifying only the input cells that are NoData, or using a logical expression that you define to determine which cells are evaluated as true.

The following tables list the available Logical Math tools by category and provide a description of each:

Bitwise evaluation

These tools are intended to work on integer input data. If floating-point values are input, the data values will automatically be truncated and converted to integer values. As a result, the output data type is always integer. Any bitwise operation on an input NoData cell will result in a NoData cell in the output.

ToolDescription

Bitwise And

Performs a Bitwise And operation on the binary values of two input rasters.

Bitwise Left Shift

Performs a Bitwise Left Shift operation on the binary values of two input rasters.

Bitwise Not

Performs a Bitwise Not (complement) operation on the binary value of an input raster.

Bitwise Or

Performs a Bitwise Or operation on the binary values of two input rasters.

Bitwise Right Shift

Performs a Bitwise Right Shift operation on the binary values of two input rasters.

Bitwise XOr

Performs a Bitwise eXclusive Or operation on the binary values of two input rasters.

Tools of the Bitwise Math tools

Boolean evaluation

ToolDescription

Boolean And

Performs a Boolean And operation on the cell values of two input rasters.

If both input values are true (non-zero), the output value is 1. If one or both inputs are false (zero), the output is 0.

Boolean Not

Performs a Boolean Not (complement) operation on the cell values of the input raster.

If the input values are true (non-zero), the output value is 0. If the input values are false (zero), the output is 1.

Boolean Or

Performs a Boolean Or operation on the cell values of two input rasters.

If one or both input values are true (non-zero), the output value is 1. If both input values are false (zero), the output is 0.

Boolean XOr

Performs a Boolean eXclusive Or operation on the cell values of two input rasters.

If one input value is true (non-zero) and the other false (zero), the output is 1. If both input values are true or both are false, the output is 0.

Boolean math tools

Combinatorial evaluation

ToolDescription

Combinatorial And

Performs a Combinatorial And operation on the cell values of two input rasters.

If both input values are true (non-zero), the output is a different value for each unique combination of input values. If one or both inputs are false (zero), the output value is 0.

Combinatorial Or

Performs a Combinatorial Or operation on the cell values of two input rasters.

If either input value is true (non-zero), the output is a different value for each unique combination of input values. If both inputs are false (zero), the output value is 0.

Combinatorial XOr

Performs a Combinatorial eXclusive Or operation on the cell values of two input rasters.

If one input value is true (non-zero) and the other false (zero), the output is a different value for each unique combination of input values. If both inputs are true or both are false, the output value is 0.

Combinatorial math tools

Relational evaluation

ToolDescription

Equal To

Performs a Relational equal-to operation on two inputs on a cell-by-cell basis.

Returns 1 for cells where the first raster equals the second raster and 0 for cells where it does not.

Greater Than

Performs a Relational greater-than operation on two inputs on a cell-by-cell basis.

Returns 1 for cells where the first raster is greater than the second raster and 0 for cells if it is not.

Greater Than Equal

Performs a Relational greater-than-or-equal-to operation on two inputs on a cell-by-cell basis.

Returns 1 for cells where the first raster is greater than or equal to the second raster and 0 if it is not.

Less Than

Performs a Relational less-than operation on two inputs on a cell-by-cell basis.

Returns 1 for cells where the first raster is less than the second raster and 0 if it is not.

Less Than Equal

Performs a Relational less-than-or-equal-to operation on two inputs on a cell-by-cell basis.

Returns 1 for cells where the first raster is less than or equal to the second raster and 0 where it is not.

Not Equal

Performs a Relational not-equal-to operation on two inputs on a cell-by-cell basis.

Returns 1 for cells where the first raster is not equal to the second raster and 0 for cells where it is equal.

Relational math tools

Logical evaluation

ToolDescription

Diff

Determines which values from the first input are logically different from the values of the second input on a cell-by-cell basis.

If the values on the two inputs are different, the value on the first input is output. If the values on the two inputs are the same, the output is 0.

InList

Determines which values from the first input are contained in a set of other inputs, on a cell-by-cell basis.

For each cell, if the value of the first input raster is found in any of the list of other inputs, that value will be assigned to the output raster. If it is not found, the output cell will be NoData.

Is Null

Determines which values from the input raster are NoData on a cell-by-cell basis.

Returns a value of 1 if the input value is NoData and 0 for cells that are not.

Over

For the cell values in the first input that are not 0, the output value will be that of the first input. Where the cell values are 0, the output will be that of the second input raster.

Test

Performs a Boolean evaluation of the input raster using a logical expression.

When the expression evaluates to true, the output cell value is 1. If the expression is false, the output cell value is 0.

Logical math tools

Related topics