How to create an MLClassify Function raster dataset


Creating an MLClassify Function raster dataset

Do the following steps to create an MLClassify Function raster dataset:
  1. Create the MLClassify Function object.
  2. Create the MLClassify Function Arguments object.
  3. Set the properties for the function arguments.
    1. Specify the input raster.
    2. Specify the input signature file. 
  4. Create a Raster Function object.
  5. Create a Function Raster dataset object.
  6. Initialize the new Function raster dataset with the raster function and its arguments.
The following code example shows how to create an MLClassify Function raster dataset by classifying a multiband raster using a signature file.
[C#]
//Define MLClassifyFunction and Arguments objects.
MLClassifyFunction mlClassify = new MLClassifyFunctionClass();
IMLClassifyFunctionArguments mlClassifyArgs = new MLClassifyFunctionArgumentsClass()
    as IMLClassifyFunctionArguments;

//Open a raster dataset and the specify input raster and signature file.
mlClassifyArgs.Raster = inRasterDataset01;
string sSigPathName = "c:\\data\\tm321.gsg";
mlClassifyArgs.SignatureFile = sSigPathName;

//Define and initialize a Function raster dataset using the MLClassify function.
IFunctionRasterDataset mlDataset = new FunctionRasterDataset();
mlDataset.Init(mlClassify, mlClassifyArgs);
[VB.NET]
'Define MLClassifyFunction and Arguments objects.
Dim mlClassify As MLClassifyFunction
Dim mlClassifyArgs As IMLClassifyFunctionArguments
mlClassify = New MLClassifyFunction
mlClassifyArgs = New MLClassifyFunctionArguments

'Open a raster dataset and specify the input raster and signature file.
mlClassifyArgs.Raster = inRasterDataset01
Dim sSigPathName As String
sSigPathName = "c:\data\tm321.gsg"
mlClassifyArgs.SignatureFile = sSigPathName

'Define and initialize a Function raster dataset using the MLClassify function.
Dim mlDataset As IFunctionRasterDataset
mlDataset = New FunctionRasterDataset
mlDataset.Init(mlClassify, mlClassifyArgs)


See Also:

How to create a Math Function raster dataset
How to create a Local Function raster dataset
Sample: Create a Function raster dataset
How to save a Function raster dataset into a raster dataset
How to access a raster dataset




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS for Desktop Advanced: Spatial Analyst ArcGIS for Desktop Advanced: Spatial Analyst
ArcGIS for Desktop Standard: Spatial Analyst ArcGIS for Desktop Standard: Spatial Analyst
ArcGIS for Desktop Basic: Spatial Analyst ArcGIS for Desktop Basic: Spatial Analyst