Exemplo n.º 1
0
        public static BitMap3d CreateSampleForFan()
        {
            BitMap3d image = new BitMap3d(150, 150, 150, BitMap3d.BLACK);

            image.ReadRaw("D://VTKproj//marschnerlobb15.raw");
            byte[] data = image.data;
            for (int i = 0; i < data.Length; i++)
            {
                if (data[i] >= 89 && data[i] <= 255)
                {
                    data[i] = BitMap3d.BLACK;
                }
                else
                {
                    data[i] = BitMap3d.WHITE;
                }
            }
            for (int k = 0; k < image.depth; k++)
            {
                for (int j = 0; j < image.height; j++)
                {
                    for (int i = 0; i < image.width; i++)
                    {
                        int index = k * image.width * image.height + j * image.width + i;
                        if (i == 0 || i == image.width - 1 || j == 0 || j == image.height - 1 || k == 0 || k == image.depth - 1)
                        {
                            data[index] = BitMap3d.BLACK;
                        }
                    }
                }
            }
            return(image);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //TestSMC();
            BitMap3d       bmp = BitMap3d.CreateSampleForLobster();
            AdSMCProcessor smc = new AdSMCProcessor(bmp);
            Mesh           m   = smc.GenerateSurface();

            PlyManager.Output(m, "A2.ply");
            Console.WriteLine("cmp");
            Console.Read();
        }
Exemplo n.º 3
0
        public static BitMap3d CreateSampleTedVolume(int is400_300_200_100)
        {
            BitMap3d image = new BitMap3d(is400_300_200_100, is400_300_200_100, is400_300_200_100, BitMap3d.BLACK);

            image.ReadRaw(string.Format("D://VTKproj//Ted_{0}.raw", is400_300_200_100));
            byte[] data = image.data;
            for (int i = 0; i < data.Length; i++)
            {
                if (data[i] > 128)
                {
                    data[i] = BitMap3d.WHITE;
                }
                else
                {
                    data[i] = BitMap3d.BLACK;
                }
            }
            return(image);
        }
Exemplo n.º 4
0
        public static BitMap3d CreateSampleEngineVolume(string x2)
        {
            BitMap3d image;

            if (x2 == "")
            {
                image = new BitMap3d(256, 256, 128, BitMap3d.BLACK);
                image.ReadRaw("D://VTKproj//engine.raw");
            }
            else
            {
                image = new BitMap3d(512, 512, 256, BitMap3d.BLACK);
                image.ReadRaw("D://VTKproj//enginex2.raw");
            }
            byte[] data = image.data;
            for (int i = 0; i < data.Length; i++)
            {
                if (data[i] >= 64 && data[i] <= 255)
                {
                    data[i] = BitMap3d.WHITE;
                }
                else
                {
                    data[i] = BitMap3d.BLACK;
                }
            }
            for (int k = 0; k < image.depth; k++)
            {
                for (int j = 0; j < image.height; j++)
                {
                    for (int i = 0; i < image.width; i++)
                    {
                        int index = k * image.width * image.height + j * image.width + i;
                        if (i == 0 || i == image.width - 1 || j == 0 || j == image.height - 1 || k == 0 || k == image.depth - 1)
                        {
                            data[index] = BitMap3d.BLACK;
                        }
                    }
                }
            }
            return(image);
        }
Exemplo n.º 5
0
        private static void TestMC()
        {
            TestParms parm = TestParms.CreateParmsForPhantom();
            BitMap3d  bmp  = new BitMap3d(parm.image.data, parm.image.width, parm.image.height, parm.image.depth);

            for (int i = 0; i < bmp.data.Length; i++)
            {
                if (bmp.data[i] >= parm.min && bmp.data[i] <= parm.max)
                {
                    bmp.data[i] = BitMap3d.WHITE;
                }
                else
                {
                    bmp.data[i] = BitMap3d.BLACK;
                }
            }
            MCProcessor mc = new MCProcessor(bmp);
            Mesh        m  = mc.GeneratorSurface();

            PlyManager.Output(m, "test5.ply");
        }
Exemplo n.º 6
0
        private static void TestSMC()
        {
            TestParms parm = TestParms.CreateParmsForEngine();
            BitMap3d  bmp  = new BitMap3d(parm.image.data, parm.image.width, parm.image.height, parm.image.depth);

            for (int i = 0; i < bmp.data.Length; i++)
            {
                if (bmp.data[i] >= parm.min && bmp.data[i] <= parm.max)
                {
                    bmp.data[i] = BitMap3d.WHITE;
                }
                else
                {
                    bmp.data[i] = BitMap3d.BLACK;
                }
            }
            SMCProcessor smc = new SMCProcessor(bmp);
            Mesh         m   = smc.GenerateSurface();

            PlyManager.Output(m, @"D:\VTKproj\engine.ply");
        }
Exemplo n.º 7
0
        private static void Test()
        {
            BitMap3d bmp = new BitMap3d(301, 324, 56, BitMap3d.BLACK);

            bmp.ReadRaw("D://VTKproj//lobster.raw");
            for (int i = 0; i < bmp.data.Length; i++)
            {
                if (bmp.data[i] >= 37 && bmp.data[i] <= 255)
                {
                    bmp.data[i] = BitMap3d.WHITE;
                }
                else
                {
                    bmp.data[i] = BitMap3d.BLACK;
                }
            }
            MCProcessor mc = new MCProcessor(bmp);
            Mesh        m  = mc.GeneratorSurface();

            Console.WriteLine(m.Vertices.Count);
            Console.WriteLine(m.Faces.Count);
            PlyManager.Output(m, "test2.ply");
        }