public static IRasterFunctionTemplate CreateNDVICustomTemplate(string bandIndices)
{
#region Setup Raster Function Vars
IRasterFunctionVariable watermarkRasterRFV = new RasterFunctionVariableClass();
watermarkRasterRFV.Name = "Raster";
watermarkRasterRFV.IsDataset = true;
IRasterFunctionVariable bandIndicesRFV = new RasterFunctionVariableClass();
bandIndicesRFV.Name = "BandIndices";
bandIndicesRFV.Value = bandIndices;
bandIndicesRFV.IsDataset = false;
#endregion
#region Setup Raster Function Template
// Create the NDVI Custom Function Arguments object
IRasterFunctionArguments rasterFunctionArguments = new CustomFunction.NDVICustomFunctionArguments();
// Set the Band Indices
rasterFunctionArguments.PutValue("BandIndices", bandIndicesRFV);
// Set the Raster Dataset as the input raster
rasterFunctionArguments.PutValue("Raster", watermarkRasterRFV);
// Create the NDVI Custom Function
IRasterFunction ndviCustomFunction = new CustomFunction.NDVICustomFunction();
IRasterFunctionTemplate ndviCustomFunctionTemplate = new RasterFunctionTemplateClass();
ndviCustomFunctionTemplate.Function = ndviCustomFunction;
ndviCustomFunctionTemplate.Arguments = rasterFunctionArguments;
#endregion
return(ndviCustomFunctionTemplate);
}