Train ISO Cluster Classifier (Spatial Analyst)

Available with Spatial Analyst license.

Available with Image Analyst license.

Summary

Generates an Esri classifier definition file (.ecd) using the Iso Cluster classification definition.

This tool performs an unsupervised classification.

Usage

  • Any Esri-supported raster is accepted as input, including raster products, segmented raster, mosaics, image services, or generic raster datasets. Segmented rasters must be 8-bit rasters with 3-bands.

  • The Segment Attributes parameter is only active if one of the raster layer inputs is a segmented image.

Parameters

LabelExplanationData Type
Input Raster

The raster dataset to classify.

Raster Layer; Mosaic Layer; Image Service; String
Max Number Of Classes / Clusters

Maximum number of desired classes to group pixels or segments. This should be set to be greater than the number of classes in your legend.

It is possible that you will get fewer classes than what you specified for this parameter. If you need more, increase this value and aggregate classes after the training process is complete.

Long
Output Classifier Definition File

The output JSON format file that will contain attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file will be created.

File
Additional Input Raster
(Optional)

Ancillary raster datasets, such as a multispectral image or a DEM, will be incorporated to generate attributes and other required information for classification. This parameter is optional.

Raster Layer; Mosaic Layer; Image Service; String
Maximum Number Of Iterations
(Optional)

The maximum number of iterations the clustering process will run.

The recommended range is between 10 and 20 iterations. Increasing this value will linearly increase the processing time.

Long
Minimum Number of Samples Per Cluster
(Optional)

The minimum number of pixels or segments in a valid cluster or class.

The default value of 20 is effective in creating statistically significant classes. You can increase this number for more larger clusters and less slivers; however, it may limit the overall number of classes that are created.

Long
Skip Factor
(Optional)

Number of pixels to skip for a pixel image input. If a segmented image is an input, specify the number of segments to skip.

Long
Segment Attributes Used
(Optional)

Specifies the attributes that will be included in the attribute table associated with the output raster.

This parameter is only active if the Segmented key property is set to true on the input raster. If the only input to the tool is a segmented image, the default attributes are Converged color, Count of pixels, Compactness, and Rectangularity. If an Additional Input Raster value is included as an input with a segmented image, Mean digital number and Standard deviation are also available attributes.

  • Converged colorThe RGB color values will be derived from the input raster on a per-segment basis. This is also known as average chromaticity color.
  • Mean digital numberThe average digital number (DN) will be derived from the optional pixel image on a per-segment basis.
  • Standard deviationThe standard deviation will be derived from the optional pixel image on a per-segment basis.
  • Count of pixelsThe number of pixels composing the segment, on a per-segment basis.
  • CompactnessThe degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, in which 1 is a circle.
  • RectangularityThe degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, in which 1 is a rectangle.
String
Maximum Number Of Cluster Merges per Iteration
(Optional)

The maximum number of cluster merges per iteration. Increasing the number of merges will reduce the number of classes that are created. A lower value will result in more classes.

Long
Maximum Merge Distance
(Optional)

The maximum distance between cluster centers in feature space. Increasing the distance will allow more clusters to merge, resulting in fewer classes. A lower value will result in more classes. Values from 0 to 5 typically return the best results.

Double

TrainIsoClusterClassifier(in_raster, max_classes, out_classifier_definition, {in_additional_raster}, {max_iterations}, {min_samples_per_cluster}, {skip_factor}, {used_attributes}, {max_merge_per_iter}, {max_merge_distance})
NameExplanationData Type
in_raster

The raster dataset to classify.

Raster Layer; Mosaic Layer; Image Service; String
max_classes

Maximum number of desired classes to group pixels or segments. This should be set to be greater than the number of classes in your legend.

It is possible that you will get fewer classes than what you specified for this parameter. If you need more, increase this value and aggregate classes after the training process is complete.

Long
out_classifier_definition

The output JSON format file that will contain attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file will be created.

File
in_additional_raster
(Optional)

Ancillary raster datasets, such as a multispectral image or a DEM, will be incorporated to generate attributes and other required information for classification. This parameter is optional.

Raster Layer; Mosaic Layer; Image Service; String
max_iterations
(Optional)

The maximum number of iterations the clustering process will run.

The recommended range is between 10 and 20 iterations. Increasing this value will linearly increase the processing time.

Long
min_samples_per_cluster
(Optional)

The minimum number of pixels or segments in a valid cluster or class.

The default value of 20 is effective in creating statistically significant classes. You can increase this number for more larger clusters and less slivers; however, it may limit the overall number of classes that are created.

Long
skip_factor
(Optional)

Number of pixels to skip for a pixel image input. If a segmented image is an input, specify the number of segments to skip.

Long
used_attributes
[used_attributes;used_attributes,...]
(Optional)

Specifies the attributes that will be included in the attribute table associated with the output raster.

  • COLORThe RGB color values will be derived from the input raster on a per-segment basis. This is also known as average chromaticity color.
  • MEANThe average digital number (DN) will be derived from the optional pixel image on a per-segment basis.
  • STDThe standard deviation will be derived from the optional pixel image on a per-segment basis.
  • COUNTThe number of pixels composing the segment, on a per-segment basis.
  • COMPACTNESSThe degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, in which 1 is a circle.
  • RECTANGULARITYThe degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, in which 1 is a rectangle.

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

String
max_merge_per_iter
(Optional)

The maximum number of cluster merges per iteration. Increasing the number of merges will reduce the number of classes that are created. A lower value will result in more classes.

Long
max_merge_distance
(Optional)

The maximum distance between cluster centers in feature space. Increasing the distance will allow more clusters to merge, resulting in fewer classes. A lower value will result in more classes. Values from 0 to 5 typically return the best results.

Double

Code sample

TrainIsoClusterClassifier example 1 (Python window)

The following Python window script uses the ISO Cluster classifier to create an unsupervised Esri classification definition file with a maximum of ten classes.

import arcpy
from arcpy.sa import *

TrainIsoClusterClassifier("c:/test/moncton_seg.tif", "10", 
                "c:/output/moncton_sig_iso.ecd","c:/test/moncton.tif", 
                "5", "10", "2", "COLOR;MEAN;STD;COUNT;COMPACTNESS;RECTANGULARITY")
TrainIsoClusterClassifier example 2 (stand-alone script)

This script example uses the ISO Cluster classifier to create an unsupervised Esri classification definition file with a maximum of ten classes.

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


# Set local variables
inSegRaster = "c:/test/moncton_seg.tif"
maxNumClasses = "10"
out_definition = "c:/output/moncton_sig_iso.ecd"
in_additional_raster = "moncton.tif"
maxIteration = "20"
minNumSamples = "10"
skipFactor = "5"
attributes = "COLOR;MEAN;STD;COUNT;COMPACTNESS;RECTANGULARITY"

# Execute 
TrainIsoClusterClassifier(inSegRaster, maxNumClasses, out_definition,
                          in_additional_raster, maxIteration, 
                          minNumSamples, skipFactor, attributes)

Licensing information

  • Basic: Requires Spatial Analyst or Image Analyst
  • Standard: Requires Spatial Analyst or Image Analyst
  • Advanced: Requires Spatial Analyst or Image Analyst

Related topics