当前位置: 首页>>代码示例>>C#>>正文


C# ESRI.set_PixelData方法代码示例

本文整理汇总了C#中ESRI.set_PixelData方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.set_PixelData方法的具体用法?C# ESRI.set_PixelData怎么用?C# ESRI.set_PixelData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ESRI的用法示例。


在下文中一共展示了ESRI.set_PixelData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: setPixelData

        private void setPixelData(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            for (int r = 0; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    HashSet<float> hash = new HashSet<float>();
                    for (int rb = 0; rb < rws; rb++)
                    {
                        int nrb = r + rb;
                        for (int cb = 0; cb < clms; cb++)
                        {
                            int ncb = c + cb;
                            object objVl = pbInBig.GetVal(p, ncb, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                hash.Add(vl);
                            }
                        }
                    }

                    pbArr.SetValue(hash.Count, c, r);
                }

            }
            pbIn.set_PixelData(p, pbArr);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:29,代码来源:focalHelperUnique.cs

示例2: setPixelData

        private void setPixelData(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            for (int r = 0; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    int tCnt = 0;
                    Dictionary<float, int> vlDic = new Dictionary<float, int>();
                    for (int rb = 0; rb < rws; rb++)
                    {
                        int nrb = r + rb;
                        for (int cb = 0; cb < clms; cb++)
                        {
                            int ncb = c + cb;
                            object objVl = pbInBig.GetVal(p, ncb, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                int vlCnt = 1;
                                //Console.WriteLine("From Thread " + p.ToString() + "; " + vl.ToString());
                                if (vlDic.TryGetValue(vl, out vlCnt))
                                {
                                    vlDic[vl] = vlCnt + 1;
                                }
                                else
                                {
                                    vlDic.Add(vl, 1);
                                }
                                tCnt += 1;

                            }
                        }
                    }
                    int rSum = 0;
                    int halfCnt = tCnt/2;
                    List<float> keyLst = vlDic.Keys.ToList();
                    keyLst.Sort();
                    foreach (float f in keyLst)
                    {
                        int vlCnt = vlDic[f];
                        rSum = rSum+vlCnt;
                        if (rSum > halfCnt)
                        {
                            pbArr.SetValue(f, c, r);
                            break;
                        }
                    }
                    //pbArr.SetValue(ent, c, r);
                }

            }
            pbIn.set_PixelData(p, pbArr);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:54,代码来源:focalHelperMedian.cs

示例3: setPixelData

        private void setPixelData(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            for (int r = 0; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    Dictionary<float, int> vlDic = new Dictionary<float, int>();
                    for (int rb = 0; rb < rws; rb++)
                    {
                        int nrb = r + rb;
                        for (int cb = 0; cb < clms; cb++)
                        {
                            int ncb = c + cb;
                            object objVl = pbInBig.GetVal(p, ncb, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                int vlCnt = 1;
                                //Console.WriteLine("From Thread " + p.ToString() + "; " + vl.ToString());
                                if (vlDic.TryGetValue(vl, out vlCnt))
                                {
                                    vlDic[vl] = vlCnt + 1;
                                }
                                else
                                {
                                    vlDic.Add(vl, 1);
                                }

                            }
                        }
                    }
                    int maxCnt = 0;
                    float maxVl = 0;
                    foreach (KeyValuePair<float, int> kvp in vlDic)
                    {
                        int kVl = kvp.Value;
                        //Console.WriteLine("kVl = " + kVl.ToString());
                        if (kVl > maxCnt)
                        {
                            maxVl = kvp.Key;
                            maxCnt = kVl;
                        }
                    }
                    pbArr.SetValue(maxVl, c, r);
                }

            }
            pbIn.set_PixelData(p, pbArr);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:50,代码来源:focalHelperMode.cs

