Bitwise Not (Spatial Analyst)

Summary

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

Learn more about how Bitwise Math tools work

Illustration

Bitwise Not illustration
OutRas = BitwiseNot(InRas1)

Usage

Syntax

BitwiseNot (in_raster_or_constant)
ParameterExplanationData Type
in_raster_or_constant

The input raster on which to perform the Bitwise Not (complement) operation.

A number can be used as an input for this parameter, provided a raster is specified for the other parameter. To be able to specify a number for both inputs, the cell size and extent must first be set in the environment.

Raster Layer | Constant

Return Value

NameExplanationData Type
out_raster

The output raster.

The cell values are the result of a Bitwise Not operation on the input.

Raster

Code Sample

BitwiseNot example 1 (Python window)

This example performs a Bitwise Not operation on an input GRID raster.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outBitwiseNot = BitwiseNot("degs")
outBitwiseNot.save("C:/sapyexamples/output/outbitn")
BitwiseNot example 2 (stand-alone script)

This example performs a Bitwise Not operation on an input GRID raster.

# Name: BitwiseNot_Ex_02.py
# Description: Performs a Bitwise Complement operation on the
#              binary value of an input raster
# Requirements: Spatial Analyst Extension
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster = "degs"

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute BitwiseNot
outBitwiseNot = BitwiseNot(inRaster)

# Save the output 
outBitwiseNot.save("C:/sapyexamples/output/outbitnot")

Environments

Related Topics

Licensing Information

ArcView: Requires Spatial Analyst
ArcEditor: Requires Spatial Analyst
ArcInfo: Requires Spatial Analyst

6/29/2011