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"); } }
public void Bind(object pArgument) { if (pArgument is combineFunctionArguments) { combineFunctionArguments args = (combineFunctionArguments)pArgument; inrs = args.InRasterDataset; outRs = args.OutRaster; myFunctionHelper.Bind(outRs); //myFunctionHelperCoef.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; object tnd = myRasterInfo.NoData; if (tnd == null) { } else { noDataVl = ((System.Array)myRasterInfo.NoData).GetValue(0); } } else { throw new System.Exception("Incorrect arguments object. Expected: combineFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is combineFunctionArguments) { combineFunctionArguments args = (combineFunctionArguments)pArgument; inrs = args.InRasterDataset; outRs = args.OutRaster; myFunctionHelper.Bind(outRs); //myFunctionHelperCoef.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; object tnd = myRasterInfo.NoData; if(tnd==null) { } else { noDataVl = ((System.Array)myRasterInfo.NoData).GetValue(0); } } else { throw new System.Exception("Incorrect arguments object. Expected: combineFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is FocalFunctionArguments) { FocalFunctionArguments args = (FocalFunctionArguments)pArgument; inrs = args.InRaster; orig = args.OriginalRaster; inop = args.Operation; inWindow = args.WindowType; lsiter = args.Fastiter; windowN = args.WindowCount; //Console.WriteLine(lsiter.Count()); clms = args.Columns; rws = args.Rows; radius = args.Radius; myFunctionHelper.Bind(inrs); myFunctionHelperOrig.Bind(orig); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: FocalFunctonArguments"); } }
public static void exportRasterData(string parth, IRasterLayer rasterLayer, float[,] rasterMat) //输出栅格数据 { string directory = parth.Substring(0, parth.LastIndexOf("\\")); string name = parth.Substring(parth.LastIndexOf("\\") + 1); IWorkspaceFactory workspaceFac = new RasterWorkspaceFactoryClass(); IRasterWorkspace2 rasterWorkspace2 = workspaceFac.OpenFromFile(directory, 0) as IRasterWorkspace2; IRasterInfo rasterInfo = (rasterLayer.Raster as IRawBlocks).RasterInfo; IPoint originPoint = new Point(); originPoint.PutCoords(rasterInfo.Origin.X, rasterInfo.Origin.Y - (rasterLayer.Raster as IRasterProps).Height * (rasterLayer.Raster as IRasterProps).MeanCellSize().Y); IRasterProps rasterProps = rasterLayer.Raster as IRasterProps; IRasterDataset rasterDataSet = rasterWorkspace2.CreateRasterDataset(name, "IMAGINE Image", originPoint, rasterProps.Width, rasterProps.Height, rasterProps.MeanCellSize().X, rasterProps.MeanCellSize().Y, 1, rstPixelType.PT_FLOAT, rasterProps.SpatialReference, true) as IRasterDataset2; IRaster2 raster2 = rasterDataSet.CreateDefaultRaster() as IRaster2; IPnt pntClass = new Pnt(); pntClass.X = rasterProps.Width; pntClass.Y = rasterProps.Height; IRasterCursor rasterCursor = raster2.CreateCursorEx(pntClass); IRasterCursor inRasterCursor = (rasterLayer.Raster as IRaster2).CreateCursorEx(pntClass); IRasterEdit rasterEdit = raster2 as IRasterEdit; if (rasterEdit.CanEdit()) { IPixelBlock3 pixelBlock3 = rasterCursor.PixelBlock as IPixelBlock3; IPixelBlock3 inPixelBlock3 = inRasterCursor.PixelBlock as IPixelBlock3; System.Array pixels = (System.Array)rasterMat; pixelBlock3.set_PixelData(0, (System.Array)pixels); rasterEdit.Write(rasterCursor.TopLeft, (IPixelBlock)pixelBlock3); System.Runtime.InteropServices.Marshal.ReleaseComObject(pixelBlock3); } rasterEdit.Refresh(); IGeoDataset inDataset = rasterLayer.Raster as IGeoDataset; IGeoDataset outDataset = rasterDataSet as IGeoDataset; IExtractionOp op = new RasterExtractionOpClass(); var outDataset1 = op.Raster(outDataset, inDataset); var clipRaster = (IRaster)outDataset1; ISaveAs pSaveAs = clipRaster as ISaveAs; System.Runtime.InteropServices.Marshal.ReleaseComObject(rasterCursor); System.Runtime.InteropServices.Marshal.ReleaseComObject(rasterEdit); System.Runtime.InteropServices.Marshal.ReleaseComObject(raster2); System.Runtime.InteropServices.Marshal.ReleaseComObject(rasterDataSet); System.Runtime.InteropServices.Marshal.ReleaseComObject(rasterWorkspace2); System.Runtime.InteropServices.Marshal.ReleaseComObject(workspaceFac); if (File.Exists(parth)) { File.Delete(parth); } workspaceFac = new RasterWorkspaceFactoryClass(); IDataset outdataset = pSaveAs.SaveAs(name, workspaceFac.OpenFromFile(directory, 0), "IMAGINE Image"); System.Runtime.InteropServices.Marshal.ReleaseComObject(outdataset); return; }
public void Bind(object pArgument) { if (pArgument is MathFunctionArguments) { MathFunctionArguments args = (MathFunctionArguments)pArgument; inrs = args.InRaster; myFunctionHelper.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: MathFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is MathFunctionArguments) { MathFunctionArguments args = (MathFunctionArguments)pArgument; inrs = args.InRaster; myFunctionHelper.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: MathFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is convertPixelTypeFunctionArguments) { convertPixelTypeFunctionArguments arg = (convertPixelTypeFunctionArguments)pArgument; inrs = arg.InRaster; convPType = arg.RasterPixelType; myFunctionHelper.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: LocalFunctionArguments"); } }
private void ReadFileGDBWorkspaceFactory(string path) { Wsf = new FileGDBWorkspaceFactoryClass(); Directory = path.Substring(0, path.IndexOf(".gdb") + 4); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Extension = System.IO.Path.GetExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Ws = Wsf.OpenFromFile(Directory, 0); RstWsEx = Ws as IRasterWorkspaceEx; RstDs = RstWsEx.OpenRasterDataset(NameWithoutExtension) as IRasterDataset2; Rst = RstDs.CreateDefaultRaster(); RstProps = Rst as IRasterProps; RawBlocks = (IRawBlocks)RstDs; RstInfo = RawBlocks.RasterInfo; EnumDs = Ws.get_Datasets(esriDatasetType.esriDTRasterDataset); }
private void ReadRasterWorkspaceFactory(string path) { Wsf = new RasterWorkspaceFactoryClass(); Directory = System.IO.Path.GetDirectoryName(path); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path); Extension = System.IO.Path.GetExtension(path); Ws = Wsf.OpenFromFile(Directory, 0); RstWs = Ws as IRasterWorkspace; RstDs = RstWs.OpenRasterDataset(NameWithoutExtension + Extension) as IRasterDataset2; Rst = RstDs.CreateDefaultRaster(); RstProps = Rst as IRasterProps; RawBlocks = (IRawBlocks)RstDs; RstInfo = RawBlocks.RasterInfo; EnumDs = Ws.get_Datasets(esriDatasetType.esriDTRasterDataset); }
public void Bind(object pArgument) { if (pArgument is LocalRescaleFunctionArguments) { LocalRescaleFunctionArguments arg = (LocalRescaleFunctionArguments)pArgument; inrsBands = arg.InRaster; bndCnt = inrsBands.RasterInfo.BandCount; bndCntf = System.Convert.ToSingle(bndCnt-1); myFunctionHelper.Bind(inrsBands); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: LocalFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is LocalFunctionArguments) { LocalFunctionArguments arg = (LocalFunctionArguments)pArgument; inrsBands = arg.InRaster; inrs = arg.outRaster; myFunctionHelper.Bind(inrs); //myFunctionHelperCoef.Bind(inrsBands); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: LocalFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is LocalRescaleFunctionArguments) { LocalRescaleFunctionArguments arg = (LocalRescaleFunctionArguments)pArgument; inrsBands = arg.InRaster; bndCnt = inrsBands.RasterInfo.BandCount; bndCntf = System.Convert.ToSingle(bndCnt - 1); myFunctionHelper.Bind(inrsBands); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: LocalFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is PixelBlockToRasterFunctionArguments) { PixelBlockToRasterFunctionArguments args = (PixelBlockToRasterFunctionArguments)pArgument; inrs = args.InRaster; vPb = (IPixelBlock3)args.ValuePixelBlock; tlLoc = args.TopLeft; myFunctionHelper.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: PixelBlockToRasterArguments"); } }
public void Bind(object pArgument) { if (pArgument is conditionalFunctionArguments) { conditionalFunctionArguments args = (conditionalFunctionArguments)pArgument; coefRs = args.CoefRaster; outRs = args.OutRaster; myFunctionHelper.Bind(outRs); myFunctionHelperCoef.Bind(coefRs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: Conditional arguments"); } }
public void Bind(object pArgument) { if (pArgument is PixelBlockToRasterFunctionArguments) { PixelBlockToRasterFunctionArguments args = (PixelBlockToRasterFunctionArguments)pArgument; inrs = args.InRaster; vPb = (IPixelBlock3)args.ValuePixelBlock; tlLoc = args.TopLeft; myFunctionHelper.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: PixelBlockToRasterArguments"); } }
public void Bind(object pArgument) { if (pArgument is conditionalFunctionArguments) { conditionalFunctionArguments args = (conditionalFunctionArguments)pArgument; coefRs = args.CoefRaster; outRs = args.OutRaster; myFunctionHelper.Bind(outRs); myFunctionHelperCoef.Bind(coefRs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: Conditional arguments"); } }
public void Bind(object pArgument) { if (pArgument is LocalFunctionArguments) { LocalFunctionArguments arg = (LocalFunctionArguments)pArgument; inrsBands = arg.InRaster; inrs = arg.outRaster; myFunctionHelper.Bind(inrs); //myFunctionHelperCoef.Bind(inrsBands); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: LocalFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is meanShiftFunctionArguments) { meanShiftFunctionArguments args = (meanShiftFunctionArguments)pArgument; inrs = args.InRaster; radius = args.Radius; valrs = args.ValueRaster; myFunctionHelper.Bind(inrs); myFunctionHelper2.Bind(valrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: meanShiftArguments"); } }
public void Bind(object pArgument) { if (pArgument is focalBandFunctionArguments) { focalBandFunctionArguments arg = (focalBandFunctionArguments)pArgument; inrsBands = arg.InRaster; myFunctionHelper.Bind(inrsBands); bandsBefore = arg.BandsBefore; bandsAfter = arg.BandsAfter; tBands = 1 + bandsBefore + bandsAfter; myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: focalBandArguments"); } }
public void Bind(object pArgument) { if (pArgument is pcaArguments) { pcaArguments arg = (pcaArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; outrs = arg.OutRaster; pca = arg.PCA; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: pcaFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is nullToValueFunctionArguments) { nullToValueFunctionArguments args = (nullToValueFunctionArguments)pArgument; inrs = args.Raster; newvalue = args.NewValue; ndFilt.NoDataToPixelValue = newvalue; pFilt = (IPixelFilter)ndFilt; noDataArr = args.NoDataArray; myFunctionHelper.Bind(inrs); myRasterInfo = args.RasterInfo; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: nullToValueFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is nullToValueFunctionArguments) { nullToValueFunctionArguments args = (nullToValueFunctionArguments)pArgument; inrs = args.Raster; newvalue = args.NewValue; ndFilt.NoDataToPixelValue = newvalue; pFilt = (IPixelFilter)ndFilt; noDataArr = args.NoDataArray; myFunctionHelper.Bind(inrs); myRasterInfo = args.RasterInfo; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: nullToValueFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is glmFunctionArguments) { glmFunctionArguments arg = (glmFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; glm = arg.GlmModel; outrs = arg.OutRaster; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: regressionFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is meanShiftFunctionArguments) { meanShiftFunctionArguments args = (meanShiftFunctionArguments)pArgument; inrs = args.InRaster; radius = args.Radius; valrs = args.ValueRaster; myFunctionHelper.Bind(inrs); myFunctionHelper2.Bind(valrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: meanShiftArguments"); } }
public static IRasterDataset exportRasterData(string parth, IRasterLayer rasterLayer, float[,] rasterMat) { string directory = parth.Substring(0, parth.LastIndexOf("\\")); string name = parth.Substring(parth.LastIndexOf("\\") + 1); IWorkspaceFactory workspaceFac = new RasterWorkspaceFactoryClass(); IRasterWorkspace2 rasterWorkspace2 = workspaceFac.OpenFromFile(directory, 0) as IRasterWorkspace2; IRasterInfo rasterInfo = (rasterLayer.Raster as IRawBlocks).RasterInfo; IPoint originPoint = new Point(); originPoint.PutCoords(rasterInfo.Origin.X, rasterInfo.Origin.Y - (rasterLayer.Raster as IRasterProps).Height * (rasterLayer.Raster as IRasterProps).MeanCellSize().Y); IRasterProps rasterProps = rasterLayer.Raster as IRasterProps; IRasterDataset rasterDataSet = rasterWorkspace2.CreateRasterDataset(name, "IMAGINE Image", originPoint, rasterProps.Width, rasterProps.Height, rasterProps.MeanCellSize().X, rasterProps.MeanCellSize().Y, 1, rstPixelType.PT_FLOAT, rasterProps.SpatialReference, true); IRaster2 raster2 = rasterDataSet.CreateDefaultRaster() as IRaster2; IPnt pntClass = new Pnt(); pntClass.X = rasterProps.Width; pntClass.Y = rasterProps.Height; IRasterCursor rasterCursor = raster2.CreateCursorEx(pntClass); IRasterEdit rasterEdit = raster2 as IRasterEdit; if (rasterEdit.CanEdit()) { IRasterBandCollection bands = rasterDataSet as IRasterBandCollection; IPixelBlock3 pixelBlock3 = rasterCursor.PixelBlock as IPixelBlock3; System.Array pixels = (System.Array)pixelBlock3.get_PixelData(0); for (int i = 0; i < rasterProps.Width; i++) { for (int j = 0; j < rasterProps.Height; j++) { pixels.SetValue(Convert.ToSingle(rasterMat[j, i]), i, j); } } pixelBlock3.set_PixelData(0, (System.Array)pixels); rasterEdit.Write(rasterCursor.TopLeft, (IPixelBlock)pixelBlock3); } (raster2 as IRasterProps).NoDataValue = 0f; rasterEdit.Refresh(); System.Runtime.InteropServices.Marshal.ReleaseComObject(rasterEdit); return(rasterDataSet); }
public void Bind(object pArgument) { if (pArgument is focalBandFunctionArguments) { focalBandFunctionArguments arg = (focalBandFunctionArguments)pArgument; inrsBands = arg.InRaster; myFunctionHelper.Bind(inrsBands); bandsBefore = arg.BandsBefore; bandsAfter = arg.BandsAfter; tBands = 1 + bandsBefore + bandsAfter; myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: focalBandArguments"); } }
public void Bind(object pArgument) { if (pArgument is polytomousLogisticFunctionArguments) { polytomousLogisticFunctionArguments arg = (polytomousLogisticFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; slopes = arg.Slopes; outrs = arg.OutRaster; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: regressionFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is pcaArguments) { pcaArguments arg = (pcaArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; outrs = arg.OutRaster; pca = arg.PCA; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: pcaFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is clipFunctionArgument) { clipFunctionArgument args = (clipFunctionArgument)pArgument; inrs = args.InRaster; outrs = args.OutRaster; noDataValue = ((System.Array)((IRasterProps)outrs).NoDataValue).GetValue(0); geo = args.Geometry; cType = args.ClipType; myFunctionHelper.Bind(outrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: clipFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is mergeFunctionArguments) { mergeFunctionArguments arg = (mergeFunctionArguments)pArgument; inrs = arg.InRaster; outrs = arg.OutRaster; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); ftrCls = arg.Boundary; IRasterProps rsProp = (IRasterProps)outrs; myFunctionHelper.Bind(outrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: mergeFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is tobitFunctionArguments) { tobitFunctionArguments arg = (tobitFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; slopes = arg.Slopes; outrs = arg.OutRaster; censored = arg.CensoredValue; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: tobitnFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is aggregationFunctionArguments) { aggregationFunctionArguments args = (aggregationFunctionArguments)pArgument; inrs = args.InRaster; orig = args.OriginalRaster; cells = args.Cells; myFunctionHelper.Bind(inrs); myFunctionHelperOrig.Bind(orig); //System.Windows.Forms.MessageBox.Show(orig.RasterInfo.CellSize.X.ToString()+"\n" + inrs.RasterInfo.CellSize.X.ToString()); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: aggregationFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is aggregationFunctionArguments) { aggregationFunctionArguments args = (aggregationFunctionArguments)pArgument; inrs = args.InRaster; orig = args.OriginalRaster; cells = args.Cells; myFunctionHelper.Bind(inrs); myFunctionHelperOrig.Bind(orig); //System.Windows.Forms.MessageBox.Show(orig.RasterInfo.CellSize.X.ToString()+"\n" + inrs.RasterInfo.CellSize.X.ToString()); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: aggregationFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is mergeFunctionArguments) { mergeFunctionArguments arg = (mergeFunctionArguments)pArgument; inrs = arg.InRaster; outrs = arg.OutRaster; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); ftrCls = arg.Boundary; IRasterProps rsProp = (IRasterProps)outrs; myFunctionHelper.Bind(outrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: mergeFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is ExtractModelRangeFunctionArguments) { ExtractModelRangeFunctionArguments arg = (ExtractModelRangeFunctionArguments)pArgument; inrsBands = arg.InRaster; mins = arg.Mins; maxs = arg.Maxs; outrs = arg.OutRaster; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBands); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: ExtractModelRangeFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is clusterFunctionArguments) { clusterFunctionArguments arg = (clusterFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; outrs = arg.OutRaster; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); cluster = (Statistics.dataPrepClusterBinary)arg.ClusterModel; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: plrFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is clusterFunctionArguments) { clusterFunctionArguments arg = (clusterFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; outrs = arg.OutRaster; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); cluster = (Statistics.dataPrepClusterBinary)arg.ClusterModel; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: plrFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is clipFunctionArgument) { clipFunctionArgument args = (clipFunctionArgument)pArgument; inrs = args.InRaster; outrs = args.OutRaster; noDataValue = ((System.Array)((IRasterProps)outrs).NoDataValue).GetValue(0); geo = args.Geometry; cType = args.ClipType; myFunctionHelper.Bind(outrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: clipFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is tobitFunctionArguments) { tobitFunctionArguments arg = (tobitFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; slopes = arg.Slopes; outrs = arg.OutRaster; censored = arg.CensoredValue; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: tobitnFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is softMaxFunctionArguments) { softMaxFunctionArguments arg = (softMaxFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; outrs = arg.OutRaster; xVls = new double[((IRasterBandCollection)inrsBandsCoef).Count]; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); lm = arg.LogitModel; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: plrFunctionArguments"); } }
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 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 void Bind(object pArgument) { if (pArgument is pairedttestFunctionArguments) { pairedttestFunctionArguments arg = (pairedttestFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; outrs = arg.OutRaster; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); tDic = arg.TTestDictionary; IRasterProps rsProp = (IRasterProps)outrs; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: plrFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is pairedttestFunctionArguments) { pairedttestFunctionArguments arg = (pairedttestFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; outrs = arg.OutRaster; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); tDic = arg.TTestDictionary; IRasterProps rsProp = (IRasterProps)outrs; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: plrFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is softMaxFunctionArguments) { softMaxFunctionArguments arg = (softMaxFunctionArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; outrs = arg.OutRaster; xVls = new double[((IRasterBandCollection)inrsBandsCoef).Count]; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); lm = arg.LogitModel; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: plrFunctionArguments"); } }
public void Bind(object pArgument) { if (pArgument is randomForestArguments) { randomForestArguments arg = (randomForestArguments)pArgument; inrsBandsCoef = arg.InRasterCoefficients; //coefRaster = arg.RasterUtility.createRaster(inrsBandsCoef); outrs = arg.OutRaster; xVls = new double[((IRasterBandCollection)inrsBandsCoef).Count]; Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); df = arg.RandomForestModel; myFunctionHelper.Bind(outrs); myFunctionHelperCoef.Bind(inrsBandsCoef); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: randomForestArguments"); } }
public void Bind(object pArgument) { if (pArgument is regionGroupFunctionArguments) { regionGroupFunctionArguments arg = (regionGroupFunctionArguments)pArgument; inrs = arg.InRaster; outrs = arg.OutRaster; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); rsProp = (IRasterProps)outrs; width = rsProp.Width; height = rsProp.Height; myFunctionHelper.Bind(outrs); myFunctionHelperInput.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: randomForestArguments"); } }
public void Bind(object pArgument) { if (pArgument is regionGroupFunctionArguments) { regionGroupFunctionArguments arg = (regionGroupFunctionArguments)pArgument; inrs = arg.InRaster; outrs = arg.OutRaster; //Console.WriteLine("Number of Bands in outrs = " + ((IRasterBandCollection)outrs).Count.ToString()); rsProp = (IRasterProps)outrs; width = rsProp.Width; height = rsProp.Height; myFunctionHelper.Bind(outrs); myFunctionHelperInput.Bind(inrs); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: randomForestArguments"); } }
public void Bind(object pArgument) { if (pArgument is LandscapeFunctionArguments) { LandscapeFunctionArguments args = (LandscapeFunctionArguments)pArgument; inrs = args.InRaster; orig = args.OriginalRaster; inop = args.Operation; landType = args.LandscapeType; inWindow = args.WindowType; clms = args.Columns; rws = args.Rows; radius = args.Radius; myFunctionHelper.Bind(inrs); myFunctionHelperCoef.Bind(orig); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: FocalFunctonArguments"); } }
public void Bind(object pArgument) { if (pArgument is LandscapeFunctionArguments) { LandscapeFunctionArguments args = (LandscapeFunctionArguments)pArgument; inrs = args.InRaster; orig = args.OriginalRaster; inop = args.Operation; landType = args.LandscapeType; inWindow = args.WindowType; clms = args.Columns; rws = args.Rows; radius = args.Radius; myFunctionHelper.Bind(inrs); myFunctionHelperCoef.Bind(orig); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: FocalFunctonArguments"); } }
/// <summary> /// Initialize the Raster function using the argument object. This is one of the two /// main functions to implement for a custom Raster function. The raster object is /// dereferenced if required and given to the RasterFuntionHelper object to bind. /// </summary> /// <param name="pArguments">Arguments object used for initialization</param> public void Bind(object pArguments) { try { // Check if the Arguments object is of the correct type. INDVICustomFunctionArguments customFunctionArgs = null; if (pArguments is INDVICustomFunctionArguments) { customFunctionArgs = (INDVICustomFunctionArguments)pArguments; object inputRaster = customFunctionArgs.Raster; if (customFunctionArgs.Raster is IRasterFunctionVariable) { IRasterFunctionVariable rasterFunctionVariable = (IRasterFunctionVariable)customFunctionArgs.Raster; inputRaster = rasterFunctionVariable.Value; } // Call the Bind method of the Raster Function Helper object. myFunctionHelper.Bind(inputRaster); } else { // Throw an error if incorrect arguments object is passed. throw new System.Exception( "Incorrect arguments object. Expected: INDVICustomFunctionArguments"); } // Check to see if Band Indices exist. if (customFunctionArgs.BandIndices != null && customFunctionArgs.BandIndices != "") myBandIndices = customFunctionArgs.BandIndices.Split(' '); else { // If not, throw an error. throw new System.Exception( "Incorrect parameters specified. Expected: Valid band indices."); } // Create a new RasterInfo object and initialize from the FunctionHelper object. // A new RasterInfo Object is created because assigning myFunctionHelper.RasterInfo // directly creates a reference. myRasterInfo = new RasterInfo(); myRasterInfo.BandCount = myFunctionHelper.RasterInfo.BandCount; myRasterInfo.BlockHeight = myFunctionHelper.RasterInfo.BlockHeight; myRasterInfo.BlockWidth = myFunctionHelper.RasterInfo.BlockWidth; myRasterInfo.CellSize = myFunctionHelper.RasterInfo.CellSize; myRasterInfo.Extent = myFunctionHelper.RasterInfo.Extent; myRasterInfo.FirstPyramidLevel = myFunctionHelper.RasterInfo.FirstPyramidLevel; myRasterInfo.Format = myFunctionHelper.RasterInfo.Format; myRasterInfo.GeodataXform = myFunctionHelper.RasterInfo.GeodataXform; myRasterInfo.MaximumPyramidLevel = myFunctionHelper.RasterInfo.MaximumPyramidLevel; myRasterInfo.NativeExtent = myFunctionHelper.RasterInfo.NativeExtent; myRasterInfo.NativeSpatialReference = myFunctionHelper.RasterInfo.NativeSpatialReference; myRasterInfo.NoData = myFunctionHelper.RasterInfo.NoData; myRasterInfo.Origin = myFunctionHelper.RasterInfo.Origin; myRasterInfo.PixelType = rstPixelType.PT_FLOAT; // Output pixel type should be output of the NDVI. myRasterInfo.Resampling = myFunctionHelper.RasterInfo.Resampling; myRasterInfo.SupportBandSelection = myFunctionHelper.RasterInfo.SupportBandSelection; // Store required input properties. myInpPixeltype = myRasterInfo.PixelType; myInpNumBands = myRasterInfo.BandCount; // Set output pixel properties. myRasterInfo.BandCount = 1; myPixeltype = rstPixelType.PT_FLOAT; // Perform validation to see if the indices passed are valid. if (myInpNumBands < 2 || myBandIndices.Length < 2) { // If not, throw an error. throw new System.Exception( "Incorrect parameters specified. Expected: Valid band indices."); } for (int i = 0; i < myBandIndices.Length; ++i) { int currBand = Convert.ToInt16(myBandIndices[i]) - 1; if ((currBand < 0) || (currBand > myInpNumBands)) { // If not, throw an error. throw new System.Exception( "Incorrect parameters specified. Expected: Valid band indices."); } } } catch (Exception exc) { System.Exception myExc = new System.Exception( "Exception caught in Bind method: " + exc.Message, exc); throw myExc; } }
/// <summary> /// Initialize the Raster function using the argument object. This is one of the two /// main functions to implement for a custom Raster function. The raster object is /// dereferenced if required and given to the RasterFuntionHelper object to bind. /// </summary> /// <param name="pArguments">Arguments object used for initialization</param> public void Bind(object pArguments) { try { // Check if the Arguments object is of the correct type. IWatermarkFunctionArguments watermarkFuncArgs = null; if (pArguments is IWatermarkFunctionArguments) { watermarkFuncArgs = (IWatermarkFunctionArguments)pArguments; myBlendPercentage = watermarkFuncArgs.BlendPercentage; myWatermarkImagePath = watermarkFuncArgs.WatermarkImagePath; xgap = watermarkFuncArgs.XGap; ygap = watermarkFuncArgs.YGap; object inputRaster = watermarkFuncArgs.Raster; if (watermarkFuncArgs.Raster is IRasterFunctionVariable) { IRasterFunctionVariable rasterFunctionVariable = (IRasterFunctionVariable)watermarkFuncArgs.Raster; inputRaster = rasterFunctionVariable.Value; } // Call the Bind method of the Raster Function Helper object. myFunctionHelper.Bind(inputRaster); } else { // Throw an error if incorrect arguments object is passed. throw new System.Exception( "Incorrect arguments object. Expected: IWatermarkFunctionArguments"); } // Get the raster info and Pixel Type from the RasterFunctionHelper object. myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; // Convert blending percentage to blending value. if (myBlendPercentage >= 0.0 && myBlendPercentage <= 100.0) blendValue = myBlendPercentage / 100.0; else /// A value of 50% is used as default. blendValue = 0.50; if (myWatermarkImagePath != "") { // Load the watermark image from the path provided myWatermarkImage = new Bitmap(myWatermarkImagePath); // and check the pixel type of the loaded image to see if its compatible. if (myWatermarkImage.PixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppArgb && myWatermarkImage.PixelFormat != System.Drawing.Imaging.PixelFormat.Format24bppRgb) { // Throw error if the image is not compatible. throw new System.Exception( "Invalid watermark image. Please provide one with 8 bits per band in ARGB or RGB format."); } // Cleanup myWatermarkImage.Dispose(); myWatermarkImage = null; } } catch (Exception exc) { #region Cleanup if (myWatermarkImage != null) myWatermarkImage.Dispose(); myWatermarkImage = null; #endregion System.Exception myExc = new System.Exception( "Exception caught in Bind method of Watermark Function. " + exc.Message, exc); throw myExc; } }
public void Bind(object pArgument) { if (pArgument is FocalFunctionArguments) { FocalFunctionArguments args = (FocalFunctionArguments)pArgument; inrs = args.InRaster; orig = args.OriginalRaster; inop = args.Operation; inWindow = args.WindowType; lsiter = args.Fastiter; windowN = args.WindowCount; //Console.WriteLine(lsiter.Count()); clms = args.Columns; rws = args.Rows; radius = args.Radius; myFunctionHelper.Bind(inrs); myFunctionHelperOrig.Bind(orig); myRasterInfo = myFunctionHelper.RasterInfo; myPixeltype = myRasterInfo.PixelType; myValidFlag = true; } else { throw new System.Exception("Incorrect arguments object. Expected: FocalFunctonArguments"); } }
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"); } }