private void LoadProduct() { ThemeDef def = MonitoringThemeFactory.GetAllThemes()[0];//"CMA" ProductDef[] products = def.Products; foreach (ProductDef prd in products) { if (string.IsNullOrWhiteSpace(prd.Name)) { continue; } string name = prd.Name.Replace(" ", ""); if (_productDic.ContainsKey(name)) { continue; } _productDic.Add(name, prd.Identify); } comboBox4.Items.Clear(); foreach (string product in _productDic.Keys) { comboBox4.Items.Add(product); } comboBox4.SelectedItem = comboBox1.Items[0]; }
private void SetBandArgs(IMonitoringSubProduct subProduct) { if (!subProduct.Definition.IsNeedCurrentRaster) { return; } DataIdentify id = GetCurrentRasterIdentify(); if (id == null) { return; } if (!subProduct.ArgumentProvider.BandArgsIsSetted) { MonitoringThemeFactory.SetBandArgs(subProduct, id.Satellite, id.Sensor); } else { AlgorithmDef alg = subProduct.ArgumentProvider.CurrentAlgorithmDef; if (!alg.Satellites.Contains(id.Satellite) || !alg.Sensors.Contains(id.Sensor)) { MonitoringThemeFactory.SetBandArgs(subProduct, id.Satellite, id.Sensor); } } }
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 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 IMonitoringSubProduct CreateMonitoringSubProduct(string rstFileName, string productIdentify, string subProductIdentify) { MonitoringSession session = new MonitoringSession(_session); IMonitoringProduct monitorProduct = session.ChangeActiveProduct(productIdentify); IMonitoringSubProduct subprd = session.ChangeActiveSubProduct(subProductIdentify); RasterIdentify rstIdentify = new RasterIdentify(rstFileName); ExtractAlgorithmIdentify id = new ExtractAlgorithmIdentify(); id.Satellite = rstIdentify.Satellite; id.Sensor = rstIdentify.Sensor; AlgorithmDef alg = subprd.Definition.GetAlgorithmDefByAlgorithmIdentify(id); if (alg == null) { PrintInfo("没有匹配的算法:" + "卫星" + rstIdentify.Satellite + ",传感器" + rstIdentify.Sensor); return(null); } subprd.ResetArgumentProvider(alg.Identify); subprd.ArgumentProvider.SetArg("AlgorithmName", alg.Identify); if (alg.Bands != null && alg.Bands.Length > 0) { MonitoringThemeFactory.SetBandArgs(subprd, rstIdentify.Satellite, rstIdentify.Sensor); foreach (BandDef band in alg.Bands) { if (subprd.ArgumentProvider.GetArg(band.Identify).ToString() == "-1") { PrintInfo("从波段映射表获取\"" + band.Identify + "\"的波段序号失败,生成过程终止!"); return(null); } } } TryHandleCustomArguments(subprd.ArgumentProvider, alg); return(subprd); }
private void InitExIdentify() { _exPro = new ExtractProductIdentify(); _exPro.ThemeIdentify = "CMA"; _exPro.ProductIdentify = "DST"; _exPro.SubProductIdentify = "DBLV"; _exAlg = new ExtractAlgorithmIdentify(); _exAlg.Resolution = null; //MonitoringThemeFactory = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); _pro = theme.GetProductDefByIdentify("DST"); _sub = _pro.GetSubProductDefByIdentify("DBLV"); }
//通过实时判识结果获取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 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("能见度计算完成!"); }
private void TrySetProductDicName(ProductDic[] productDics) { ThemeDef def = MonitoringThemeFactory.GetAllThemes()[0];//"CMA" foreach (ProductDic prd in productDics) { MIF.Core.ProductDef prdDef = def.GetProductDefByIdentify(prd.ProductIdentify); if (prdDef != null) { prd.ProductName = prdDef.Name.Replace(" ", ""); } else { prd.ProductName = prd.ProductIdentify; } } }
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 GetPros() { _products.Clear(); MonitoringThemeFactory.MergerTheme(AppDomain.CurrentDomain.BaseDirectory + "\\Themes\\CMAThemes.xml"); _curTheme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); if (_curTheme == null) { return; } ProductDef[] pros = _curTheme.Products; if (pros == null || pros.Length == 0) { return; } foreach (ProductDef pro in pros) { _products.Add(pro.Name, pro.Identify); } }
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 NOAA18海洋_Click(object sender, EventArgs e) { InitExIdentify(); _exAlg.CustomIdentify = "海洋"; _exAlg.Satellite = "NOAA18"; _exAlg.Sensor = "AVHRR"; AlgorithmDef alg = _sub.GetAlgorithmDefByIdentify("NOAA18Sea"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); IRasterDataProvider prd = GetRasterDataProviderNOAA18(); arg.DataProvider = prd; arg.AOI = GetAOI(prd, false); arg.SetArg("NOAA18Sea", alg); SubProductBinaryDst bin = new SubProductBinaryDst(_sub); IPixelIndexMapper result = bin.Make(null) as IPixelIndexMapper; string saveName = @"E:\data\dst\output\3sandNoaa18Sea.png"; CreatBitmap(prd, result.Indexes.ToArray(), saveName); }
private void MODIS陆地_Click(object sender, EventArgs e) { InitExIdentify(); _exAlg.CustomIdentify = "陆地"; _exAlg.Satellite = "EOST"; _exAlg.Sensor = "MODIS"; AlgorithmDef alg = _sub.GetAlgorithmDefByIdentify("EOSLand"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); IRasterDataProvider prd = GetRasterDataProviderMODIS(); arg.DataProvider = prd; arg.AOI = GetAOI(prd, true); arg.SetArg("EOSLand", alg); SubProductBinaryDst bin = new SubProductBinaryDst(_sub); IPixelIndexMapper result = bin.Make(null) as IPixelIndexMapper; string saveName = @"E:\data\dst\output\2sandEOSland.png"; CreatBitmap(prd, result.Indexes.ToArray(), saveName); }
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 button1_Click(object sender, EventArgs e) { //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory; ThemeDef themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); IMonitoringTheme them = new MonitoringThemeCMA(themeDef); IMonitoringProduct fir = them.GetProductByIdentify("FIR"); ExtractProductIdentify prdIdentify = new ExtractProductIdentify(); prdIdentify.ThemeIdentify = "CMA"; prdIdentify.ProductIdentify = "FIR"; prdIdentify.SubProductIdentify = "DBLV"; ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify(); algIdentify.Satellite = "FY3A"; algIdentify.Sensor = "VIRR"; algIdentify.Resolution = null;//not use IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify); IMonitoringSubProduct bin = fir.GetSubProductByIdentify("DBLV"); //arg.SetArg(bin.AlgorithmDefs[0].Indetify, bin.AlgorithmDefs[0]); arg.DataProvider = GetRasterDataProvider(); arg.AOI = GetAOI(); IExtractResult result = bin.Make(null); }
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("判识结束"); }
public static void Register(string fname) { MonitoringThemeFactory.MergerTheme(fname); }
protected override ProductDef GetProductDef() { ProductDef pd = MonitoringThemeFactory.GetProductDef("CMA", "SNW"); return(pd); }
protected override ProductDef GetProductDef() { return(MonitoringThemeFactory.GetProductDef("CMA", "UHE")); }
private void button19_Click(object sender, EventArgs e) { ThemeDef themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); ProductDef prd = themeDef.GetProductDefByIdentify("BAG"); }
private void CreateRibbonBar() { Padding productPadding = new Padding(0, 5, 0, 0); ThemeDef[] ths = MonitoringThemeFactory.GetAllThemes(); Dictionary <string, RadRibbonBarGroup> dic = new Dictionary <string, RadRibbonBarGroup>(); _tempButtons = new List <RadButtonElement>(); foreach (ThemeDef theme in ths) { if (theme == null || theme.Products == null || theme.Products.Length == 0) { continue; } #region 监测专题产品 foreach (ProductDef item in theme.Products) { //这里需要将没加载成功的产品过滤掉。 if (HasProduct(item.Identify)) { RadButtonElement btn = new RadButtonElement(item.Name); btn.Tag = item; btn.ImageAlignment = ContentAlignment.TopCenter; btn.TextAlignment = ContentAlignment.BottomCenter; btn.Padding = productPadding; btn.Click += new EventHandler(btn_Click); if (dic.ContainsKey(item.Group)) { dic[item.Group].Items.Add(btn); } else { dic.Add(item.Group, new RadRibbonBarGroup()); dic[item.Group].Text = item.Group; dic[item.Group].Items.Add(btn); } _tempButtons.Add(btn); } } #endregion 监测专题产品 } //RadRibbonBarGroup rbgUserDef = new RadRibbonBarGroup(); //rbgUserDef.Text = "自定义"; //btnNewProduct.Text = "扩展专题产品"; //btnNewProduct.TextAlignment = ContentAlignment.BottomCenter; //btnNewProduct.Margin = new Padding(0, 5, 0, 0); //btnNewProduct.ImageAlignment = ContentAlignment.TopCenter; //rbgUserDef.Items.Add(btnNewProduct); #region 图像增强方案 _rbgzq = new RadRibbonBarGroup(); _rbgzq.Text = "图像增强方案"; btnSaveEnhance.TextAlignment = ContentAlignment.BottomCenter; btnSaveEnhance.ImageAlignment = ContentAlignment.TopCenter; btnSaveEnhance.Margin = new Padding(0, 5, 0, 0); btnSaveEnhance.Click += new EventHandler(btnSaveEnhance_Click); _rbgzq.Items.Add(btnSaveEnhance); //galItemList.Add(new RadGalleryItem(" 火情\nFY2D_VISSR\n 夏上午")); //galItemList.Add(new RadGalleryItem(" 大雾\nFY2D_VISSR\n 夏下午")); //galItemList.Add(new RadGalleryItem(" 沙尘\nFY2E_VISSR\n 夏上午")); //galItemList.Add(new RadGalleryItem(" 暴雨\nFY2E_VISSR\n 夏下午")); //修改为从文件夹中查找的方式 modify by wangyu 20121020 CreatGalleryElement(null, null); #endregion foreach (RadRibbonBarGroup grp in dic.Values) { _tab.Items.Add(grp); } //_tab.Items.Add(rbgUserDef); _tab.Items.Add(_rbgzq); }
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 }