Generate Exclude Area (Data Management)

Summary

Masks pixels based on their color or by clipping a range of values. The output of this tool is used as an input to the Color Balance Mosaic Dataset tool to eliminate areas such as clouds and water that can skew the statistics used to color balance multiple images.

Usage

  • This tool is used to exclude areas that will be difficult to color correct, such as water, clouds, and anomalous areas.

  • The output of this tool can be used in the Color Balance Mosaic Dataset tool to exclude pixels (and colors) from the algorithm used to color correct the mosaic dataset.

Syntax

arcpy.management.GenerateExcludeArea(in_raster, out_raster, pixel_type, generate_method, {max_red}, {max_green}, {max_blue}, {max_white}, {max_black}, {max_magenta}, {max_cyan}, {max_yellow}, {percentage_low}, {percentage_high})
ParameterExplanationData Type
in_raster

The raster or mosaic dataset layer that you want to mask.

Mosaic Dataset; Raster Dataset; Raster Layer
out_raster

The name, location and format for the dataset you are creating. When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. When storing your raster dataset to a JPEG file, a JPEG 2000 file, or a geodatabase, you can specify a Compression type and Compression Quality within the Environment Settings.

Raster Dataset
pixel_type

Choose the pixel depth of your input raster dataset. 8-bit is the default value; however, raster datasets with a greater bit-depth will need to have the color mask and histogram values scaled accordingly.

  • 8_BITThe input raster dataset has values from 0 to 255. This is the default.
  • 11_BITThe input raster dataset has values from 0 to 2047.
  • 12_BITThe input raster dataset has values from 0 to 4095.
  • 16_BITThe input raster dataset has values from 0 to 65535.
String
generate_method

Create your mask based on the color of the pixels or by clipping high and low values.

  • COLOR_MASKSet the maximum color values to include in the output. This is the default.
  • HISTOGRAM_PERCENTAGERemove a percentage of high and low pixel values.
String
max_red
(Optional)

The maximum red value to exclude. The default is 255.

Double
max_green
(Optional)

The maximum green value to exclude. The default is 255.

Double
max_blue
(Optional)

The maximum blue value to exclude. The default is 255.

Double
max_white
(Optional)

The maximum white value to exclude. The default is 255.

Double
max_black
(Optional)

The maximum black value to exclude. The default is 0.

Double
max_magenta
(Optional)

The maximum magenta value to exclude. The default is 255.

Double
max_cyan
(Optional)

The maximum cyan value to exclude. The default is 255.

Double
max_yellow
(Optional)

The maximum yellow value to exclude. The default is 255.

Double
percentage_low
(Optional)

Exclude this percentage of the lowest pixel values. The default is 0.

Double
percentage_high
(Optional)

Exclude this percentage of the highest pixel values. The default is 100.

Double

Code sample

GenerateExcludeArea example 1 (Python window)

This is a Python sample for GenerateExcludeArea.

import arcpy
arcpy.GenerateExcludeArea_management("C:/workspace/fgdb.gdb/mosdata",
                               "C:/workspace/excludeArea.tif","8_BIT",
                               "COLOR_MASK","255","255","255","255","15",
                               "255","255","255","0","100")
GenerateExcludeArea example 2 (stand-alone script)

This is a Python script sample for GenerateExcludeArea.

##===========================
##Generate Exclude Area
##Usage: GenerateExcludeArea_management in_raster out_raster 8_BIT | 11_BIT | 
##                                      12_BIT | 16_BIT COLOR_MASK | HISTOGRAM_PERCENTAGE
##                                      {max_red} {max_green} {max_blue} {max_white} 
##                                      {max_black} {max_magenta} {max_cyan}
##                                      {max_yellow} {percentage_low} {percentage_high}

import arcpy
arcpy.env.workspace = "c:/workspace"

# Generate exclude area dataset from raster dataset with Histogram
arcpy.GenerateExcludeArea_management("srcimage.tif", "exarea.tif", "8_BIT",
                                     "HISTOGRAM_PERCENTAGE", "", "", "", "",
                                     "", "", "", "", "10", "100")                                      

# Generate exclude area dataset from mosaic dataset with Color Mask
arcpy.GenerateExcludeArea_management("CC.gdb/srcmd", "exarea.tif", "8_BIT",
                                     "COLOR_MASK", "255", "200", "50", "255",
                                     "10", "210", "100", "255", "", "")

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics