Exemplo n.º 1
0
        /// <summary>
        /// 计算总覆盖度
        /// 总覆盖度=(有蓝藻的像元面积)/(指定区域面积,例如太湖);
        /// </summary>
        /// <returns>覆盖度(0-1)</returns>
        public float StatTotalConvertDegree(IRasterDataProvider dataProvider, int[] aoi)
        {
            int convertedCount = 0;

            bool[]                      convertedPixels = new bool[aoi.Length];
            int                         i       = 0;
            Size                        size    = new Size(dataProvider.Width, dataProvider.Height);
            Rectangle                   rect    = AOIHelper.ComputeAOIRect(aoi, size);
            ArgumentProvider            ap      = new ArgumentProvider(dataProvider, null);
            RasterPixelsVisitor <float> visitor = new RasterPixelsVisitor <float>(ap);

            visitor.VisitPixel(rect, aoi, new int[] { 1 }, (index, values) =>
            {
                if (values[0] >= 0f && values[0] <= 1f)
                {
                    convertedPixels[i] = true;
                    i++;
                }
            });
            foreach (bool isConverted in convertedPixels)
            {
                if (isConverted)
                {
                    convertedCount++;
                }
            }
            return((float)convertedCount / (float)convertedPixels.Length);
        }
Exemplo n.º 2
0
        public void btnGetInfos_Click(object sender, EventArgs e)
        {
            if (_arp != null)
            {
                double lstBandRoom      = (double)_arp.GetArg("lstband_Zoom");
                IRasterDataProvider prd = _arp.DataProvider;
                if (prd == null)
                {
                    return;
                }
                IBandNameRaster bandNameRaster = prd as IBandNameRaster;
                int             lstbandNo      = TryGetBandNo(bandNameRaster, "lstband");
                if (lstbandNo == -1 || lstBandRoom == -1)
                {
                    return;
                }
                ArgumentProvider ap   = new ArgumentProvider(prd, null);
                Size             size = new Size(prd.Width, prd.Height);
                if (_arp.AOIs != null && _arp.AOIs.Length != 0)
                {
                    txtIdenfiy.Text = GetInfoExt(_arp.AOIs);
                }
                Rectangle rect = AOIHelper.ComputeAOIRect(_arp.AOI, size);
                Dictionary <string, Dictionary <string, float> > anlysis = new Dictionary <string, Dictionary <string, float> >();
                InitAnlysisInfo(anlysis);
                int     count         = 0;
                Int16[] cloudValues   = GetNanValues("CloudyValue");
                Int16[] waterValues   = GetNanValues("WaterValue");
                Int16[] invaildValues = GetNanValues("InvailValue");
                using (RasterPixelsVisitor <Int16> visitor = new RasterPixelsVisitor <Int16>(ap))
                {
                    visitor.VisitPixel(rect, _arp.AOI, new int[] { lstbandNo },
                                       (index, values) =>
                    {
                        if (IsNanValue(values[0], cloudValues) || IsNanValue(values[0], waterValues) || IsNanValue(values[0], invaildValues))
                        {
                            return;
                        }
                        AnlysisValues(anlysis, "地表温度", values[0]);
                        count++;
                    });
                }
                anlysis["地表温度"]["avg"] = (float)Math.Round(anlysis["地表温度"]["avg"] / count, 4);
                using (RasterPixelsVisitor <Int16> visitor = new RasterPixelsVisitor <Int16>(ap))
                {
                    visitor.VisitPixel(rect, _arp.AOI, new int[] { lstbandNo },
                                       (index, values) =>
                    {
                        anlysis["地表温度"]["pc"] += (float)Math.Pow(values[0] - anlysis["地表温度"]["avg"], 2);
                    });
                }
                anlysis["地表温度"]["pc"] = (float)Math.Round(Math.Sqrt(anlysis["地表温度"]["pc"]) / count, 4);

                StringBuilder sb = new StringBuilder();
                sb.Append(string.Format("地表温度:\n  最小值:{0}\n  最大值:{1}\n  平均值:{2}\n  偏差值:{3}\n", anlysis["地表温度"]["min"], anlysis["地表温度"]["max"], anlysis["地表温度"]["avg"], anlysis["地表温度"]["pc"]));
                txtInfos.Text = sb.ToString();
            }
        }
Exemplo n.º 3
0
        private IExtractResult FRILAlgorithm()
        {
            int    VisibleCH        = Obj2Int(_argumentProvider.GetArg("Visible"));
            int    NearInfraredCH   = Obj2Int(_argumentProvider.GetArg("NearInfrared"));
            int    MiddleInfraredCH = Obj2Int(_argumentProvider.GetArg("MiddleInfrared"));
            int    FarInfraredCH    = Obj2Int(_argumentProvider.GetArg("FarInfrared"));
            string currRaster       = Obj2String(_argumentProvider.GetArg("CurrentRasterFile"));
            string currDBLV         = Obj2String(_argumentProvider.GetArg("DBLVFile"));

            if (VisibleCH == -1 || FarInfraredCH == -1 || NearInfraredCH == -1 || MiddleInfraredCH == -1)
            {
                PrintInfo("获取波段序号失败,可能是波段映射表配置错误。");
                return(null);
            }
            if (string.IsNullOrEmpty(currRaster) || string.IsNullOrEmpty(currDBLV))
            {
                PrintInfo("获取算法所用文件失败。");
                return(null);
            }

            List <int>        vertifyIndexiex = null;
            IPixelIndexMapper result          = CreataPixelMapper(currDBLV, out vertifyIndexiex);

            if (result == null || result.Indexes.ToArray().Length == 0)
            {
                PrintInfo("当前判识结果中无火点信息。");
                return(null);
            }
            int[] filteredAOI = result.Indexes.ToArray();
            Size  size        = new Size(_argumentProvider.DataProvider.Width, _argumentProvider.DataProvider.Height);
            DoubtFirPixelFilter doubtFilter = CreateArgument.CreateDoubtFilter(_argumentProvider, _contextMessage);

            if (doubtFilter == null)
            {
                return(null);
            }
            Rectangle aoiRect = AOIHelper.ComputeAOIRect(filteredAOI, size);

            //背景温度计算
            PrintInfo("[开始]背景亮温计算...");
            BackTmpComputer backTmpComputer = CreateArgument.CreateBackTmpComputer(_argumentProvider, doubtFilter as IBackTmpComputerHelper, _contextMessage);

            if (backTmpComputer == null)
            {
                return(null);
            }
            aoiRect = AOIHelper.ComputeAOIRect(filteredAOI, size);
            Dictionary <int, PixelFeature> curFeatures = backTmpComputer.Compute(_argumentProvider, aoiRect, filteredAOI);

            VertifyFirPixel(ref curFeatures, vertifyIndexiex, ref result);
            return(GetOtherExtractResult.GetExtractResult(_argumentProvider, curFeatures, result, _contextMessage, _progressTracker));
        }
Exemplo n.º 4
0
        private void button7_Click(object sender, EventArgs e)
        {
            PercentPixelFilterUInt16 u = new PercentPixelFilterUInt16(1, 0.04f, false);
            string fname = @"f:\\FY3A_Mersi_2010_06_24_10_00_1000M_L1B_PRJ_Whole.LDF";
            //fname = @"f:\\FY3A_MERSI_2010_06_24_10_00_1000M_L1B - 副本.HDF";
            IRasterDataProvider prd = GeoDataDriver.Open(fname) as IRasterDataProvider;

            int[]     aoi = null;
            Stopwatch sw  = new Stopwatch();

            sw.Start();
            aoi = u.Filter(prd, AOIHelper.ComputeAOIRect(aoi, new Size(prd.Width, prd.Height)), aoi);
            sw.Stop();
            Text = sw.ElapsedMilliseconds.ToString();
        }
Exemplo n.º 5
0
        private void button8_Click(object sender, EventArgs e)
        {
            string fname = "f:\\4_大昭寺_IMG_GE.tif";
            //fname = "f:\\4600_3400.jpg";
            //fname = "f:\\Penguins.jpg";
            IRasterDataProvider prd = GeoDataDriver.Open(fname) as IRasterDataProvider;

            int[] aoi = null;
            PercentPixelFilterByte u = new PercentPixelFilterByte(1, 0.04f, false);
            Stopwatch sw             = new Stopwatch();

            sw.Start();
            aoi = u.Filter(prd, AOIHelper.ComputeAOIRect(aoi, new Size(prd.Width, prd.Height)), aoi);
            sw.Stop();
            Text = sw.ElapsedMilliseconds.ToString();
        }
Exemplo n.º 6
0
        public void btnGetAOIIndex(object sender, EventArgs e)
        {
            this.AOIIndexs = _arp.AOI;

            //根据选定的AOI区域进行自动计算水体NDVI最小值
            IRasterDataProvider prd = _arp.DataProvider;
            int bandNI            = (int)_arp.GetArg("NearInfrared");
            int bandVI            = (int)_arp.GetArg("Visible");
            ArgumentProvider ap   = new ArgumentProvider(prd, null);
            Size             size = new Size(prd.Width, prd.Height);
            Rectangle        rect = AOIHelper.ComputeAOIRect(this.AOIIndexs, size);

            using (RasterPixelsVisitor <UInt16> visitor = new RasterPixelsVisitor <UInt16>(ap))
            {
                List <double> ndvis = new List <double>();
                visitor.VisitPixel(rect, this.AOIIndexs, new int[] { bandVI, bandNI },
                                   (index, values) =>
                {
                    if (values[1] + values[0] != 0)    //是判断两个值都不等0的意思?
                    {
                        ndvis.Add(Math.Round((float)(values[1] - values[0]) / (values[1] + values[0]), 4));
                    }
                });
                if (ndvis.Count >= 0)
                {
                    //设置界面值
                    float a = float.Parse(txta.Text);
                    float b = float.Parse(txtb.Text);
                    ndvis.Sort();                                    //从小到大排列
                    ndvis.RemoveRange(0, (int)(0.01 * ndvis.Count)); //去除百分之一最小值
                    float avgndvi = (float)ndvis.Min();
                    float MinNDVI = a * avgndvi + b;
                    this.txtNDVI.Text    = avgndvi.ToString();
                    this.txtminndvi.Text = MinNDVI.ToString();
                    this.txtndvimin.Text = MinNDVI.ToString();
                    this.NDVIMultiBar.SetValues(new double[] { this.txtndvimin.Value, this.txtndvimax.Value });
                }
            }
            this.ckbaoi.Checked = false;//重置状态
            //设置完成之后自动生成
            if (_handler != null)
            {
                _handler(GetArgumentValue());
                return;
            }
        }
Exemplo n.º 7
0
        public void btnGetAOIIndex(object sender, EventArgs e)
        {
            this.AOIIndexs = _arp.AOI;

            //根据选定的AOI区域进行自动计算水体近红外反射率最小值
            IRasterDataProvider prd = _arp.DataProvider;
            int bandNI            = (int)_arp.GetArg("NearInfrared");
            ArgumentProvider ap   = new ArgumentProvider(prd, null);
            Size             size = new Size(prd.Width, prd.Height);
            Rectangle        rect = AOIHelper.ComputeAOIRect(this.AOIIndexs, size);

            using (RasterPixelsVisitor <UInt16> visitor = new RasterPixelsVisitor <UInt16>(ap))
            {
                List <double> nears = new List <double>();
                visitor.VisitPixel(rect, this.AOIIndexs, new int[] { bandNI },
                                   (index, values) =>
                {
                    if (values[0] > 0)   //近红外反射率>0
                    {
                        nears.Add(Math.Round(values[0] / 1000f, 4));
                    }
                });
                if (nears.Count >= 0)
                {
                    //设置界面值
                    float pa = float.Parse(txtpa.Text);
                    float pb = float.Parse(txtpb.Text);
                    nears.Sort();                                    //从小到大排列
                    nears.RemoveRange(0, (int)(0.05 * nears.Count)); //去除百分之一最小值
                    float minnear = (float)nears.Min();
                    float MinN    = minnear + (pa + pb) / 10;
                    this.txtNear.Text    = minnear.ToString();
                    this.txtnearmin.Text = MinN.ToString();
                    this.NDVIMultiBar.SetValues(new double[] { MinN });
                }
            }
            this.ckbone.Checked = false;//重置状态
            //设置完成之后自动生成
            if (_handler != null)
            {
                _handler(GetArgumentValue());
                return;
            }
        }
Exemplo n.º 8
0
        internal Dictionary <int, FireAreaFeature> GetFireArea(IArgumentProvider argProvider, IPixelIndexMapper pixelMapper, Dictionary <int, PixelFeature> features)
        {
            RasterIdentify rid  = new RasterIdentify();
            Size           size = new Size(argProvider.DataProvider.Width, argProvider.DataProvider.Height);
            string         iir  = string.Empty;

            using (InterestedRaster <int> result = new InterestedRaster <int>(rid, size, argProvider.DataProvider.CoordEnvelope))
            {
                foreach (int index in pixelMapper.Indexes)
                {
                    result.Put(index, index);
                }
                iir = result.FileName;
            }
            List <int> aoiIndexs = new List <int>();

            foreach (int keys in features.Keys)
            {
                if (features[keys].IsVertified)
                {
                    aoiIndexs.Add(features[keys].PixelIndex);
                }
            }
            int[]                  aoi          = aoiIndexs.ToArray();
            Rectangle              aoiRect      = AOIHelper.ComputeAOIRect(aoi, size);
            IRasterDataProvider    dataProvider = GeoDataDriver.Open(iir) as IRasterDataProvider;
            PixelWndAccessor <int> wndVisitor   = new PixelWndAccessor <int>(dataProvider);

            wndVisitor.Reset(new int[] { 1 }, aoiRect);
            int fAreaNum = -1;
            Dictionary <int, FireAreaFeature> fireAreaFeatures = new Dictionary <int, FireAreaFeature>();

            foreach (int index in aoi)
            {
                if (features[index].FireAreaNum == -1)
                {
                    fAreaNum++;
                    features[index].FireAreaNum = fAreaNum;
                    fireAreaFeatures.Add(fAreaNum, GetFireAreaInfo(features[index], fAreaNum, argProvider.DataProvider));
                    GetFireAreaNum(wndVisitor, index, features, fAreaNum, fireAreaFeatures, argProvider.DataProvider);
                }
            }
            return(fireAreaFeatures);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 计算实际覆盖度
        /// 实际覆盖度=(求和(每像元覆盖度*像元面积))/(指定区域面积,例如太湖)
        /// </summary>
        /// <param name="dataProvider"></param>
        /// <param name="aoi"></param>
        /// <returns></returns>
        public float CalcActualConvertDegree(IRasterDataProvider dataProvider, int[] aoi)
        {
            double                      actualArea = 0;
            double                      totalArea  = aoi.Count() * dataProvider.ResolutionX;
            Size                        size       = new Size(dataProvider.Width, dataProvider.Height);
            Rectangle                   rect       = AOIHelper.ComputeAOIRect(aoi, size);
            ArgumentProvider            ap         = new ArgumentProvider(dataProvider, null);
            RasterPixelsVisitor <float> visitor    = new RasterPixelsVisitor <float>(ap);

            //solution 使用横向?
            visitor.VisitPixel(rect, aoi, new int[] { 1 }, (index, values) =>
            {
                if (values[0] <= 1f && values[0] >= 0f)
                {
                    actualArea += values[0] * dataProvider.ResolutionX;
                }
            });
            return((float)(actualArea / totalArea));
        }
Exemplo n.º 10
0
        public Feature Export(Envelope geoEnvelope, Size size, int[] aoi)
        {
            Dictionary <int, AOIHelper.AOIRowRange> rowRanges = AOIHelper.ComputeRowIndexRange(aoi, size);

            if (rowRanges == null || rowRanges.Count == 0)
            {
                return(null);
            }
            int               bCol = 0, eCol = 0;
            int               width = size.Width;
            double            top = geoEnvelope.MaxY;
            double            ySpan = geoEnvelope.Height / size.Height;
            double            left = geoEnvelope.MinX;
            double            xSpan = geoEnvelope.Width / size.Width;
            List <ShapePoint> leftPoints = new List <ShapePoint>();
            List <ShapePoint> retPoints = new List <ShapePoint>();
            Rectangle         aoiRect = AOIHelper.ComputeAOIRect(aoi, size);
            double            x = 0, y = 0;
            int               iRow = 0;

            foreach (int row in rowRanges.Keys)
            {
                bCol = aoi[rowRanges[row].BeginIndex] % width;
                eCol = aoi[rowRanges[row].EndIndex - 1] % width;
                x    = left + bCol * xSpan;
                y    = top - row * ySpan;
                leftPoints.Add(new ShapePoint(x, y));
                x = left + eCol * xSpan;
                retPoints.Add(new ShapePoint(x, y)); //right point
                iRow++;
            }
            leftPoints.Reverse();
            retPoints.AddRange(leftPoints);
            //
            ShapePolygon ply = new ShapePolygon(new ShapeRing[] { new ShapeRing(retPoints.ToArray()) });
            Feature      fet = new Feature(0, ply, new string[] { "NAME" }, new string[] { "AOI" }, null);

            return(fet);
        }
        /// <summary>
        /// 计算指定等级的总实际覆盖面积
        /// 比较条件为:minConvertDegree< x && x<=  maxConvertDegree
        /// </summary>
        /// <param name="dataProvider">像元覆盖度文件DataProvider</param>
        /// <param name="minConvertDegree"></param>
        /// <param name="maxConvertDegree"></param>
        /// <returns></returns>
        public double CalcActualConvertArea(IRasterDataProvider dataProvider, int[] aoi, float minConvertDegree, float maxConvertDegree)
        {
            if (dataProvider == null || minConvertDegree > maxConvertDegree)
            {
                return(0);
            }
            double                      convertArea = 0;
            double                      pixelArea   = BAGStatisticHelper.CalPixelArea(dataProvider.ResolutionX);
            ArgumentProvider            ap          = new ArgumentProvider(dataProvider, null);
            Size                        size        = new Size(dataProvider.Width, dataProvider.Height);
            Rectangle                   rect        = AOIHelper.ComputeAOIRect(aoi, size);
            RasterPixelsVisitor <float> visitor     = new RasterPixelsVisitor <float>(ap);

            visitor.VisitPixel(rect, aoi, new int[] { 1 },
                               (index, values) =>
            {
                if (values[0] <= maxConvertDegree && values[0] > minConvertDegree)
                {
                    convertArea += (pixelArea * values[0]);
                }
            });
            return(convertArea);
        }
Exemplo n.º 12
0
        private IPixelIndexMapper CalcBackTmp(IPixelIndexMapper result)
        {
            int[] filteredAOI = result.Indexes.ToArray();
            if (filteredAOI == null || filteredAOI.Length == 0)
            {
                return(result);
            }
            int[] firePoints = GetPreExtractIndex();

            Size size = new Size(_argumentProvider.DataProvider.Width, _argumentProvider.DataProvider.Height);
            DoubtFirPixelFilter doubtFilter = CreateArgument.CreateDoubtFilter(_argumentProvider, _contextMessage);

            if (doubtFilter == null)
            {
                return(result);
            }

            filteredAOI = MergeFirePoints(result, firePoints, filteredAOI);
            Rectangle aoiRect = AOIHelper.ComputeAOIRect(filteredAOI, size);

            //背景温度计算
            PrintInfo("[开始]背景亮温计算...");
            BackTmpComputer backTmpComputer = CreateArgument.CreateBackTmpComputer(_argumentProvider, doubtFilter as IBackTmpComputerHelper, _contextMessage);

            if (backTmpComputer == null)
            {
                return(null);
            }
            aoiRect      = AOIHelper.ComputeAOIRect(filteredAOI, size);
            _curFeatures = backTmpComputer.ComputeNight(_argumentProvider, aoiRect, filteredAOI);
            VertifyFirPixel(ref _curFeatures);
            if (_curFeatures.Count != 0)
            {
                GetFirePointIndeiex.WriteFireIndexiexFilename(_argumentProvider, _curFeatures.Keys.ToArray());
            }
            return(result);
        }
Exemplo n.º 13
0
        private void DoFilters(IArgumentProvider argProvider, out Dictionary <int, PixelFeature> features, Action <int, string> progressTracker)
        {
            features = null;
            ICandidatePixelFilter filter = null;

            int[]     aoi     = argProvider.AOI;
            Size      size    = new Size(argProvider.DataProvider.Width, argProvider.DataProvider.Height);
            Rectangle aoiRect = AOIHelper.ComputeAOIRect(aoi, size);

            int[] filteredAOI = null;
            if (progressTracker != null)
            {
                progressTracker.Invoke(5, "正在过滤高温象元,请稍候...");
            }
            //4% 高温像元(中红外通道)
            CreateArgument.PrintInfo(_contextMessage, "[开始]x%高温像元过滤...");
            filter = CreateArgument.CreateHighTmpXPercentFilter(argProvider, _contextMessage);
            if (filter == null)
            {
                return;
            }
            filteredAOI = filter.Filter(argProvider.DataProvider, aoiRect, aoi);
            //by chennan 20130402 感兴趣内计算
            UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
            if (filteredAOI != null)
            {
                _waitingFirPixels.Put(filteredAOI);
                CreateArgument.PrintInfo(_contextMessage, "     x%高温点个数:" + filteredAOI.Length.ToString());
            }
            CreateArgument.PrintInfo(_contextMessage, "[完成]x%高温像元过滤。");
            if (progressTracker != null)
            {
                progressTracker.Invoke(10, "正在提取陆地高温点,请稍候...");
            }
            //陆地高温点判识
            CreateArgument.PrintInfo(_contextMessage, "[开始]陆地高温点过滤...");
            filter = CreateArgument.CreateLandHighTmpFilter(argProvider, _contextMessage);
            //by chennan 20130402 感兴趣内计算
            UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
            if (filter != null)
            {
                aoiRect     = AOIHelper.ComputeAOIRect(filteredAOI, size);
                filteredAOI = filter.Filter(argProvider.DataProvider, aoiRect, filteredAOI);
                if (filteredAOI != null)
                {
                    _candidateFirPixels.Put(filteredAOI);
                    _waitingFirPixels.Remove(filteredAOI);
                    CreateArgument.PrintInfo(_contextMessage, "     陆地高温点个数:" + filteredAOI.Length.ToString() + ",候选像元个数:" + _candidateFirPixels.Indexes.Count().ToString());
                }
            }
            CreateArgument.PrintInfo(_contextMessage, "[完成]陆地高温点过滤。");
            if (progressTracker != null)
            {
                progressTracker.Invoke(20, "正在提取异常高温点,请稍候...");
            }
            //异常高温点判识
            CreateArgument.PrintInfo(_contextMessage, "[开始]邻域内异常高温点过滤...");
            filter = CreateArgument.CreateAbnormalHighTmpFile(argProvider, _contextMessage);
            //by chennan 20130402 感兴趣内计算
            UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
            if (filter != null)
            {
                filteredAOI = _waitingFirPixels.Indexes.ToArray();
                aoiRect     = AOIHelper.ComputeAOIRect(filteredAOI, size);
                filteredAOI = filter.Filter(argProvider.DataProvider, aoiRect, filteredAOI);
                //by chennan 20130402 感兴趣内计算
                UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
                if (filteredAOI != null)
                {
                    _candidateFirPixels.Put(filteredAOI);
                    _waitingFirPixels.Remove(filteredAOI);
                    CreateArgument.PrintInfo(_contextMessage, "     异常高温点个数:" + filteredAOI.Length.ToString() + ",候选像元个数:" + _candidateFirPixels.Indexes.Count().ToString());
                }
            }
            CreateArgument.PrintInfo(_contextMessage, "[完成]邻域内异常高温点过滤。");
            if (progressTracker != null)
            {
                progressTracker.Invoke(30, "正在提取疑似高温点,请稍候...");
            }
            //疑似火点判识
            CreateArgument.PrintInfo(_contextMessage, "[开始]疑似火点判识...");
            DoubtFirPixelFilter doubtFilter = CreateArgument.CreateDoubtFilter(argProvider, _contextMessage);

            if (doubtFilter == null)
            {
                return;
            }
            filteredAOI = _candidateFirPixels.Indexes.ToArray();
            aoiRect     = AOIHelper.ComputeAOIRect(filteredAOI, size);
            filteredAOI = doubtFilter.Filter(argProvider, aoiRect, filteredAOI);
            //by chennan 20130402 感兴趣内计算
            UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
            if (filteredAOI == null)
            {
                CreateArgument.PrintInfo(_contextMessage, "     没有监测出疑似火点");
                _candidateFirPixels.Reset();
                return;
            }
            _candidateFirPixels.Reset();
            _candidateFirPixels.Put(filteredAOI);
            CreateArgument.PrintInfo(_contextMessage, "[完成]疑似火点判识。");
            CreateArgument.PrintInfo(_contextMessage, "     监测出疑似火点:" + filteredAOI.Length.ToString());
            if (progressTracker != null)
            {
                progressTracker.Invoke(50, "正在计算背景温度,请稍候...");
            }
            //背景温度计算
            CreateArgument.PrintInfo(_contextMessage, "[开始]背景亮温计算...");
            BackTmpComputer backTmpComputer = CreateArgument.CreateBackTmpComputer(argProvider, doubtFilter as IBackTmpComputerHelper, _contextMessage);

            if (backTmpComputer == null)
            {
                return;
            }
            aoiRect  = AOIHelper.ComputeAOIRect(filteredAOI, size);
            features = backTmpComputer.Compute(argProvider, aoiRect, filteredAOI);
            //记录火点特征集合
            _candidateFirPixels.Tag = new FirFeatureCollection("火点像元特征", features);
            CreateArgument.PrintInfo(_contextMessage, "     为" + features.Count.ToString() + "个疑似火点计算了背景亮温");
            CreateArgument.PrintInfo(_contextMessage, "[完成]背景亮温计算。");
            if (progressTracker != null)
            {
                progressTracker.Invoke(70, "正在进行火点确认,请稍候...");
            }
            //火点确认
            CreateArgument.PrintInfo(_contextMessage, "[开始]火点确认...");
            VertifyFirPixelFiter vertifyFilter = CreateArgument.CreateVertifyFilter(argProvider, _contextMessage);

            if (vertifyFilter == null)
            {
                return;
            }
            filteredAOI = vertifyFilter.Filter(argProvider, features);
            _candidateFirPixels.Reset();
            if (filteredAOI != null && filteredAOI.Length > 0)
            {
                _candidateFirPixels.Put(filteredAOI);
                CreateArgument.PrintInfo(_contextMessage, "     确认火点数:" + filteredAOI.Length.ToString());
                GetFirePointIndeiex.WriteFireIndexiexFilename(argProvider, features.Keys.ToArray());
            }
            CreateArgument.PrintInfo(_contextMessage, "[完成]火点确认。");
        }
Exemplo n.º 14
0
 public int[] Filter(IArgumentProvider argProvider, Dictionary <int, PixelFeature> features)
 {
     using (IRasterPixelsVisitor <UInt16> vistor = new RasterPixelsVisitor <UInt16>(argProvider))
     {
         int[] bandNos = new int[] { _visibleBandNo, _midInfraredBandNo, _farInfraredBandNo };
         _visibleBandIndex     = 0;
         _midInfraredBandIndex = 1;
         _farInfraredBandIndex = 2;
         //
         int[] aoi = GetAOI(features, (fet) => { return(fet.IsDoubtFirPixel); });
         if (aoi == null)
         {
             return(null);
         }
         Rectangle aoiRect = AOIHelper.ComputeAOIRect(aoi, new System.Drawing.Size(argProvider.DataProvider.Width, argProvider.DataProvider.Height));
         vistor.VisitPixel(aoiRect, aoi, bandNos, (idx, values) =>
         {
             float pvFarIfr        = values[_farInfraredBandIndex] / _bandZoom;
             float pvMidIfr        = values[_midInfraredBandIndex] / _bandZoom;
             float pvVis           = values[_visibleBandIndex] / _bandZoom;
             float pvMidIfr_FarIfr = values[_midInfraredBandIndex] - values[_farInfraredBandIndex];
             //by chennan 20120821 一期火点确认错误代码
             if (pvFarIfr < _maxFarIfrValue_fir || pvVis > _minVisValue_fir)
             {
                 return;
             }
             PixelFeature fet = features[idx];
             if (pvMidIfr > _secondMidIfrValue_fir)
             {
                 //if (pvMidIfr > fet.MidIfrAvgValue + fet.MidIfr_StdDev)
                 if (pvMidIfr > fet.MidIfrAvgValue + _backTmpFactor_fir * fet.MidIfr_StdDev)
                 {
                     fet.IsVertified = true;
                 }
             }
             else
             {
                 if (
                     (pvMidIfr > fet.MidIfrAvgValue + _backTmpFactor_fir * fet.MidIfr_StdDev)
                     &&
                     (pvMidIfr_FarIfr > fet.MidIfr_FarIfr_Diff_AvgValue + _backTmpFactor_fir * fet.MidIfr_FarIfr_Diff_StdDev)
                     )
                 {
                     fet.IsVertified = true;
                 }
             }
             //by chennan 20120821 增加中红外偏移量与远红外偏移量比值火点确认条件
             if (fet.IsVertified == true && _isUsedMidFar)
             {
                 float bzCH4 = (pvFarIfr - fet.FarIfrAvgValue);
                 if (bzCH4 <= 0)
                 {
                     bzCH4 = _defaultPercent;
                 }
                 //bzCH4 = 0.2f;
                 if ((pvMidIfr - fet.MidIfrAvgValue) / bzCH4 < _midFarRatio)
                 {
                     fet.IsVertified = false;
                     return;
                 }
             }
         });
     }
     return(GetAOI(features, (fet) => { return fet.IsVertified; }));
 }
Exemplo n.º 15
0
        public void btnGetInfos_Click(object sender, EventArgs e)
        {
            if (_arp != null)
            {
                double visiBandRoom      = (double)_arp.GetArg("Visible_Zoom");
                double niBandRoom        = (double)_arp.GetArg("NearInfrared_Zoom");
                double shortInfraredRoom = (double)_arp.GetArg("ShortInfrared_Zoom");
                IRasterDataProvider prd  = _arp.DataProvider;
                if (prd == null)
                {
                    return;
                }
                IBandNameRaster bandNameRaster      = prd as IBandNameRaster;
                int             visiBandNo          = TryGetBandNo(bandNameRaster, "Visible");
                int             niBandNo            = TryGetBandNo(bandNameRaster, "NearInfrared");
                int             shortInfraredBandNo = TryGetBandNo(bandNameRaster, "ShortInfrared");
                if (visiBandNo == -1 || niBandNo == -1 || shortInfraredBandNo == -1 || shortInfraredRoom == -1 || visiBandRoom == -1 || niBandRoom == -1)
                {
                    return;
                }
                ArgumentProvider ap   = new ArgumentProvider(prd, null);
                Size             size = new Size(prd.Width, prd.Height);
                if (_arp.AOIs != null && _arp.AOIs.Length != 0)
                {
                    cmbType.Text = GetInfoExt(_arp.AOIs);
                }
                Rectangle rect = AOIHelper.ComputeAOIRect(_arp.AOI, size);
                Dictionary <string, Dictionary <string, float> > anlysis = new Dictionary <string, Dictionary <string, float> >();
                InitAnlysisInfo(anlysis);
                int count     = 0;
                int ndviCount = 0;
                using (RasterPixelsVisitor <UInt16> visitor = new RasterPixelsVisitor <UInt16>(ap))
                {
                    visitor.VisitPixel(rect, _arp.AOI, new int[] { visiBandNo, niBandNo, shortInfraredBandNo },
                                       (index, values) =>
                    {
                        AnlysisValues(anlysis, "可见光", values[0]);
                        AnlysisValues(anlysis, "近红外", values[1]);
                        AnlysisValues(anlysis, "短波红外", values[2]);
                        if (values[1] + values[0] != 0)
                        {
                            AnlysisValues(anlysis, "NDVI", (float)Math.Round((float)(values[1] - values[0]) / (values[1] + values[0]), 4));
                            ndviCount++;
                        }
                        count++;
                    });
                }
                anlysis["可见光"]["avg"]  = (float)Math.Round(anlysis["可见光"]["avg"] / count, 4);
                anlysis["近红外"]["avg"]  = (float)Math.Round(anlysis["近红外"]["avg"] / count, 4);
                anlysis["短波红外"]["avg"] = (float)Math.Round(anlysis["短波红外"]["avg"] / ndviCount, 4);
                anlysis["NDVI"]["avg"] = (float)Math.Round(anlysis["NDVI"]["avg"] / ndviCount, 4);
                using (RasterPixelsVisitor <UInt16> visitor = new RasterPixelsVisitor <UInt16>(ap))
                {
                    visitor.VisitPixel(rect, _arp.AOI, new int[] { visiBandNo, niBandNo, shortInfraredBandNo },
                                       (index, values) =>
                    {
                        anlysis["可见光"]["pc"]  += (float)Math.Pow(values[0] - anlysis["可见光"]["avg"], 2);
                        anlysis["近红外"]["pc"]  += (float)Math.Pow(values[1] - anlysis["近红外"]["avg"], 2);
                        anlysis["短波红外"]["pc"] += (float)Math.Pow(values[2] - anlysis["短波红外"]["avg"], 2);
                        if (values[1] + values[0] != 0)
                        {
                            anlysis["NDVI"]["pc"] += (float)Math.Pow((float)(values[1] - values[0]) / (values[1] + values[0]) - anlysis["NDVI"]["avg"], 2);
                        }
                    });
                }
                anlysis["可见光"]["pc"]  = (float)Math.Round(Math.Sqrt(anlysis["可见光"]["pc"]) / count, 4);
                anlysis["近红外"]["pc"]  = (float)Math.Round(Math.Sqrt(anlysis["近红外"]["pc"]) / count, 4);
                anlysis["短波红外"]["pc"] = (float)Math.Round(Math.Sqrt(anlysis["短波红外"]["pc"]) / count, 4);
                anlysis["NDVI"]["pc"] = (float)Math.Round(Math.Sqrt(anlysis["NDVI"]["pc"]) / ndviCount, 4);

                StringBuilder sb = new StringBuilder();
                sb.Append(string.Format("可见光:\n  最小值:{0}\n  最大值:{1}\n  平均值:{2}\n  偏差值:{3}\n", anlysis["可见光"]["min"], anlysis["可见光"]["max"], anlysis["可见光"]["avg"], anlysis["可见光"]["pc"]));
                sb.Append(string.Format("近红外:\n  最小值:{0}\n  最大值:{1}\n  平均值:{2}\n  偏差值:{3}\n", anlysis["近红外"]["min"], anlysis["近红外"]["max"], anlysis["近红外"]["avg"], anlysis["近红外"]["pc"]));
                sb.Append(string.Format("NDVI:\n  最小值:{0}\n  最大值:{1}\n  平均值:{2}\n  偏差值:{3}\n", anlysis["NDVI"]["min"], anlysis["NDVI"]["max"], anlysis["NDVI"]["avg"], anlysis["NDVI"]["pc"]));
                sb.Append(string.Format("短波红外:\n  最小值:{0}\n  最大值:{1}\n  平均值:{2}\n  偏差值:{3}\n", anlysis["短波红外"]["min"], anlysis["短波红外"]["max"], anlysis["短波红外"]["avg"], anlysis["短波红外"]["pc"]));
                txtInfos.Text = sb.ToString();

                InitWriteTxt(anlysis);
            }
        }
Exemplo n.º 16
0
        private IExtractResult ExtractLST()
        {
            float           curNDVI           = 0f;
            IBandNameRaster bandNameRaster    = _argumentProvider.DataProvider as IBandNameRaster; //
            int             VisibleCH         = TryGetBandNo(bandNameRaster, "Visible");           //(int)_argumentProvider.GetArg("Visible");
            int             NearInfraredCH    = TryGetBandNo(bandNameRaster, "NearInfrared");      //(int)_argumentProvider.GetArg("NearInfrared");
            int             MiddInfraredCH    = TryGetBandNo(bandNameRaster, "MiddInfrared");      //(int)_argumentProvider.GetArg("MiddInfrared");
            int             FarInfrared11CH   = TryGetBandNo(bandNameRaster, "FarInfrared11");     //(int)_argumentProvider.GetArg("FarInfrared11");
            int             FarInfrared12CH   = TryGetBandNo(bandNameRaster, "FarInfrared12");     //(int)_argumentProvider.GetArg("FarInfrared12");
            double          VisibleZoom       = (double)_argumentProvider.GetArg("Visible_Zoom");
            double          NearInfraredZoom  = (double)_argumentProvider.GetArg("NearInfrared_Zoom");
            double          MiddInfraredZoom  = (double)_argumentProvider.GetArg("MiddInfrared_Zoom");
            double          FarInfrared11Zoom = (double)_argumentProvider.GetArg("FarInfrared11_Zoom");
            double          FarInfrared12Zoom = (double)_argumentProvider.GetArg("FarInfrared12_Zoom");

            if (VisibleCH == -1 || NearInfraredCH == -1 || MiddInfraredCH == -1 || FarInfrared11CH == -1 || FarInfrared12CH == -1)
            {
                PrintInfo("获取波段序号失败,可能是波段映射表配置错误或判识算法波段参数配置错误。");
                return(null);
            }
            IRasterDataProvider currPrd = _argumentProvider.DataProvider;

            if (currPrd == null)
            {
                PrintInfo("计算城市热岛的主文件未提供,请检查!");
                return(null);
            }
            bool   useCLMFile    = true;
            string clmRasterFile = _argumentProvider.GetArg("clmFile").ToString();

            if (string.IsNullOrEmpty(clmRasterFile) || !File.Exists(clmRasterFile))
            {
                useCLMFile = false;
            }
            double lstZoom   = (double)_argumentProvider.GetArg("LSTZoom");
            UInt16 defCloudy = (UInt16)_argumentProvider.GetArg("defCloudy");
            UInt16 defWater  = (UInt16)_argumentProvider.GetArg("defWater");

            float a0    = (float)_argumentProvider.GetArg("A0");
            float alfa  = (float)_argumentProvider.GetArg("alfa");
            float beta  = (float)_argumentProvider.GetArg("beta");
            float gama  = (float)_argumentProvider.GetArg("gama");
            float alfa2 = (float)_argumentProvider.GetArg("alfa2");
            float beta2 = (float)_argumentProvider.GetArg("beta2");

            float b4m = (float)_argumentProvider.GetArg("b4m");
            float b4n = (float)_argumentProvider.GetArg("b4n");
            float b5m = (float)_argumentProvider.GetArg("b5m");
            float b5n = (float)_argumentProvider.GetArg("b5n");

            float b4Water = (float)_argumentProvider.GetArg("b4Water");
            float b5Water = (float)_argumentProvider.GetArg("b5Water");
            float b4Soil  = (float)_argumentProvider.GetArg("b4Soil");
            float b5Soil  = (float)_argumentProvider.GetArg("b5Soil");
            float b4VGT   = (float)_argumentProvider.GetArg("b4VGT");
            float b5VGT   = (float)_argumentProvider.GetArg("b5VGT");

            float NearInfraredCLMMin    = (float)_argumentProvider.GetArg("NearInfraredCLMMin");
            float FarInfrared11CLMMax   = (float)_argumentProvider.GetArg("FarInfrared11CLMMax");
            float FarInfrared1112CLMMin = (float)_argumentProvider.GetArg("FarInfrared1112CLMMin");
            float FarInfrared11WaterMin = (float)_argumentProvider.GetArg("FarInfrared11WaterMin");
            float NDVIWaterMax          = (float)_argumentProvider.GetArg("NDVIWaterMax");

            ArgumentProvider             ap        = new ArgumentProvider(currPrd, null);
            RasterPixelsVisitor <UInt16> rpVisitor = new RasterPixelsVisitor <UInt16>(ap);
            float  b4Emiss = 0;
            float  b5Emiss = 0;
            double pv      = 0;
            //4 5 通道比辐射率均值 差值
            float EmissMean  = 0;
            float DeltaEmiss = 0;
            //LST计算系数 P M
            double P = 0;
            double M = 0;

            int[] bands = new int[] { VisibleCH, NearInfraredCH, MiddInfraredCH, FarInfrared11CH, FarInfrared12CH };
            for (int i = 0; i < bands.Length; i++)
            {
                if (bands[i] > currPrd.BandCount)
                {
                    PrintInfo("波段序号超过数据的波段范围,可能是影像数据选择不正确。");
                    return(null);
                }
            }

            int[]     aoi     = _argumentProvider.AOI;
            Size      size    = new Size(currPrd.Width, currPrd.Height);
            Rectangle aoiRect = AOIHelper.ComputeAOIRect(aoi, size);

            MemPixelFeatureMapper <UInt16> result = new MemPixelFeatureMapper <UInt16>("0LST", 1000, size, currPrd.CoordEnvelope, currPrd.SpatialRef);

            rpVisitor.VisitPixel(aoiRect, aoi, bands,
                                 (index, values) =>
            {
                if (values[0] == 0)
                {
                    result.Put(index, 0);
                }
                else if (values[1] / NearInfraredZoom > NearInfraredCLMMin && values[3] / FarInfrared11Zoom <FarInfrared11CLMMax && Math.Abs(values[2] / MiddInfraredZoom - values[3] / FarInfrared11Zoom)> FarInfrared1112CLMMin)
                {
                    result.Put(index, defCloudy);
                }
                else
                {
                    curNDVI = GetNDVI(values, 1, 0);
                    if (values[3] / FarInfrared11Zoom > FarInfrared11WaterMin && curNDVI < NDVIWaterMax)
                    {
                        result.Put(index, defWater);
                        b4Emiss = b4Water;
                        b5Emiss = b5Water;
                    }
                    else
                    {
                        if (curNDVI < 0.2)
                        {
                            b4Emiss = b4Soil;
                            b5Emiss = b5Soil;
                        }
                        else if (curNDVI > 0.5)
                        {
                            b4Emiss = b4VGT;
                            b5Emiss = b5VGT;
                        }
                        else if (curNDVI >= 0.2 && curNDVI <= 0.5)
                        {
                            pv      = Math.Pow((curNDVI - 0.2) / (0.5 - 0.2), 2);
                            b4Emiss = (float)(b4m * pv + b4n);
                            b5Emiss = (float)(b5m * pv + b5n);
                        }

                        EmissMean  = (b4Emiss + b5Emiss) / 2;
                        DeltaEmiss = (b4Emiss - b5Emiss);

                        P = 1 + alfa * (1 - EmissMean) / EmissMean + beta * DeltaEmiss / Math.Pow(EmissMean, 2);
                        M = gama + alfa2 * (1 - EmissMean) / EmissMean + beta2 * DeltaEmiss / Math.Pow(EmissMean, 2);

                        result.Put(index, (UInt16)((a0 + P * (values[3] / FarInfrared11Zoom + values[4] / FarInfrared12Zoom) / 2
                                                    + M * (values[3] / FarInfrared11Zoom - values[4] / FarInfrared12Zoom) / 2) * lstZoom));
                    }
                }
            });
            return(GenrateIInterested(result, currPrd));
        }
Exemplo n.º 17
0
        private IExtractResult CompareSHPFile(string backWaterPath, string binWater)
        {
            string shpPrimaryField = null;

            Feature[] features = GetFeatures(backWaterPath, out shpPrimaryField);
            if (features == null || features.Length == 0)
            {
                return(null);
            }
            //矢量栅格化
            Dictionary <string, Color>  nameColors = new Dictionary <string, Color>();
            IRasterDataProvider         dataPrd    = GeoDataDriver.Open(binWater) as IRasterDataProvider;
            IPixelFeatureMapper <Int16> result     = new MemPixelFeatureMapper <Int16>("FLOD", 1000, new Size(dataPrd.Width, dataPrd.Height), dataPrd.CoordEnvelope, dataPrd.SpatialRef);

            using (Bitmap bitmap = VectorsToBitmap(dataPrd, features, shpPrimaryField, out nameColors))
            {
                int[]      aoi;
                Color      color;
                string     name;
                List <int> items = new List <int>();
                foreach (Feature fea in features)
                {
                    name = fea.GetFieldValue(shpPrimaryField);
                    if (String.IsNullOrEmpty(name))
                    {
                        continue;
                    }
                    color = nameColors[name];
                    aoi   = GetAOIByFeature(bitmap, color);
                    if (aoi != null)
                    {
                        items.AddRange(aoi);
                    }
                }
                //分情况处理
                //无aoi区域
                if (items.Count == 0)
                {
                    ArgumentProvider            ap        = new ArgumentProvider(dataPrd, null);
                    RasterPixelsVisitor <Int16> rpVisitor = new RasterPixelsVisitor <Int16>(ap);
                    rpVisitor.VisitPixel(new int[] { 1 },
                                         (idx, values) =>
                    {
                        if (values[0] == 1)
                        {
                            result.Put(idx, 1);
                        }
                    });
                }
                //有aoi区域
                else
                {
                    ArgumentProvider            ap        = new ArgumentProvider(dataPrd, null);
                    RasterPixelsVisitor <Int16> rpVisitor = new RasterPixelsVisitor <Int16>(ap);
                    rpVisitor.VisitPixel(new int[] { 1 },
                                         (idx, values) =>
                    {
                        if (values[0] == 1)
                        {
                            result.Put(idx, 4);
                        }
                    });
                    Size      size    = new Size(dataPrd.Width, dataPrd.Height);
                    Rectangle aoiRect = AOIHelper.ComputeAOIRect(items.ToArray(), size);
                    rpVisitor.VisitPixel(aoiRect, items.ToArray(), new int[] { 1 },
                                         (idx, values) =>
                    {
                        if (values[0] == 1)
                        {
                            result.Put(idx, 1);
                        }
                        else if (values[0] == 0)
                        {
                            result.Put(idx, 5);
                        }
                    });
                }
            }
            return(result);
        }
Exemplo n.º 18
0
        private void GetDBLVAOIIndex(string dblvFile, string cloudFile, List <int> dblvAOI)
        {
            Dictionary <string, FilePrdMap> filePrdMap = new Dictionary <string, FilePrdMap>();

            filePrdMap.Add("dblvFile", new FilePrdMap(dblvFile, 1, new VaildPra(float.MinValue, float.MaxValue), new int[] { 1 }));
            filePrdMap.Add("cloudFile", new FilePrdMap(cloudFile, 1, new VaildPra(float.MinValue, float.MaxValue), new int[] { 1 }));
            ITryCreateVirtualPrd       tryVPrd = new TryCreateVirtualPrdByMultiFile();
            IVirtualRasterDataProvider vrd = tryVPrd.CreateVirtualRasterPRD(ref filePrdMap);
            int minWnd = 3, maxWnd = 3;

            if (vrd == null)
            {
                if (filePrdMap != null && filePrdMap.Count > 0)
                {
                    foreach (FilePrdMap value in filePrdMap.Values)
                    {
                        if (value.Prd != null)
                        {
                            value.Prd.Dispose();
                        }
                    }
                }
                return;
            }
            try
            {
                List <int> temp = new List <int>();
                temp.AddRange(dblvAOI);
                dblvAOI.Clear();
                ArgumentProvider ap   = new ArgumentProvider(vrd, null);
                Size             size = new Size(vrd.Width, vrd.Height);
                int       dblvBand    = filePrdMap["dblvFile"].StartBand;
                int       cloudBand   = filePrdMap["cloudFile"].StartBand;
                int[]     tempAOI     = temp.ToArray();
                Rectangle aoiRect     = AOIHelper.ComputeAOIRect(tempAOI, size);
                int[]     wndBandNos  = new int[] { dblvBand, cloudBand };
                bool      isCloudEgde = false;
                using (IRasterPixelsVisitor <float> visitor = new RasterPixelsVisitor <float>(ap))
                {
                    visitor.VisitPixelWnd(aoiRect, tempAOI, wndBandNos, wndBandNos, minWnd, maxWnd,
                                          (pixelIdx, crtWndSize, bandValues, wndValues) =>
                    {
                        return(false);
                    },
                                          (pixelIdx, crtWndSize, bandValues, wndValues) =>
                    {
                        isCloudEgde = IsCloudEdgeMethod(bandValues, wndValues, 1);
                        if (isCloudEgde)
                        {
                            temp.Remove(pixelIdx);
                        }
                    });
                }
                dblvAOI.AddRange(temp);
                temp = null;
            }
            finally
            {
                if (vrd != null)
                {
                    vrd.Dispose();
                }
            }
        }
Exemplo n.º 19
0
        private IExtractResult CalcMix(string dblvFile, string ldfFile, double bandZoom, int bandNo, double resultZoom, int[] dblvAOI, float waterNir, float LandNir, double zoom)
        {
            Dictionary <string, FilePrdMap> filePrdMap = new Dictionary <string, FilePrdMap>();

            filePrdMap.Add("dblvFile", new FilePrdMap(dblvFile, 1, new VaildPra(float.MinValue, float.MaxValue), new int[] { 1 }));
            filePrdMap.Add("ldfFile", new FilePrdMap(ldfFile, bandZoom, new VaildPra(float.MinValue, float.MaxValue), new int[] { bandNo }));
            ITryCreateVirtualPrd       tryVPrd = new TryCreateVirtualPrdByMultiFile();
            IVirtualRasterDataProvider vrd = tryVPrd.CreateVirtualRasterPRD(ref filePrdMap);
            int minWnd = 3, maxWnd = 3;

            if (vrd == null)
            {
                if (filePrdMap != null && filePrdMap.Count > 0)
                {
                    foreach (FilePrdMap value in filePrdMap.Values)
                    {
                        if (value.Prd != null)
                        {
                            value.Prd.Dispose();
                        }
                    }
                }
                return(null);
            }
            try
            {
                ArgumentProvider            ap        = new ArgumentProvider(vrd, null);
                RasterPixelsVisitor <float> rpVisitor = new RasterPixelsVisitor <float>(ap);
                Size size = new Size(vrd.Width, vrd.Height);
                MemPixelFeatureMapper <Int16> result = new MemPixelFeatureMapper <Int16>("0MIX", 1000, size, vrd.CoordEnvelope, vrd.SpatialRef);
                int       dblvBand   = filePrdMap["dblvFile"].StartBand;
                int       ldfBand    = filePrdMap["ldfFile"].StartBand;
                int[]     wndBandNos = new int[] { dblvBand, ldfBand };
                Rectangle aoiRect    = AOIHelper.ComputeAOIRect(dblvAOI, size);
                bool      isEdge     = false;
                using (IRasterPixelsVisitor <float> visitor = new RasterPixelsVisitor <float>(ap))
                {
                    visitor.VisitPixelWnd(aoiRect, dblvAOI, wndBandNos, wndBandNos, minWnd, maxWnd,
                                          (pixelIdx, crtWndSize, bandValues, wndValues) =>
                    {
                        return(false);
                    },
                                          (pixelIdx, crtWndSize, bandValues, wndValues) =>
                    {
                        isEdge = IsEdgeMethod(bandValues, wndValues, 0);
                        if (isEdge)
                        {
                            result.Put(pixelIdx, GetResult(bandValues, wndValues, waterNir, LandNir, zoom));
                        }
                    });
                }
                return(result);
            }
            finally
            {
                if (vrd != null)
                {
                    vrd.Dispose();
                }
                if (filePrdMap != null && filePrdMap.Count > 0)
                {
                    foreach (FilePrdMap value in filePrdMap.Values)
                    {
                        if (value.Prd != null)
                        {
                            value.Prd.Dispose();
                        }
                    }
                }
            }
        }