private void btOPTD_Click(object sender, EventArgs e) { ProductColorTable[] tables = ProductColorTableFactory.GetAllColorTables(); ProductColorTable table = ProductColorTableFactory.GetColorTable("FOG", "TIMS"); ExtractProductIdentify exPro = new ExtractProductIdentify(); exPro.ThemeIdentify = "CMA"; exPro.ProductIdentify = "FOG"; exPro.SubProductIdentify = "OPTD"; ThemeDef theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); ProductDef pro = theme.GetProductDefByIdentify("FOG"); SubProductDef sub = pro.GetSubProductDefByIdentify("OPTD"); AlgorithmDef alg = sub.GetAlgorithmDefByIdentify("OPTDAlgorithm"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "OPTDAlgorithm", "FY3A", "MERSI"); arg.SetArg("OPTDAlgorithm", alg); IRasterDataProvider prd = GetRasterDataProvider("FOG"); arg.DataProvider = prd; arg.SetArg("CSRFile", @"E:\code\SMARTII\SRC\【控制】监测分析框架\testCN\bin\Release\TEMP\FOG_0CSR_FY3A_MERSI_10M_20120614001422_20120615001422.dat"); arg.SetArg("DBLVFile", @"E:\code\SMARTII\SRC\【控制】监测分析框架\testCN\bin\Release\TEMP\FOG_DBLV_FY3A_MERSI_1000M_20120614005135_20120615005135.dat"); IMonitoringSubProduct bin = new SubProductOPTDFOG(sub); IPixelFeatureMapper <Int16> result = bin.Make(null) as IPixelFeatureMapper <Int16>; result.Dispose(); }
private void btSeaIceNDSI_Click(object sender, EventArgs e) { ExtractProductIdentify exPro = new ExtractProductIdentify(); exPro.ThemeIdentify = "CMA"; exPro.ProductIdentify = "ICE"; exPro.SubProductIdentify = "DBLV"; //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); ProductDef pro = theme.GetProductDefByIdentify("ICE"); SubProductDef sub = pro.GetSubProductDefByIdentify("DBLV"); AlgorithmDef alg = sub.GetAlgorithmDefByIdentify("NDSIAlgorithm_NOAA"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "NDSIAlgorithm_NOAA", "FY3A", "VIRR"); arg.SetArg("NDSIAlgorithm_NOAA", alg); IRasterDataProvider prd = GetRasterDataProvider("ICE"); arg.DataProvider = prd; IMonitoringSubProduct bin = new SubProductBinaryICE(sub); IPixelIndexMapper result = bin.Make(null) as IPixelIndexMapper; string saveName = "e:\\seaice1.png"; CreatBitmap(prd, result.Indexes.ToArray(), saveName); }
private void FY3陆地_Click(object sender, EventArgs e) { InitExIdentify(); _exAlg.CustomIdentify = "陆地"; _exAlg.Satellite = "FY3A"; _exAlg.Sensor = "VIRR"; AlgorithmDef alg = _sub.GetAlgorithmDefByIdentify("FY3Land"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); IRasterDataProvider prd = GetRasterDataProviderVIRR(); // arg.DataProvider = prd; //arg.AOI = ApplyAOI(prd, true); // arg.SetArg("AlgorithmName","FY3Land"); SubProductBinaryDst bin = new SubProductBinaryDst(_sub); bin.ResetArgumentProvider("FY3Land", prd.DataIdentify.Satellite, prd.DataIdentify.Sensor, "陆地"); bin.ArgumentProvider.DataProvider = prd; bin.ArgumentProvider.SetArg("AlgorithmName", "FY3Land"); IPixelIndexMapper result = bin.Make(null) as IPixelIndexMapper; string saveName = @"E:\沙尘判识VIRR.png"; CreatBitmap(prd, result.Indexes.ToArray(), saveName); RasterIdentify id = new RasterIdentify(); id.ThemeIdentify = "CMA"; id.ProductIdentify = "DST"; id.SubProductIdentify = "2VAL"; id.Satellite = "FY3A"; id.Sensor = "VIRR"; id.Resolution = "1000M"; 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.Width, prd.Height), prd.CoordEnvelope.Clone()); iir.Put(result.Indexes.ToArray(), 1); iir.Dispose(); MessageBox.Show("判识完成,输出文件:E:\\data\\dst\\output\\沙尘判识VIRR.png"); }
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("判识结果已永久保存."); }
//通过读取历史判识文件获取AOI private void 能见度计算file_Click(object sender, EventArgs e) { InitExIdentify(); _exPro.SubProductIdentify = "VISY"; _sub = _pro.GetSubProductDefByIdentify("VISY"); _exAlg.Satellite = "FY3A"; _exAlg.Sensor = "VIRR"; AlgorithmDef visiAlg = _sub.GetAlgorithmDefByIdentify("Visibility"); IArgumentProvider visiArg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); IRasterDataProvider prd = GetRasterDataProviderBinaryFile(); Dictionary <string, object> args = new Dictionary <string, object>(); IArgumentProvider argPrd = new ArgumentProvider(prd, args); RasterPixelsVisitor <UInt16> raster = new RasterPixelsVisitor <UInt16>(argPrd); List <int> idxs = new List <int>(); raster.VisitPixel(new int[] { 1 }, (index, value) => { if (value[0] != 0) { idxs.Add(index); } }); visiArg.DataProvider = GetRasterDataProviderVIRR(); visiArg.AOI = idxs.ToArray(); visiArg.SetArg("Visibility", visiAlg); SubProductRasterDst subraster = new SubProductRasterDst(_sub); IPixelFeatureMapper <UInt16> rasterResult = subraster.Make(null) as IPixelFeatureMapper <UInt16>; // RasterIdentify id = new RasterIdentify(); id.ThemeIdentify = "CMA"; id.ProductIdentify = "SAND"; id.SubProductIdentify = "VISIBILITY"; id.Satellite = "FY3A"; id.Sensor = "VIRRX"; id.Resolution = "1000M"; 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.Width, prd.Height), prd.CoordEnvelope.Clone()); iir.Put(rasterResult); iir.Dispose(); MessageBox.Show("能见度计算完成!"); }
//通过实时判识结果获取AOI private void 能见度计算_Click(object sender, EventArgs e) { InitExIdentify(); _exAlg.CustomIdentify = "陆地"; _exAlg.Satellite = "FY3A"; _exAlg.Sensor = "VIRR"; AlgorithmDef alg = _sub.GetAlgorithmDefByIdentify("FY3Land"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); IRasterDataProvider prd = GetRasterDataProviderVIRR(); arg.DataProvider = prd; arg.AOI = GetAOI(prd, true); arg.SetArg("FY3Land", alg); SubProductBinaryDst bin = new SubProductBinaryDst(_sub); IPixelIndexMapper result = bin.Make(null) as IPixelIndexMapper; int[] indxs = result.Indexes.ToArray(); _exPro.SubProductIdentify = "VISY"; _sub = _pro.GetSubProductDefByIdentify("VISY"); _exAlg.CustomIdentify = null; AlgorithmDef visiAlg = _sub.GetAlgorithmDefByIdentify("Visibility"); IArgumentProvider visiArg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); visiArg.DataProvider = prd; visiArg.AOI = indxs; visiArg.SetArg("Visibility", visiAlg); SubProductRasterDst raster = new SubProductRasterDst(_sub); IPixelFeatureMapper <UInt16> rasterResult = raster.Make(null) as IPixelFeatureMapper <UInt16>; // RasterIdentify id = new RasterIdentify(); id.ThemeIdentify = "CMA"; id.ProductIdentify = "SAND"; id.SubProductIdentify = "VISIBILITY"; id.Satellite = "FY3A"; id.Sensor = "VIRRX"; id.Resolution = "1000M"; 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.Width, prd.Height), prd.CoordEnvelope.Clone()); iir.Put(rasterResult); iir.Dispose(); MessageBox.Show("能见度计算完成!"); }
private void btCSR_Click(object sender, EventArgs e) { //IArgumentProviderFactory fac1 = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef theme1 = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); // fac1.GetThemeDefByIdentify("CMA"); ProductDef pro1 = theme1.GetProductDefByIdentify("FOG"); //ProductDef pro1 = theme1.GetProductDefByIdentify("ICE"); MonitoringProduct mp = new MonitoringProductFOG(); //MonitoringProduct mp = new MonitoringProductICE(pro1); mp = mp; ExtractProductIdentify exPro = new ExtractProductIdentify(); exPro.ThemeIdentify = "CMA"; exPro.ProductIdentify = "FOG"; exPro.SubProductIdentify = "0CSR"; ExtractAlgorithmIdentify exAlg = new ExtractAlgorithmIdentify(); exAlg.CustomIdentify = null; exAlg.Satellite = "FY3A"; exAlg.Sensor = "MERSI"; exAlg.Resolution = null; //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); //fac.GetThemeDefByIdentify("CMA"); ProductDef pro = theme.GetProductDefByIdentify("FOG"); SubProductDef sub = pro.GetSubProductDefByIdentify("0CSR"); AlgorithmDef alg = sub.GetAlgorithmDefByIdentify("BaseOrbitAlgorithm"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "BaseOrbitAlgorithm", "FY3A", "MERSI"); arg.SetArg("BaseOrbitAlgorithm", alg); IRasterDataProvider prd = GetRasterDataProvider("FOG"); arg.DataProvider = prd; arg.SetArg("OrbitFile", new string[] { prd.fileName }); IMonitoringSubProduct bin = new SubProductCSRFOG(sub); IPixelFeatureMapper <UInt16> result = bin.Make(null) as IPixelFeatureMapper <UInt16>; result.Dispose(); }
private void btFogBB_Click(object sender, EventArgs e) { ExtractProductIdentify exPro = new ExtractProductIdentify(); exPro.ThemeIdentify = "CMA"; exPro.ProductIdentify = "FOG"; exPro.SubProductIdentify = "DBLV"; ExtractAlgorithmIdentify exAlg = new ExtractAlgorithmIdentify(); exAlg.CustomIdentify = null; exAlg.Satellite = "FY3A"; exAlg.Sensor = "MERSI"; exAlg.Resolution = null; //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); ProductDef pro = theme.GetProductDefByIdentify("FOG"); SubProductDef sub = pro.GetSubProductDefByIdentify("DBLV"); AlgorithmDef alg = sub.GetAlgorithmDefByIdentify("EasyAlgorithm"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "EasyAlgorithm", "FY3A", "MERSI"); arg.SetArg("EasyAlgorithm", alg); IRasterDataProvider prd = GetRasterDataProvider("FOG"); arg.DataProvider = prd; IMonitoringSubProduct bin = new SubProductBinaryFOG(sub); IPixelIndexMapper result = bin.Make(null) as IPixelIndexMapper; RasterIdentify id = new RasterIdentify(); id.ThemeIdentify = "CMA"; id.ProductIdentify = "FOG"; id.SubProductIdentify = "DBLV"; id.Satellite = "FY3A"; id.Sensor = "MERSI"; id.Resolution = "1000M"; id.OrbitDateTime = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0)); id.GenerateDateTime = DateTime.Now; IInterestedRaster <Int16> iir = new InterestedRaster <Int16>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope); iir.Put(result.Indexes.ToArray(), 1); iir.Dispose(); }
private void btImage_Click(object sender, EventArgs e) { //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); ProductDef pro = theme.GetProductDefByIdentify("FOG"); SubProductDef sub = pro.GetSubProductDefByIdentify("0IMG"); AlgorithmDef alg = sub.GetAlgorithmDefByIdentify("0IMGAlgorithm"); ExtractProductIdentify exPro = new ExtractProductIdentify(); exPro.ThemeIdentify = "CMA"; exPro.ProductIdentify = "FOG"; exPro.SubProductIdentify = "0IMG"; IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "0IMGAlgorithm", "FY3A", "MERSI"); IMonitoringSubProduct subPro = new SubProductIMGFOG(sub); subPro.ResetArgumentProvider("FY3A", "MERSI"); arg.SetArg("AOI", ""); arg.SetArg("OutFileIdentify", "STBI"); subPro.Make(null); }
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 button4_Click(object sender, EventArgs e) { ExtractProductIdentify prdIdentify = new ExtractProductIdentify(); prdIdentify.ThemeIdentify = "CMA"; prdIdentify.ProductIdentify = "SNW"; prdIdentify.SubProductIdentify = "0CLM"; ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify(); algIdentify.Satellite = "FY3A"; algIdentify.Sensor = "VIRR"; algIdentify.Resolution = null;//not use //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); IArgumentProvider prd = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify); ProductDef snw = themeDef.GetProductDefByIdentify("SNW"); IMonitoringProduct prbag = new MonitoringProductBag(); SubProductDef productDef = snw.GetSubProductDefByIdentify("0CLM"); AlgorithmDef alg = productDef.GetAlgorithmDefByIdentify("CloudExtract"); IMonitoringSubProduct product = new SubProductBinaryClm(productDef); prd.SetArg("CloudExtract", alg); prd.DataProvider = GetRasterDataProvider1(); //IExtractResult result = product.Make(null,null); //结果存为图片 //int[] idxs = (result as MemPixelIndexMapper).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:\\data\\蓝藻\\snow_clound.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 }