示例4: setPixelData

        private void setPixelData(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            for (int r = 0; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    float tCnt = 0;
                    Dictionary<float, int> vlDic = new Dictionary<float, int>();
                    for (int rb = 0; rb < rws; rb++)
                    {
                        int nrb = r + rb;
                        for (int cb = 0; cb < clms; cb++)
                        {
                            int ncb = c + cb;
                            object objVl = pbInBig.GetVal(p, ncb, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                int vlCnt = 1;
                                //Console.WriteLine("From Thread " + p.ToString() + "; " + vl.ToString());
                                if (vlDic.TryGetValue(vl, out vlCnt))
                                {
                                    vlDic[vl] = vlCnt + 1;
                                }
                                else
                                {
                                    vlDic.Add(vl, 1);
                                }
                                tCnt += 1;

                            }
                        }
                    }
                    float prob = 0;
                    float ent = 0;
                    foreach (int vlCnt in vlDic.Values)
                    {
                        prob = vlCnt / tCnt;
                        ent = ent+(prob * prob);
                    }
                    pbArr.SetValue(ent, c, r);
                }

            }
            pbIn.set_PixelData(p, pbArr);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:47,代码来源:focalHelperProbability.cs

示例5: setPixelDataFolding


//.........这里部分代码省略.........
                    Dictionary<float, int> fDic = wrDic1[w][r];
                    for (int c = 0; c < clms; c++)
                    {
                        object objVl = pbInBig.GetVal(p, c, r);
                        if (objVl != null)
                        {
                            float vl = System.Convert.ToSingle(objVl);
                            int vlCnt;
                            if (fDic.TryGetValue(vl, out vlCnt))
                            {
                                fDic[vl] = vlCnt + 1;
                            }
                            else
                            {
                                fDic.Add(vl, 1);
                            }
                        }
                    }
                }
                setValues(pbArr, wrDic1[w], w, 0);
            }
            //create next dictionary and set the rest of the values
            int clmsM = clms - 1;
            int rwsM = rws - 1;
            Dictionary<float, int>[][] wrDic2 = new Dictionary<float, int>[pbIn.Width][];
            //wrDic2[0][0] = wrDic1[0][rwsM];
            for (int r = 1; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    Dictionary<float, int> clmsDic;
                    wrDic2[c] = new Dictionary<float, int>[rws];
                    for (int rb = 1; rb < rws; rb++)
                    {
                        wrDic2[c][rb - 1] = new Dictionary<float, int>(wrDic1[c][rb]);
                    }
                    int nrb = r + rwsM;
                    if (c > 0)// copy previous dictionary on same row and remove/add values
                    {
                        wrDic2[c][rwsM] = new Dictionary<float, int>(wrDic2[c - 1][rwsM]);
                        clmsDic = wrDic2[c][rwsM];
                        int ncb = c + clmsM;
                        object objVln = pbInBig.GetVal(p, ncb, nrb);
                        object objVlo = pbInBig.GetVal(p, c - 1, nrb);
                        if (objVlo != null)//remove old value
                        {
                            float vlo = System.Convert.ToSingle(objVlo);
                            int vloCnt = clmsDic[vlo];
                            if (vloCnt > 1)
                            {
                                clmsDic[vlo] = vloCnt - 1;
                            }
                            else
                            {
                                clmsDic.Remove(vlo);
                            }
                        }
                        if (objVln != null)//add new value
                        {
                            float vln = System.Convert.ToSingle(objVln);
                            int vlnCnt;
                            if (clmsDic.TryGetValue(vln, out vlnCnt))
                            {
                                clmsDic[vln] = vlnCnt + 1;
                            }
                            else
                            {
                                clmsDic.Add(vln, 1);
                            }

                        }
                    }
                    else //first column, need to get all numbers of new row
                    {
                        wrDic2[c][rwsM] = new Dictionary<float, int>();
                        Dictionary<float, int> fDic = wrDic2[c][rwsM];
                        for (int c2 = 0; c2 < clms; c2++)
                        {
                            object objVl = pbInBig.GetVal(p, c2, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                int vlCnt;
                                if (fDic.TryGetValue(vl, out vlCnt))
                                {
                                    fDic[vl] = vlCnt + 1;
                                }
                                else
                                {
                                    fDic.Add(vl, 1);
                                }
                            }
                        }
                    }
                    setValues(pbArr, wrDic2[c], c, r);
                }
            }
            pbIn.set_PixelData(p, pbArr);
            wrDic1 = wrDic2;
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:101,代码来源:focalHelperMedian.cs

