Iso Cluster (Spatial Analyst)
Summary
Uses an isodata clustering algorithm to determine the characteristics of the natural groupings of cells in multidimensional attribute space and stores the results in an output ASCII signature file.
Usage
-
Iso Cluster performs clustering of the multivariate data combined in a list of input bands. The resulting signature file can be used as the input for a classification tool, such as Maximum Likelihood Classification, that produces an unsupervised classification raster.
-
The minimum valid value for the number of classes is two. There is no maximum number of clusters. In general, more clusters require more iterations.
-
To provide the sufficient statistics necessary to generate a signature file for a future classification, each cluster should contain enough cells to accurately represent the cluster. The value entered for the minimum class size should be approximately 10 times larger than the number of layers in the input raster bands.
-
The value entered for the sample interval indicates one cell out of every n-by-n block of cells is used in the cluster calculations.
-
You shouldn't merge or remove classes or change any of the statistics of the ASCII signature file.
-
Generally, the more cells contained in the extent of the intersection of the input bands, the larger the values for minimum class size and sample interval should be specified. Values entered for the sample interval should be small enough that the smallest desirable categories existing in the input data will be appropriately sampled.
-
If the input is a layer created from a multiband raster with more than three bands, the operation will consider all the bands associated with the source dataset, not just the three bands that were loaded (symbolized) by the layer. If you want to process a subset of the bands in the source dataset, you can use the Make Raster Layer tool to create an input layer containing the desired bands.
-
The class ID values on the output signature file start at one and sequentially increase to the number of input classes. The assignment of the class numbers is arbitrary.
-
Better results will be obtained if all input bands have the same data ranges. If the bands have vastly different data ranges, the data ranges can be transformed to the same range using Map Algebra to perform the equation.
where: Z is the output raster with new data ranges. X is the input raster. oldmin is the minimum value of the input raster. oldmax is the maximum value of the input raster. newmin is the desired minimum value for the output raster. newmax is the desired maximum value for the output raster.
Syntax
Parameter | Explanation | Data Type |
in_raster_bands [in_raster_band,...] |
The input raster bands. | Raster Layer |
out_signature_file |
The output signature file. A .gsg extension must be specified. | File |
number_classes |
Number of classes into which to group the cells. | Long |
number_iterations (Optional) | Number of iterations of the clustering process to run. The default is 20. | Long |
min_class_size (Optional) | Minimum number of cells in a valid class. The default is 20. | Long |
sample_interval (Optional) |
The interval to be used for sampling. The default is 10. | Long |
Code Sample
This example creates a signature file for classifying the input multiband raster into five classes.
import arcpy from arcpy import env from arcpy.sa import * env.workspace = "C:/sapyexamples/data" IsoCluster("redlands", "c:/sapyexamples/output/isosig.gsg", 5, 20, 50, 15)
This example creates a signature file for classifying the input multiband raster into five classes.
# Name: IsoCluster_Ex_02.py # Description: Uses an isodata clustering algorithm to determine the # characteristics of the natural groupings of cells in multidimensional # attribute space and stores the results in an output ASCII signature file. # 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 = "redlands" outSig = "redlndiso.gsg" classes = 5 cycles = 20 minMembers = 50 sampInterval = 15 # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") # Execute IsoCluster IsoCluster(inRaster, outSig, classes, cycles, minMembers, sampInterval)