コード例 #1
0
ファイル: Program.cs プロジェクト: zhy890524/SeededGrow2d
        public static void InitAdj6(Int16Triple[] adjPoints6, Int16Triple p)
        {
            adjPoints6[0].X = p.X - 1;
            adjPoints6[0].Y = p.Y;
            adjPoints6[0].Z = p.Z;

            adjPoints6[1].X = p.X + 1;
            adjPoints6[1].Y = p.Y;
            adjPoints6[1].Z = p.Z;

            adjPoints6[2].X = p.X;
            adjPoints6[2].Y = p.Y - 1;
            adjPoints6[2].Z = p.Z;

            adjPoints6[3].X = p.X;
            adjPoints6[3].Y = p.Y + 1;
            adjPoints6[3].Z = p.Z;


            adjPoints6[4].X = p.X;
            adjPoints6[4].Y = p.Y;
            adjPoints6[4].Z = p.Z - 1;

            adjPoints6[5].X = p.X;
            adjPoints6[5].Y = p.Y;
            adjPoints6[5].Z = p.Z + 1;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: zhy890524/SeededGrow2d
        public static List <Int16Triple> FindBoundaryPoints(TestParms test)
        {
            for (int i = 0; i < test.image.data.Length; i++)
            {
                if (test.image.data[i] >= test.min && test.image.data[i] <= test.max)
                {
                    test.image.data[i] = BitMap3d.WHITE;
                }
                else
                {
                    test.image.data[i] = BitMap3d.BLACK;
                }
            }

            List <Int16Triple> list = new List <Int16Triple>();

            Int16Triple[] adjPoints6 = new Int16Triple[6];
            for (int k = 0; k < test.image.depth; k++)
            {
                for (int j = 0; j < test.image.height; j++)
                {
                    for (int i = 0; i < test.image.width; i++)
                    {
                        if (test.image.GetPixel(i, j, k) == BitMap3d.WHITE)
                        {
                            Int16Triple p = new Int16Triple(i, j, k);
                            InitAdj6(adjPoints6, p);
                            for (int pi = 0; pi < 6; pi++)
                            {
                                Int16Triple t = adjPoints6[pi];
                                if (!InRange(test.image, t) || test.image.GetPixel(t.X, t.Y, t.Z) == BitMap3d.BLACK)
                                {
                                    list.Add(p);
                                }
                            }
                        }
                    }
                }
            }
            return(list);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: zhy890524/SeededGrow2d
 private static bool InRange(BitMap3d bitMap3d, Int16Triple t)
 {
     return(t.X >= 0 && t.X < bitMap3d.width && t.Y >= 0 && t.Y < bitMap3d.height && t.Z >= 0 && t.Z < bitMap3d.depth);
 }