Ejemplo n.º 1
0
        public static TestParms CreateParmsForCube()
        {
            TestParms parm = new TestParms();

            parm.image = new BitMap3d(200, 200, 200, 240);
            parm.seed  = new Int16Triple(50, 50, 50);
            parm.min   = 0;
            parm.max   = 255;
            return(parm);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            TestParms          test = TestParms.CreateParmsForEngine();
            List <Int16Triple> list = FindBoundaryPoints(test);

            TestVisit_1(list, test);
            TestVisit_2(list, test);
            TestVisit_3(list, test);
            TestVisit_4(list, test);
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        public static TestParms CreateParmsForBackPack()
        {
            TestParms parm = new TestParms();

            parm.image = new BitMap3d(512, 512, 373, BitMap3d.BLACK);
            parm.image.ReadRaw("D://VTKproj//backpack8.raw");
            parm.seed = new Int16Triple(53, 390, 160);
            parm.min  = 46;
            parm.max  = 255;
            return(parm);
        }
Ejemplo n.º 4
0
        public static TestParms CreateParmsForEngine()
        {
            TestParms parm = new TestParms();

            parm.image = new BitMap3d(256, 256, 128, BitMap3d.BLACK);
            parm.image.ReadRaw("D://VTKproj//engine.raw");
            parm.seed = new Int16Triple(149, 44, 43);
            parm.min  = 64;
            parm.max  = 255;
            return(parm);
        }
Ejemplo n.º 5
0
        public static TestParms CreateParmsForPhantom()
        {
            TestParms parm = new TestParms();

            parm.image = new BitMap3d(512, 512, 442, BitMap3d.BLACK);
            parm.image.ReadRaw("D://VTKproj//colon_phantom8.raw");
            parm.seed = new Int16Triple(256, 256, 227);
            parm.max  = 255;
            parm.min  = 42;
            return(parm);
        }
Ejemplo n.º 6
0
        public static TestParms CreateParmsForLobster()
        {
            TestParms parm = new TestParms();

            parm.image = new BitMap3d(301, 324, 56, BitMap3d.BLACK);
            parm.image.ReadRaw("D://VTKproj//lobster.raw");
            parm.seed = new Int16Triple(124, 168, 27);
            parm.min  = 37;
            parm.max  = 255;
            return(parm);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        static void TestVisit_1(List <Int16Triple> list, TestParms test)
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();
            HashTable_Double2dArray <bool> hash = new HashTable_Double2dArray <bool>(test.image.width, test.image.height, test.image.depth);

            for (int i = 0; i < list.Count; i++)
            {
                hash.SetHashValue(list[i].X, list[i].Y, list[i].Z, true);
            }
            bool temp = false;

            for (int i = 0; i < list.Count; i++)
            {
                bool has = hash.GetHashValue(list[i].X, list[i].Y, list[i].Z, ref temp);
                if (!has)
                {
                    throw new Exception();
                }
            }
            watch.Stop();
            Console.WriteLine("double2d : " + watch.ElapsedMilliseconds);
        }