ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Compute Segment Attributes

Available with Spatial Analyst license.

  • Summary
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Compute a set of attributes associated with your segmented image. The input raster can be a single-band or 3-band, 8-bit segmented image.

Usage

  • This tool generates the attributes for each segment that exists in the image. Attributes include mean, standard deviation, segment size, converged color (from the Segment Mean Shift tool), and compactness.

  • This parameter is only enabled if the Segmented key property is set to true on the input raster. If the only input into the tool is a segmented image, the default attributes are COLOR, COUNT, COMPACTNESS, and RECTANGULARITY. If an Additional Input Raster is also included as an input along with a segmented image, then MEAN and STD are available as options.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Syntax

ComputeSegmentAttributes (in_segmented_raster, {in_additional_raster}, {used_attributes})
ParameterExplanationData Type
in_segmented_raster

The input segmented raster dataset, where all the pixels belonging to a segment have the same converged RGB color. Usually, it is an 8-bit, 3-band RGB raster, but it can also be a 1-band grayscale raster.

Once the tool completes, the key property is set to Segmented.

Segmented Raster | Raster dataset | Mosaic Dataset | Raster Layer | Mosaic Layer | Image Service Layer
in_additional_raster
(Optional)

Optionally incorporate ancillary raster datasets, such as a segmented image, a multispectral image, or a DEM, to generate attributes and other required information for the classifier. The raster datasets for this parameter must match those used to create the training .ecd file.

Segmented Raster | Raster Dataset | Mosaic Dataset | Raster Layer | Mosaic Layer | Image Service Layer
used_attributes
[used_attributes,...]
(Optional)

Specify the attributes to be included in the attribute table associated with the output raster.

This parameter is only enabled if the SEGMENTED key property is set to true on the input raster. If the only input into the tool is a segmented image, the default attributes are COLOR, COUNT, COMPACTNESS, and RECTANGULARITY. If an in_additional_raster is also included as an input along with a segmented image, then MEAN and STD are available as options.

  • COLOR —The average chromaticity color, on a per-segment basis.
  • MEAN —The average digital number (DN), derived from the optional pixel image, on a per-segment basis.
  • STD —The standard deviation, derived from the optional pixel image, on a per-segment basis.
  • COUNT —The number of pixels comprising the segment, on a per-segment basis.
  • COMPACTNESS —The degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, where 1 is a circle.
  • RECTANGULARITY —The degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, where 1 is a rectangle.
String

Return Value

NameExplanationData Type
out_index_raster_dataset

The output segment index raster, where the attributes for each segment are recorded in the associated attribute table.

Raster

Code Sample

ComputeSegmentAttributes example 1 (Python window)

This example computes segment attributes for a TIFF raster.

import arcpy
from arcpy.sa import *

compute_att = ComputeSegmentAttributes(
                  "c:/test/moncton_seg.tif", "c:/test/moncton.tif", 
                  "COLOR;MEAN;STD;COUNT;COMPACTNESS;RECTANGULARITY")

compute_att.save("c:/test/moncton_computeseg.tif")
ComputeSegmentAttributes example 2 (stand-alone script)

This example computes segment attributes for a TIFF raster.

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


# Set local variables
inSegRaster = "c:/test/moncton_seg.tif"
in_additional_raster = "c:/test/moncton.tif"
attributes = "COLOR;MEAN;STD;COUNT;COMPACTNESS;RECTANGULARITY"

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

# Execute 
compute_att = ComputeSegmentAttributes(inSegRaster, in_additional_raster, 
                                       attributes)
#save output 
compute_att.save("c:/test/moncton_computeseg.tif")

Environments

  • Auto Commit
  • Cell Size
  • Compression
  • Current Workspace
  • Extent
  • Geographic Transformations
  • Mask
  • Output CONFIG Keyword
  • Output Coordinate System
  • Raster Statistics
  • Scratch Workspace
  • Snap Raster
  • Tile Size

Licensing Information

  • ArcGIS for Desktop Basic: Requires Spatial Analyst
  • ArcGIS for Desktop Standard: Requires Spatial Analyst
  • ArcGIS for Desktop Advanced: Requires Spatial Analyst

Related Topics

  • An overview of the Segmentation and Classification toolset
  • What is image classification?
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal