Esempio n. 1
0
        public void VisitPixelWnd(int[] bandNos, int[] wndBandNos, int minWndSize, int maxWndSize, Func <int, int, T[], T[][], bool> isNeedIncWndSize, Action <int, int, T[], T[][]> extractAction)
        {
            if (extractAction == null || wndBandNos == null || wndBandNos.Length == 0)
            {
                return;
            }
            Rectangle rect = AOIHelper.ComputeAOIRect(_argProvider.AOI, new Size(_argProvider.DataProvider.Width, _argProvider.DataProvider.Height));

            int[] aoi = _argProvider.AOI;
            VisitPixelWnd(rect, aoi, bandNos, wndBandNos, minWndSize, maxWndSize, isNeedIncWndSize, extractAction);
        }
Esempio n. 2
0
        public void VisitPixel(int[] bandNos, Action <int, T[]> extractAction)
        {
            if (extractAction == null)
            {
                return;
            }
            if (bandNos == null || bandNos.Length == 0)
            {
                bandNos = GetAllBandNo();
            }
            Rectangle rect = AOIHelper.ComputeAOIRect(_argProvider.AOI, new Size(_argProvider.DataProvider.Width, _argProvider.DataProvider.Height));

            int[] aoi = _argProvider.AOI;
            VisitPixel(rect, aoi, bandNos, extractAction);
        }
Esempio n. 3
0
        private void StatAreaUseAOI(byte[] adminRaster, byte[] landuseRaster, IRasterDataProvider dataProvider, double[,] result, int[] aoi, Func <T, int, int> weight)
        {
            ArgumentProvider arg = new ArgumentProvider(dataProvider, null)
            {
                AOI = aoi
            };

            using (IRasterPixelsVisitor <T> v = new RasterPixelsVisitor <T>(arg))
            {
                Rectangle aoiRect = AOIHelper.ComputeAOIRect(aoi, new Size(dataProvider.Width, dataProvider.Height));
                v.VisitPixel(aoiRect, aoi, new int[] { 1 },
                             (idx, bandValues) =>
                {
                    result[adminRaster[idx], landuseRaster[idx]] += weight(bandValues[0], idx);
                }
                             );
            }
        }
Esempio n. 4
0
        public int[] Filter(IRasterDataProvider dataProvider, int[] aoi, Action <string> contextMessage)
        {
            if (_filters == null || _filters.Count == 0)
            {
                return(null);
            }
            Size      size = new Size(dataProvider.Width, dataProvider.Height);
            Rectangle rect = AOIHelper.ComputeAOIRect(aoi, size);

            int[] rolledAOI = aoi;
            foreach (ICandidatePixelFilter filter in _filters)
            {
                if (filter != null && filter.IsEnabled && !filter.IsFiltered)
                {
                    if (contextMessage != null)
                    {
                        contextMessage("正在执行\"" + (filter.Name ?? filter.ToString()) + "\"...");
                    }
                    rolledAOI = filter.Filter(dataProvider, rect, rolledAOI);
                    rect      = AOIHelper.ComputeAOIRect(rolledAOI, size);
                }
            }
            return(rolledAOI);
        }