예제 #1
0
        private void buttonSaveComponentData_Click(object sender, EventArgs e)
        {
            if (textBoxComponentName.Text.Length <= 0)
            {
                MessageBox.Show("No File Name!");
                return;
            }

            if (VtkControl.RectImageData == null || VtkControl.RectPolyData == null)
            {
                MessageBox.Show("No Data Selected!");
                return;
            }

            if (imageRect.Width * imageRect.Height == 0)
            {
                imageRect = new Rectangle()
                {
                    X      = 0,
                    Y      = 0,
                    Width  = VtkControl.ImageWidth,
                    Height = VtkControl.ImageHeight
                };
            }

            VtkControl.SaveRectData(Config.RuntimeData + textBoxComponentName.Text + ".txt", VtkControl.RectPolyData, imageRect);
            VtkControl.SaveImageData(Config.RuntimeData + textBoxComponentName.Text + ".bmp", VtkControl.RectImageData);
            VtkControl.SavePolyData(Config.RuntimeData + textBoxComponentName.Text + ".poly.txt", VtkControl.RectPolyData);

            MessageBox.Show("Data Saved.");
        }
예제 #2
0
        private void buttonAddSeries_Click(object sender, EventArgs e)
        {
            if (VtkControl.ImageData == null || VtkControl.PolyData == null)
            {
                MessageBox.Show("Please Load Model First!");
                return;
            }

            if (vtk.IsDisposed)
            {
                vtk = new VtkForm();
            }
            vtk.Show();


            imageRect = new Rectangle()
            {
                X = (int)(((float)rectSelected.Left) / pictureBoxImage.Width * VtkControl.ImageWidth),
                Y =
                    VtkControl.ImageHeight -
                    (int)(((float)rectSelected.Bottom) / pictureBoxImage.Height * VtkControl.ImageHeight),
                Width  = (int)(((float)rectSelected.Width) / pictureBoxImage.Width * VtkControl.ImageWidth),
                Height = (int)(((float)rectSelected.Height) / pictureBoxImage.Height * VtkControl.ImageHeight),
            };


            if (imageRect.Width * imageRect.Height == 0)
            {
                imageRect = new Rectangle()
                {
                    X      = 0,
                    Y      = 0,
                    Width  = VtkControl.ImageWidth,
                    Height = VtkControl.ImageHeight
                };

                VtkControl.RectPolyData = vtkPolyData.New();
                VtkControl.RectPolyData.DeepCopy(VtkControl.PolyData);
                VtkControl.RectImageData = vtkImageData.New();
                VtkControl.RectImageData.DeepCopy(VtkControl.ImageData);

                VtkControl.SetRectModel(new Rectangle(0, 0, VtkControl.ImageWidth, VtkControl.ImageHeight));
            }
            else
            {
                VtkControl.GetRectData(VtkControl.PolyData, imageRect);

                VtkControl.SetRectModel(imageRect);
            }

            vtk.renWinControl3D.RenderWindow.Render();
        }
예제 #3
0
        private void buttonSetModel_Click(object sender, EventArgs e)
        {
            buttonAddModel.BackColor = Color.LightCoral;

            Application.DoEvents();

            if (comboBox3DModel.Text.Length <= 0)
            {
                MessageBox.Show("No File Selected!");
                return;
            }

            if (!File.Exists(comboBox3DModel.Text))
            {
                MessageBox.Show("File Not Exist!");
                return;
            }
            //Console.WriteLine(comboBox3DModel.Text);

            VtkControl.ReadDataFromFile(comboBox3DModel.Text);


            VtkControl.SaveImageData(comboBox3DModel.Text + ".img.bmp", VtkControl.ImageData);


            pictureBoxImage.Image    = Image.FromFile(comboBox3DModel.Text + ".img.bmp");
            pictureBoxImage.SizeMode = PictureBoxSizeMode.StretchImage;


            richTextBox1.Clear();
            richTextBox1.AppendText("ImageWidth:" + VtkControl.ImageWidth + "\r\n");
            richTextBox1.AppendText("ImageHeight:" + VtkControl.ImageHeight + "\r\n");


            //Console.WriteLine("Load Model Finish.");
            buttonAddModel.BackColor = Color.LightGreen;
        }
예제 #4
0
 private void buttonUpdateDepth1_Click(object sender, EventArgs e)
 {
     VtkControl.UpdateDepthFormFile(@".\Data\test1\Depth1.txt");
 }