Пример #1
0
        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);
        }
Пример #2
0
        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");
        }
Пример #3
0
        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("判识结果已永久保存.");
        }
Пример #4
0
        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();
        }
Пример #5
0
        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();
        }
Пример #6
0
        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("判识结束");
        }
Пример #7
0
        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);
        }
Пример #8
0
        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("判识结束");
        }
Пример #9
0
        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
        }