private static BitMap2d GetSingleRegionBitmap(BitMap2d b)
        {
            BitMap2d            bmp   = new BitMap2d(b.width, b.height, BitMap2d.WHITE);
            Queue <Int16Double> queue = new Queue <Int16Double>();

            queue.Enqueue(new Int16Double(0, 0));
            bmp.SetPixel(0, 0, BitMap2d.BLACK);
            Int16Double[] adj = new Int16Double[4];
            while (queue.Count != 0)
            {
                Int16Double pix = queue.Dequeue();
                InitAdj4(adj, pix.X, pix.Y);
                for (int i = 0; i < 4; i++)
                {
                    Int16Double t = adj[i];
                    if (t.X >= 0 && t.X < bmp.width && t.Y >= 0 && t.Y < bmp.height &&
                        b.GetPixel(t.X, t.Y) == BitMap2d.BLACK && bmp.GetPixel(t.X, t.Y) == BitMap2d.WHITE)
                    {
                        bmp.SetPixel(t.X, t.Y, BitMap2d.BLACK);
                        queue.Enqueue(t);
                    }
                }
            }
            return(bmp);
        }
        private static BitMap2d GetMappedBitmap(List <Int16Triple> regionPoints, Box3Int box, ref int stx, ref int sty)
        {
            BitMap2d bmp = new BitMap2d(box.GetXLength() + 2, box.GetYLength() + 2, BitMap2d.BLACK);

            stx = box.Min3[0] - 1;
            sty = box.Min3[1] - 1;
            for (int i = 0; i < regionPoints.Count; i++)
            {
                bmp.SetPixel(regionPoints[i].X - stx, regionPoints[i].Y - sty, BitMap2d.WHITE);
            }
            return(bmp);
        }