private void button2_Click(object sender, EventArgs e) { ExtractProductIdentify prdIdentify = new ExtractProductIdentify(); prdIdentify.ThemeIdentify = "CMA"; prdIdentify.ProductIdentify = "BAG"; prdIdentify.SubProductIdentify = "DBLV"; ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify(); algIdentify.Satellite = "EOST"; algIdentify.Sensor = "MODIS"; algIdentify.Resolution = null;//not use //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); IArgumentProvider prd = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify); ProductDef bag = themeDef.GetProductDefByIdentify("BAG"); IMonitoringProduct prbag = new MonitoringProductBag(); SubProductDef productDef = bag.GetSubProductDefByIdentify("DBLV"); AlgorithmDef alg = productDef.GetAlgorithmDefByIdentify("BAGExtract"); IMonitoringSubProduct product = new SubProductBinaryBag(productDef); //prd.SetArg("BAGExtract", alg); prd.DataProvider = GetRasterDataProvider(); prd.AOI = GetAOI(prd.DataProvider); //IExtractResult result = (product as SubProductBinaryBag).Make(null,null); //结果存为图片 //idxs = (result as MatrixPixelIndexMapper).Indexes.ToArray(); //IBinaryBitmapBuilder builder = new BinaryBitmapBuilder(); //Size bmSize = new Size(prd.DataProvider.Width, prd.DataProvider.Height); //Bitmap bitmap = builder.CreateBinaryBitmap(bmSize, Color.Red, Color.Transparent); //builder.Fill(idxs, new Size(prd.DataProvider.Width, prd.DataProvider.Height), ref bitmap); //bitmap.Save(@"D:\Code\源代码\【控制】监测分析框架\test\bin\Release\TEMP\bag.png", ImageFormat.Png); //MessageBox.Show("判识结束."); //RasterIdentify id = new RasterIdentify(); //id.ThemeIdentify = "CMA"; //id.ProductIdentify = "BAG"; //id.SubProductIdentify = "DBLV"; //id.Sensor = "MODIS"; //id.OrbitDateTime = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0)); //id.GenerateDateTime = DateTime.Now; //IInterestedRaster<UInt16> iir = new InterestedRaster<UInt16>(id, new Size(prd.DataProvider.Width, prd.DataProvider.Height), prd.DataProvider.CoordEnvelope.Clone()); //iir.Put(idxs, 1); //iir.Dispose(); //MessageBox.Show("判识结果已永久保存."); }
private void button1_Click(object sender, EventArgs e) { ExtractProductIdentify prdIdentify = new ExtractProductIdentify(); prdIdentify.ThemeIdentify = "CMA"; prdIdentify.ProductIdentify = "BAG"; prdIdentify.SubProductIdentify = "DBLV"; ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify(); algIdentify.Satellite = "EOST"; algIdentify.Sensor = "MODIS"; algIdentify.Resolution = null;//not use //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); IArgumentProvider prd = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify); ProductDef bag = themeDef.GetProductDefByIdentify("BAG"); IMonitoringProduct prbag = new MonitoringProductBag(); SubProductDef productDef = bag.GetSubProductDefByIdentify("DBLV"); AlgorithmDef alg = productDef.GetAlgorithmDefByIdentify("BAGExtract"); IMonitoringSubProduct product = new SubProductBinaryBag(productDef); prd.SetArg("BAGExtract", alg); prd.DataProvider = GetRasterDataProvider(); prd.AOI = GetAOI(prd.DataProvider); //IExtractResult result = (product as SubProductBinaryBag).Make(prd,null); //结果存为图片 //int[] idxs = (result as IPixelIndexMapper).Indexes.ToArray(); //IBinaryBitmapBuilder builder = new BinaryBitmapBuilder(); //Size bmSize = new Size(prd.DataProvider.Width, prd.DataProvider.Height); //Bitmap bitmap = builder.CreateBinaryBitmap(bmSize, Color.Red, Color.Transparent); //builder.Fill(idxs, new Size(prd.DataProvider.Width, prd.DataProvider.Height), ref bitmap); //bitmap.Save("E:\\bag.png", ImageFormat.Png); //MessageBox.Show("判识结束"); }
private void button6_Click(object sender, EventArgs e) { string fname = @"E:\数据文件\BAG_NDVITemp_NUL_NUL_NUL_20120619163044_20120620163044.dat"; IRasterDataProvider dataProvider = GeoDataDriver.Open(fname) as IRasterDataProvider; //非蓝藻区域赋-9999 NDVISetValue setValue1 = (dataProvider as MemoryRasterDataProvider).GetExtHeader <NDVISetValue>(); double min = setValue1.MinNDVI; double max = setValue1.MaxNDVI; IPixelFeatureMapper <float> ndvifinal = new MemPixelFeatureMapper <float>("NDVI", 1000, new Size(dataProvider.Width, dataProvider.Height), dataProvider.CoordEnvelope, dataProvider.SpatialRef); RasterIdentify idNDVI = new RasterIdentify(); idNDVI.ThemeIdentify = "CMA"; idNDVI.ProductIdentify = "BAG"; idNDVI.SubProductIdentify = "NDVI"; idNDVI.OrbitDateTime = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0)); idNDVI.GenerateDateTime = DateTime.Now; InterestedRaster <float> iirNDVI = new InterestedRaster <float>(idNDVI, new Size(dataProvider.Width, dataProvider.Height), dataProvider.CoordEnvelope.Clone(), dataProvider.SpatialRef, 8); iirNDVI.Put(-9999); //IEnumerable<int> ids = (indexProvider as IPixelIndexMapper).Indexes; ArgumentProvider ap = new ArgumentProvider(dataProvider, null); RasterPixelsVisitor <float> visitor = new RasterPixelsVisitor <float>(ap); #region ExtractProductIdentify prdIdentify = new ExtractProductIdentify(); prdIdentify.ThemeIdentify = "CMA"; prdIdentify.ProductIdentify = "BAG"; prdIdentify.SubProductIdentify = "DBLV"; ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify(); algIdentify.Satellite = "EOST"; algIdentify.Sensor = "MODIS"; algIdentify.Resolution = null;//not use //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); IArgumentProvider prd = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify); ProductDef bag = themeDef.GetProductDefByIdentify("BAG"); IMonitoringProduct prbag = new MonitoringProductBag(); SubProductDef productDef = bag.GetSubProductDefByIdentify("DBLV"); AlgorithmDef alg = productDef.GetAlgorithmDefByIdentify("BAGExtract"); IMonitoringSubProduct product = new SubProductBinaryBag(productDef); //prd.SetArg("BAGExtract", alg); prd.DataProvider = GetRasterDataProvider(); prd.AOI = GetAOI(prd.DataProvider); //IExtractResult result = (product as SubProductBinaryBag).Make(prd,null, null); //idxs = (result as IPixelIndexMapper).Indexes.ToArray(); //#endregion //visitor.VisitPixel(new int[] { 1 }, (index, values) => // { // foreach (int item in idxs) // { // if (item == index) // { // ndvifinal.Put(index, values[0]); // break; // } // } // }); //iirNDVI.SetExtHeader(setValue1); //iirNDVI.Put(ndvifinal); //iirNDVI.Dispose(); #endregion }