Exemple #1
0
 public void Bind(object pArgument)
 {
     if (pArgument is glcmFunctionArguments)
     {
         glcmFunctionArguments args = (glcmFunctionArguments)pArgument;
         inrs        = args.InRaster;
         orig        = args.OriginalRaster;
         inWindow    = args.WindowType;
         iter        = args.GenericIterator;
         clms        = args.Columns;
         rws         = args.Rows;
         radius      = args.Radius;
         glcmMetrics = args.GLCMMETRICS;
         horizontal  = args.Horizontal;
         myFunctionHelper.Bind(inrs);
         myFunctionHelperOrig.Bind(orig);
         myRasterInfo = myFunctionHelper.RasterInfo;
         myPixeltype  = myRasterInfo.PixelType;
         myValidFlag  = true;
     }
     else
     {
         throw new System.Exception("Incorrect arguments object. Expected: glcmFunctonArguments");
     }
 }
 /// <summary>
 /// Performs GLMC Analysis. All bands within the input raster will be transformed
 /// </summary>
 /// <param name="inRaster">raster to perform GLCM</param>
 /// <param name="radius">number of Columns that define the radius of the analysis window</param>
 /// <param name="horizontal">whether the direction of the GLCM is horizontal</param>
 /// <param name="glcmType">the type of GLCM to calculate</param>
 /// <returns>a transformed raster</returns>
 public IFunctionRasterDataset calcGLCMFunction(object inRaster, int radius, bool horizontal, glcmMetric glcmType)
 {
     IFunctionRasterDataset iR1 = createIdentityRaster(inRaster, rstPixelType.PT_FLOAT);
     string tempAr = funcDir + "\\" + FuncCnt + ".afr";
     IFunctionRasterDataset frDset = new FunctionRasterDatasetClass();
     IFunctionRasterDatasetName frDsetName = new FunctionRasterDatasetNameClass();
     frDsetName.FullName = tempAr;
     frDset.FullName = (IName)frDsetName;
     IRasterFunction rsFunc = null;
     switch (glcmType)
     {
         case glcmMetric.CONTRAST:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperContrast();
          break;
         case glcmMetric.DIS:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperDissimilarity();
          break;
         case glcmMetric.HOMOG:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperHomogeneity();
          break;
         case glcmMetric.ASM:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperASM();
          break;
         case glcmMetric.ENERGY:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperEnergy();
          break;
         case glcmMetric.MAXPROB:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperMaxProb();
          break;
         case glcmMetric.MINPROB:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperMinProb();
          break;
         case glcmMetric.RANGE:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperRange();
          break;
         case glcmMetric.ENTROPY:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperEntropy();
          break;
         case glcmMetric.MEAN:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperMean();
          break;
         case glcmMetric.VAR:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperVariance();
          break;
         case glcmMetric.CORR:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperCorrelation();
          break;
         case glcmMetric.COV:
          rsFunc = new FunctionRasters.NeighborhoodHelper.glcmHelperCovariance();
          break;
         default:
          break;
     }
     FunctionRasters.glcmFunctionArguments args = new FunctionRasters.glcmFunctionArguments(this);
     args.Radius = radius;
     args.InRaster = iR1;
     args.Horizontal = horizontal;
     args.GLCMMETRICS = glcmType;
     frDset.Init(rsFunc, args);
     return frDset;
 }