Creating an MLClassify Function raster dataset
Do the following steps to create an MLClassify Function raster dataset:
- Create the MLClassify Function object.
- Create the MLClassify Function Arguments object.
- Set the properties for the function arguments.
- Specify the input raster.
- Specify the input signature file.
- Create a Raster Function object.
- Create a Function Raster dataset object.
- 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 datasetHow to create a Local Function raster dataset
How to save a Function raster dataset into a raster dataset
How to access a raster dataset
Samples:
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 |