Esempio n. 1
0
 public void Bind(object pArgument)
 {
     if (pArgument is focalSampleArguments)
     {
         focalSampleArguments args = (focalSampleArguments)pArgument;
         inrs   = args.InRaster;
         orig   = args.OriginalRaster;
         inop   = args.Operation;
         offset = args.OffSets;
         getPlusWidthHeight();
         myFunctionHelper.Bind(inrs);
         myFunctionHelperOrig.Bind(orig);
         myRasterInfo = myFunctionHelper.RasterInfo;
         myPixeltype  = myRasterInfo.PixelType;
         myValidFlag  = true;
     }
     else
     {
         throw new System.Exception("Incorrect arguments object. Expected: focalSampleFunctonArguments");
     }
 }
 public IFunctionRasterDataset calcFocalSampleFunction(object inRaster, HashSet<string> offset, focalType statType)
 {
     IFunctionRasterDataset iR1 = createIdentityRaster(inRaster);
     string tempAr = funcDir + "\\" + FuncCnt + ".afr";
     IFunctionRasterDataset frDset = new FunctionRasterDatasetClass();
     IFunctionRasterDatasetName frDsetName = new FunctionRasterDatasetNameClass();
     frDsetName.FullName = tempAr;
     frDset.FullName = (IName)frDsetName;
     IRasterFunction rsFunc = null;
     switch (statType)
     {
         case focalType.MIN:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperMin();
             break;
         case focalType.SUM:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperSum();
             break;
         case focalType.MEAN:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperMean();
             break;
         case focalType.MODE:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperMode();
             break;
         case focalType.MEDIAN:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperMedian();
             break;
         case focalType.VARIANCE:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperVariance();
             break;
         case focalType.STD:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperStd();
             break;
         case focalType.UNIQUE:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperUnique();
             break;
         case focalType.ENTROPY:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperEntropy();
             break;
         case focalType.ASM:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperASM();
             break;
         default:
             rsFunc = new FunctionRasters.NeighborhoodHelper.focalSampleHelperMax();
             break;
     }
     FunctionRasters.focalSampleArguments args = new FunctionRasters.focalSampleArguments(this);
     args.OffSets = offset;
     args.Operation = statType;
     //args.WindowType = windowType.RECTANGLE;
     args.InRaster = iR1;
     frDset.Init(rsFunc, args);
     return frDset;
 }