示例6: updatePixelRectangle


//.........这里部分代码省略.........
                        if (objBvl != null)
                        {
                            bVl = (float)objBvl;
                        }
                        sumVl += bVl;
                    }
                    sumNewBigArr[0] = sumVl;
                    for (int c = clms; c < cs; c++)
                    {
                        int nc = c - hc;
                        int pc = c - clms;
                        object bVlobj = pbInBig.GetVal(b, c, r);
                        object pVlobj = pbInBig.GetVal(b, pc, r);
                        float bVl = 0;
                        float pVl = 0;
                        if (bVlobj!=null)
                        {
                            bVl = (float)bVlobj;
                        }
                        if (pVlobj!=null)
                        {
                            pVl = (float)pVlobj;
                        }
                        sumVl += bVl - pVl;
                        try
                        {
                            sumNewBigArr[nc] = sumVl;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.ToString());
                            System.Windows.Forms.MessageBox.Show(e.ToString());

                        }
                    }
                    queB.Enqueue(sumNewBigArr);
                }
                updateFirstRow(queB, ref upArr, ref pbIn);
                for (int r = rws; r < rs; r++)
                {
                    int pr = r-rws;
                    int nr = r - hr;
                    float[] sumNewBigArr = new float[scs];
                    float sumVl = 0;
                    //first 3 values
                    for (int c = 0; c < clms; c++)
                    {
                        object bVlobj = pbInBig.GetVal(b, c, r);
                        float bVl = 0;
                        if (bVlobj!=null)
                        {
                            bVl = (float)bVlobj;
                        }
                        sumVl += bVl;
                    }
                    sumNewBigArr[0] = sumVl;
                    float oldSumVl = queB.Peek()[0];
                    float pSmallArrValue = (float)upArr.GetValue(0,pr);//pSmallArrValues[0];
                    float nSmallArrValue = pSmallArrValue + sumVl - oldSumVl;
                    upArr.SetValue(nSmallArrValue, 0, nr);
                    //pSmallArrValues[0] = nSmallArrValue;
                    for (int c = clms; c < cs; c++)
                    {
                        int nc = c - hc;
                        int pc = c - clms;
                        object bVlobj = pbInBig.GetVal(b, c, r);
                        object pVlobj = pbInBig.GetVal(b, pc, r);
                        float bVl = 0;
                        float pVl = 0;
                        if (bVlobj!=null)
                        {
                            bVl = (float)bVlobj;
                        }
                        if (pVlobj!=null)
                        {
                            pVl = (float)pVlobj;
                        }
                        sumVl += bVl - pVl;
                        sumNewBigArr[nc] = sumVl;
                        oldSumVl = queB.Peek()[nc];
                        pSmallArrValue = (float)upArr.GetValue(nc, pr); ;// pSmallArrValues[nc];
                        nSmallArrValue = pSmallArrValue + sumVl - oldSumVl;
                        try
                        {
                            upArr.SetValue(nSmallArrValue, nc, nr);
                            //pSmallArrValues[nc] = nSmallArrValue;
                        }
                        catch(Exception e)
                        {
                            Console.WriteLine("Error in setting pSmallArrValues");
                            Console.WriteLine(e.ToString());
                            System.Windows.Forms.MessageBox.Show(e.ToString());
                        }
                    }
                    queB.Enqueue(sumNewBigArr);
                    queB.Dequeue();
                }
                pbIn.set_PixelData(b, upArr);
            }
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:101,代码来源:focalHelperMean.cs


注:本文中的ESRI.set_PixelData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。