public IFunctionRasterDataset calcRandomForestFunction(object inRaster, Statistics.dataPrepRandomForest rf) { IFunctionRasterDataset rRst = createIdentityRaster(inRaster); string tempAr = funcDir + "\\" + FuncCnt + ".afr"; IFunctionRasterDataset frDset = new FunctionRasterDatasetClass(); IFunctionRasterDatasetName frDsetName = new FunctionRasterDatasetNameClass(); frDsetName.FullName = tempAr; frDset.FullName = (IName)frDsetName; IRasterFunction rsFunc = new FunctionRasters.randomForestDataset(); FunctionRasters.randomForestArguments args = new FunctionRasters.randomForestArguments(this); args.InRasterCoefficients = rRst; args.RandomForestModel = rf; frDset.Init(rsFunc, args); IRasterInfo2 rsInfo2 = (IRasterInfo2)frDset.RasterInfo; IRasterStatistics rsStats = new RasterStatisticsClass(); rsStats.Mean = 0.5; rsStats.Maximum = 1; rsStats.Minimum = 0; rsStats.StandardDeviation = 0.25; rsStats.SkipFactorX = 1; rsStats.SkipFactorY = 1; rsStats.IsValid = true; if (rf.Regression) { double pMin = rf.computNew(rf.minValues)[0]; double pMax = rf.computNew(rf.MaxValues)[0]; double pMean = (pMax-pMin)/2; rsStats.Maximum = rf.maxValues[0]; rsStats.Minimum = rf.minValues[0]; rsStats.Mean = pMean; rsStats.StandardDeviation = pMean * 0.5; } for (int i = 0; i < rsInfo2.BandCount; i++) { rsInfo2.set_Statistics(i, rsStats); } return frDset; }