Пример #1
0
        public cFeedBackMessage Run()
        {
            //CurrentLUT = LUT.LUT_JET;
            //  Kitware.VTK.RenderWindowControl VTKView = GenerateGraph();
            renderWindowControl1 = new RenderWindowControl();
            renderWindowControl1.Load += new EventHandler(renderWindowControl1_Load);

            renderWindowControl1.Width = base.CurrentPanel.Width;
            renderWindowControl1.Height = base.CurrentPanel.Height;

            base.CurrentPanel.Title = this.Title;
            base.CurrentPanel.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom
                                        | System.Windows.Forms.AnchorStyles.Left
                                        | System.Windows.Forms.AnchorStyles.Right);

            renderWindowControl1.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom
                                        | System.Windows.Forms.AnchorStyles.Left
                                        | System.Windows.Forms.AnchorStyles.Right);

            //ContextMenuStrip HeatMapContextMenu = new ContextMenuStrip();
            //ToolStripMenuItem ToolStripMenuItem_DisplayTable = new ToolStripMenuItem("Display Table");
            //HeatMapContextMenu.Items.Add(ToolStripMenuItem_DisplayTable);
            //ToolStripMenuItem_DisplayTable.Click += new System.EventHandler(this.DisplayTable);
            //CurrentPanel.ContextMenuStrip = HeatMapContextMenu;

            CurrentPanel.Controls.Add(renderWindowControl1);

            return base.FeedBackMessage;
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            AddConeSourceToRenderWindow(this.renderWindowControl1.RenderWindow);
            AddConeSourceToSecondRenderWindow();

            Kitware.VTK.RenderWindowControl ctl2 = new Kitware.VTK.RenderWindowControl();
            ctl2.Dispose();
        }
        /// <summary>
        /// Creating the 2D visualization window.
        /// </summary>
        /// <param name="window">Orginal window component. </param>
        public Visualization2D(RenderWindowControl window)
        {
            _window = window;
            vtkInteractorStyleImage imageStyle = vtkInteractorStyleImage.New();

            _viewer = vtkImageViewer2.New();
            _viewer.OffScreenRenderingOn();
            _window.RenderWindow.AddRenderer(_viewer.GetRenderer());
            _window.RenderWindow.GetInteractor().SetInteractorStyle(imageStyle);
            _viewer.Render();
        }
        public Visualization2D(RenderWindowControl window, vtkDICOMImageReader dicomReader)
        {
            this.window = window;
            this.dicomReader = dicomReader;

            vtkRenderer renderer = window.RenderWindow.GetRenderers().GetFirstRenderer();
            vtkRenderWindowInteractor renderWindowInteractor = window.RenderWindow.GetInteractor();

            viewer = vtkImageViewer2.New();
            viewer.OffScreenRenderingOn();
            viewer.SetupInteractor(renderWindowInteractor);
            viewer.SetRenderer(renderer);
        }
Пример #5
0
 protected override void OnGotFocus(EventArgs e)
 {
     if (this.m_RenderWindow != null)
     {
         IntPtr genericWindowId = this.m_RenderWindow.GetGenericWindowId();
         if (IntPtr.Zero != genericWindowId)
         {
             try
             {
                 RenderWindowControl.SetFocus(genericWindowId);
             }
             catch
             {
             }
         }
     }
     base.OnGotFocus(e);
 }
        //wizualizacja 3d -----------------------------------------------------------------
        public Visualization3D(RenderWindowControl window, DicomLoader dicomLoader, Chart chart)
        {
            _chart = chart;
            _window = window;
            _dicomLoader = dicomLoader;
            PresetReader = new XmlPresetReader();

            // Create a mapper and actor
            _mapper = vtkSmartVolumeMapper.New();
            _mapper.SetInput(_dicomLoader.GetOutput());
            _volume = vtkVolume.New();
            SetOpacityFunction();
            SetGradientOpacity();
            _volume.SetMapper(_mapper);

            renderer = vtkRenderer.New();
            renderer.AddVolume(_volume);
            _window.RenderWindow.GetRenderers().RemoveAllItems();
            _window.RenderWindow.AddRenderer(renderer);
            _window.RenderWindow.GetRenderers().GetFirstRenderer().AddVolume(_volume);

            // An interactor
            _renderWindowInteractor = vtkRenderWindowInteractor.New();
            _renderWindowInteractor.SetRenderWindow(_window.RenderWindow);

            //Camera style
            vtkInteractorStyleTrackballCamera style = vtkInteractorStyleTrackballCamera.New();
            style.AutoAdjustCameraClippingRangeOff();
            _renderWindowInteractor.SetInteractorStyle(style);

            //Create and setup planes
            PlaneWidgetX = new PlaneWidget(Axis.X);
            SetupPlane(PlaneWidgetX);
            PlaneWidgetY = new PlaneWidget(Axis.Y);
            SetupPlane(PlaneWidgetY);
            PlaneWidgetZ = new PlaneWidget(Axis.Z);
            SetupPlane(PlaneWidgetZ);

            // Render
            _window.RenderWindow.Render();

            //ClipingModule
            _clipingModule = new ClipingModule(GetObjectSize());
        }
Пример #7
0
        private void InitializeVTK()
        {
            Kitware.VTK.RenderWindowControl rw = new Kitware.VTK.RenderWindowControl();
            rw.AddTestActors = false;
            rw.Dock          = System.Windows.Forms.DockStyle.Fill;
            wfh.Child        = rw;
            wfh.Visibility   = System.Windows.Visibility.Visible;
            Kitware.VTK.vtkRendererCollection rs = rw.RenderWindow.GetRenderers();
            int rsc = rs.GetNumberOfItems();

            Console.WriteLine(rsc + " renderers");
            Kitware.VTK.vtkRenderer r = rs.GetFirstRenderer();
            r.SetBackground(0.1, 0.3, 0.7);
            r.SetBackground2(0.7, 0.8, 1.0);
            r.SetGradientBackground(true);

            Kitware.VTK.vtkAxesActor axa = new Kitware.VTK.vtkAxesActor();
            r.AddActor(axa);

            string vtkVersion = Kitware.VTK.vtkVersion.GetVTKVersion();

            vtkVersion = "VTK " + vtkVersion;
            Console.WriteLine(vtkVersion);

            this.label.Content = vtkVersion;

            axa.SetTotalLength(50.0, 50.0, 50.0);
            axa.SetConeRadius(0.1);
            //axa.SetAxisLabels(0);

            axa.GetXAxisCaptionActor2D().GetTextActor().SetTextScaleMode((int)Kitware.VTK.vtkTextActor.TEXT_SCALE_MODE_NONE_WrapperEnum.TEXT_SCALE_MODE_NONE);
            axa.GetXAxisCaptionActor2D().GetTextActor().GetTextProperty().SetFontSize(32);
            axa.GetYAxisCaptionActor2D().GetTextActor().SetTextScaleMode((int)Kitware.VTK.vtkTextActor.TEXT_SCALE_MODE_NONE_WrapperEnum.TEXT_SCALE_MODE_NONE);
            axa.GetYAxisCaptionActor2D().GetTextActor().GetTextProperty().SetFontSize(32);
            axa.GetZAxisCaptionActor2D().GetTextActor().SetTextScaleMode((int)Kitware.VTK.vtkTextActor.TEXT_SCALE_MODE_NONE_WrapperEnum.TEXT_SCALE_MODE_NONE);
            axa.GetZAxisCaptionActor2D().GetTextActor().GetTextProperty().SetFontSize(32);

            m_sa = this.CreateSphereActor(10.0);
            r.AddActor(m_sa);

            m_sa.SetPosition(25.0, 25.0, 25.0);
        }
        //wizualizacja 3d -----------------------------------------------------------------
        public Visualization3D(RenderWindowControl window, vtkDICOMImageReader dicomReader)
        {
            this.window = window;
            this.dicomReader = dicomReader;
            this.presetMapper = new PresetMapper();

            vtkRenderer renderer = window.RenderWindow.GetRenderers().GetFirstRenderer();

            vtkSmartVolumeMapper mapper = vtkSmartVolumeMapper.New();
            vol = vtkVolume.New();

            vtkLookupTable bwLut =vtkLookupTable.New();
            bwLut.SetTableRange (0, 2000);
            bwLut.SetSaturationRange (0, 0);
            bwLut.SetHueRange (0, 0);
            bwLut.SetValueRange (0, 1);
            bwLut.Build(); //effective built

            vtkImageMapToColors sagittalColors =vtkImageMapToColors.New();
            sagittalColors.SetInputConnection(dicomReader.GetOutputPort());
            sagittalColors.SetLookupTable(bwLut);
            sagittalColors.Update();
            vtkImageActor sagittal = vtkImageActor.New();
            sagittal.SetInput(sagittalColors.GetOutput());
            sagittal.SetDisplayExtent(117,117,0,173,1,180);

            vtkImageReslice reslicer = vtkImageReslice.New();
            reslicer.SetResliceAxesDirectionCosines(1,0,0,2,0,0,0,0,0);

            mapper.SetInputConnection(dicomReader.GetOutputPort());

            this.setColorFunction();
            this.setOpacityFunction();
            this.setGradientOpacity();

            vol.SetMapper(mapper);

            renderer.AddActor(sagittal);
            renderer.AddVolume(vol);
        }
Пример #9
0
        public cFeedBackMessage Run()
        {
            renderWindowControl1 = new RenderWindowControl();
            renderWindowControl1.Load += new EventHandler(renderWindowControl1_Load);
            renderWindowControl1.Disposed += new EventHandler(renderWindowControl1_Disposed);

            renderWindowControl1.Width = base.CurrentPanel.Width;
            renderWindowControl1.Height = base.CurrentPanel.Height;

            base.CurrentPanel.Title = this.Title;
            base.CurrentPanel.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom
                                        | System.Windows.Forms.AnchorStyles.Left
                                        | System.Windows.Forms.AnchorStyles.Right);

            renderWindowControl1.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom
                                        | System.Windows.Forms.AnchorStyles.Left
                                        | System.Windows.Forms.AnchorStyles.Right);

               // CurrentPanel.MouseDown += new MouseEventHandler(renderWindowControl1_MouseDown);

            this.CurrentPanel.DragDrop += new DragEventHandler(CurrentPanel_DragDrop);
            this.CurrentPanel.DragEnter += new DragEventHandler(CurrentPanel_DragEnter);
            this.CurrentPanel.AllowDrop = true;

            CurrentPanel.Controls.Add(renderWindowControl1);

            ToolStripMenuItem_ActorsInfo.CheckOnClick = true;
            ToolStripMenuItem_ActorsInfo.Checked = false;

            return base.FeedBackMessage;
        }
Пример #10
0
        //public c3DWorld(Kitware.VTK.RenderWindowControl CurrentrenderWindowControl, Sequence Seq)
        //{
        //    this.ren1 = CurrentrenderWindowControl.RenderWindow.GetRenderers().GetFirstRenderer();
        //    this.renWin = CurrentrenderWindowControl.RenderWindow;
        //    if (Seq == null)
        //    {
        //        Xres = Yres = Zres = 0;
        //    }
        //    else
        //    {
        //        Xres = Seq.XResolution;
        //        Yres = Seq.YResolution;
        //        Zres = Seq.ZResolution;
        //    }
        //    ListPolyDataMapper = new List<vtkPolyDataMapper>();
        //    ListObject = new List<cObject3D>();
        //    ListVolume = new List<cVolume3D>();
        //}
        /// <summary>
        /// Create a 3D world
        /// </summary>
        /// <param name="CurrentrenderWindowControl">vtk Control</param>
        /// <param name="Dimensions">in pixels</param>
        /// <param name="Resolution">spatial resolutions</param>
        public c3DWorld(cPoint3D Dimensions, cPoint3D Resolution, RenderWindowControl CurrentrenderWindowControl, int[] WinPos)
        {
            // int[] Pos =  renWin.GetPosition();

            //,
            if (CurrentrenderWindowControl == null)
            {
                renWin = vtkRenderWindow.New();
                renWin.LineSmoothingOn();
                renWin.PointSmoothingOn();
                renWin.SetWindowName("3D World");
                renWin.BordersOn();
                renWin.DoubleBufferOn();

                renWin.SetSize(750, 500);

                //   if(WinPos!=null)            renWin.SetPosition(WinPos[0], WinPos[1]);
                // this.ren1 = CurrentrenderWindowControl.RenderWindow.GetRenderers().GetFirstRenderer();
                //CurrentrenderWindowControl.RenderWindow;
            }

            //// Menu Strip Construction
            //this.contextMenuStripActorPicker = new ContextMenuStrip();
            //ToolStripMenuItem StripMenuItemDisplay = new ToolStripMenuItem("Display");
            //contextMenuStripActorPicker.Items.Add(StripMenuItemDisplay);

            this.ren1 = vtkRenderer.New();
            //renWin = CurrentrenderWindowControl.RenderWindow;//vtkRenderWindow.New();

            renWin.AddRenderer(ren1);

            iren = new vtkRenderWindowInteractor();
            iren.SetRenderWindow(renWin);

            //iren.SetInteractorStyle(vtkInteractorStyleJoystickCamera.New());
            iren.SetInteractorStyle(vtkInteractorStyleTrackballCamera.New());
            //   iren.SetInteractorStyle(vtkInteractorStyleTerrain.New());

            // iren.LeftButtonPressEvt += new vtkObject.vtkObjectEventHandler(RenderWindow_LeftButtonPressEvt);
            iren.KeyPressEvt += new vtkObject.vtkObjectEventHandler(RenderWindow_KeyPressEvt);
            iren.RightButtonPressEvt += new vtkObject.vtkObjectEventHandler(RenderWindow_RightButtonPressEvt);

            //Render();
            //this.ren1 =

            Xres = Resolution.X;
            Yres = Resolution.Y;
            Zres = Resolution.Z;

            SizeX = (int)Dimensions.X;
            SizeY = (int)Dimensions.Y;
            SizeZ = (int)Dimensions.Z;

            //  double[] fp = ren1.GetActiveCamera().GetFocalPoint();
            //   double[] p = ren1.GetActiveCamera().GetPosition();

            //   ren1.GetActiveCamera().ParallelProjectionOn();

            //   double dist = Math.Sqrt((p[0] - fp[0]) * (p[0] - fp[0]) + (p[1] - fp[1]) * (p[1] - fp[1]) + (p[2] - fp[2]) * (p[2] - fp[2]));
            //    ren1.GetActiveCamera().SetPosition(fp[0], fp[1], fp[2] + dist*1000);
            //    ren1.GetActiveCamera().Zoom(2);
            //ren1.Render();
            //  this.Render();
            ListPolyDataMapper = new List<vtkPolyDataMapper>();
            ListObject = new List<cObject3D>();

            //     Vtk_CameraViewOrientation = ren1.GetActiveCamera();
        }
Пример #11
0
        int build3DViewFull()
        {
            Kitware.VTK.RenderWindowControl rw = new Kitware.VTK.RenderWindowControl();

            vtkRenderWindow _renwin = rw.RenderWindow;
            vtkRenderer     _render = _renwin.GetRenderers().GetFirstRenderer();

            _renwin.AddRenderer(_render);

            vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();

            iren.SetRenderWindow(_renwin);

            // 新建文件读取对象,常见的有vtkBMPReader、vtkDICOMImageReader、vtkJPEGReader等
            vtkJPEGReader jpegReader = new vtkJPEGReader();

            // 不同的reader需要设置的参数是不同的 因此本例仅适合jpegreader
            jpegReader.SetFilePrefix("C:/Users/DawnWind/Desktop/000/"); // 要打开的路径
            jpegReader.SetFilePattern("%s%d.jpg");                      // 图片文件名格式,此处为 0.jpg 1.jpg ...
            jpegReader.SetDataByteOrderToLittleEndian();
            jpegReader.SetDataSpacing(1, 1, 1.4);                       // 设置图片中像素比,我理解得不清楚,具体请百度之
            jpegReader.SetFileNameSliceSpacing(1);

            jpegReader.SetDataExtent(0, 209, 0, 209, 0, 29);
            // 这里因为在000文件夹里面有0.jpg ~ 29.jpg,所以设置为 0,29
            // 每张图片的长宽为210 * 210 因此设置为0,209

            jpegReader.Update();
            // update这里要注意一下,对于VTK在默认情况下是在最后操作时候才一次性刷新
            // 也就是说如果没有自动刷新的话,在一些中间过程中是无法获得到数据的,因为没update进去

            vtkContourFilter skinExtractor = new vtkContourFilter();

            skinExtractor.SetInputConnection(jpegReader.GetOutputPort());
            skinExtractor.SetValue(200, 100);    //值越大,保留的部分越少。

            //重新计算法向量
            vtkPolyDataNormals skinNormals = new vtkPolyDataNormals();

            skinNormals.SetInputConnection(skinExtractor.GetOutputPort());
            skinNormals.SetFeatureAngle(60.0);
            //Specify the angle that defines a sharp edge.
            //If the difference in angle across neighboring polygons is greater than this value,
            //the shared edge is considered "sharp".


            //create triangle strips and/or poly-lines 为了更快的显示速度
            vtkStripper skinStripper = new vtkStripper();

            skinStripper.SetInputConnection(skinNormals.GetOutputPort());

            vtkPolyDataMapper skinMapper = new vtkPainterPolyDataMapper();

            skinMapper.SetInputConnection(skinStripper.GetOutputPort());
            skinMapper.ScalarVisibilityOff();    //这样不会带颜色



            vtkActor skin = new vtkActor();

            skin.SetMapper(skinMapper);

            // An outline provides context around the data.
            // 一个围绕在物体的立体框,可以先忽略

            /*
             * vtkOutlineFilter> outlineData =
             *  vtkOutlineFilter>::New();
             * outlineData.SetInputConnection(dicomReader.GetOutputPort());
             *
             * vtkPolyDataMapper> mapOutline =
             *  vtkPolyDataMapper>::New();
             * mapOutline.SetInputConnection(outlineData.GetOutputPort());
             *
             * vtkActor> outline =
             *  vtkActor>::New();
             * outline.SetMapper(mapOutline);
             * outline.GetProperty().SetColor(0,0,0);
             *
             * aRenderer.AddActor(outline);
             */
            // It is convenient to create an initial view of the data. The FocalPoint
            // and Position form a vector direction. Later on (ResetCamera() method)
            // this vector is used to position the camera to look at the data in
            // this direction.
            vtkCamera aCamera = new vtkCamera();

            aCamera.SetViewUp(0, 0, -1);
            aCamera.SetPosition(0, 1, 0);
            aCamera.SetFocalPoint(0, 0, 0);
            aCamera.ComputeViewPlaneNormal();
            aCamera.Azimuth(30.0);
            aCamera.Elevation(30.0);

            // Actors are added to the renderer. An initial camera view is created.
            // The Dolly() method moves the camera towards the FocalPoint,
            // thereby enlarging the image.
            _render.AddActor(skin);
            _render.SetActiveCamera(aCamera);
            _render.ResetCamera();
            aCamera.Dolly(1.5);

            // Set a background color for the renderer and set the size of the
            // render window (expressed in pixels).
            _render.SetBackground(.2, .3, .4);
            _renwin.SetSize(640, 480);

            // Note that when camera movement occurs (as it does in the Dolly()
            // method), the clipping planes often need adjusting. Clipping planes
            // consist of two planes: near and far along the view direction. The
            // near plane clips out objects in front of the plane; the far plane
            // clips out objects behind the plane. This way only what is drawn
            // between the planes is actually rendered.
            _render.ResetCameraClippingRange();

            // Initialize the event loop and then start it.
            iren.Initialize();
            iren.Start();
            return(0);
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
       this.renderWindowControl1 = new Kitware.VTK.RenderWindowControl();
       this.timer1 = new System.Windows.Forms.Timer(this.components);
       this.SuspendLayout();
       //
       // renderWindowControl1
       //
       this.renderWindowControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
           | System.Windows.Forms.AnchorStyles.Left)
           | System.Windows.Forms.AnchorStyles.Right)));
       this.renderWindowControl1.Location = new System.Drawing.Point(0, 0);
       this.renderWindowControl1.Margin = new System.Windows.Forms.Padding(0);
       this.renderWindowControl1.Name = "renderWindowControl1";
       this.renderWindowControl1.Size = new System.Drawing.Size(400, 300);
       this.renderWindowControl1.TabIndex = 0;
       //
       // timer1
       //
       this.timer1.Enabled = true;
       this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
       //
       // Form1
       //
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.ClientSize = new System.Drawing.Size(400, 300);
       this.Controls.Add(this.renderWindowControl1);
       this.Name = "Form1";
       this.Text = "Form1";
       this.Load += new System.EventHandler(this.Form1_Load);
       this.ResumeLayout(false);
 }
        private void Form1_Load(object sender, EventArgs e)
        {
            AddConeSourceToRenderWindow(this.renderWindowControl1.RenderWindow);
              AddConeSourceToSecondRenderWindow();

              Kitware.VTK.RenderWindowControl ctl2 = new Kitware.VTK.RenderWindowControl();
              ctl2.Dispose();
        }
Пример #14
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 8 "..\..\..\..\Frames\MainWindow.xaml"
     ((EmbryoSegmenter.Frames.MainWindow)(target)).PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.Window_PreviewKeyDown);
     
     #line default
     #line hidden
     
     #line 8 "..\..\..\..\Frames\MainWindow.xaml"
     ((EmbryoSegmenter.Frames.MainWindow)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown);
     
     #line default
     #line hidden
     
     #line 9 "..\..\..\..\Frames\MainWindow.xaml"
     ((EmbryoSegmenter.Frames.MainWindow)(target)).KeyUp += new System.Windows.Input.KeyEventHandler(this.Window_KeyUp);
     
     #line default
     #line hidden
     
     #line 10 "..\..\..\..\Frames\MainWindow.xaml"
     ((EmbryoSegmenter.Frames.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);
     
     #line default
     #line hidden
     return;
     case 2:
     this.grd_Menu = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.mnu_Main = ((System.Windows.Controls.Menu)(target));
     return;
     case 4:
     
     #line 20 "..\..\..\..\Frames\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.mnu_New_Project_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     
     #line 22 "..\..\..\..\Frames\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.mnu_Open_Series_Click);
     
     #line default
     #line hidden
     return;
     case 6:
     
     #line 23 "..\..\..\..\Frames\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.mnu_Open_Stack_Click);
     
     #line default
     #line hidden
     return;
     case 7:
     this.mnu_Save_Series = ((System.Windows.Controls.MenuItem)(target));
     
     #line 26 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Save_Series.Click += new System.Windows.RoutedEventHandler(this.mnu_Save_Series_Click);
     
     #line default
     #line hidden
     return;
     case 8:
     this.mnu_Save_Stack = ((System.Windows.Controls.MenuItem)(target));
     
     #line 27 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Save_Stack.Click += new System.Windows.RoutedEventHandler(this.mnu_Save_Stack_Click);
     
     #line default
     #line hidden
     return;
     case 9:
     this.mnu_Save_As_Series = ((System.Windows.Controls.MenuItem)(target));
     
     #line 30 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Save_As_Series.Click += new System.Windows.RoutedEventHandler(this.mnu_Save_As_Series_Click);
     
     #line default
     #line hidden
     return;
     case 10:
     this.mnu_Save_As_Stack = ((System.Windows.Controls.MenuItem)(target));
     
     #line 31 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Save_As_Stack.Click += new System.Windows.RoutedEventHandler(this.mnu_Save_As_Stack_Click);
     
     #line default
     #line hidden
     return;
     case 11:
     this.mnu_Export_Excel = ((System.Windows.Controls.MenuItem)(target));
     
     #line 34 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Export_Excel.Click += new System.Windows.RoutedEventHandler(this.mnu_Export_Excel_Click);
     
     #line default
     #line hidden
     return;
     case 12:
     
     #line 36 "..\..\..\..\Frames\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.mnu_Bmp_Save_Segments_Click);
     
     #line default
     #line hidden
     return;
     case 13:
     
     #line 37 "..\..\..\..\Frames\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.mnu_Bmp_Save_Outlines_Click);
     
     #line default
     #line hidden
     return;
     case 14:
     this.mnu_Save_OBJ = ((System.Windows.Controls.MenuItem)(target));
     
     #line 38 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Save_OBJ.Click += new System.Windows.RoutedEventHandler(this.mnu_Save_OBJ_Click);
     
     #line default
     #line hidden
     return;
     case 15:
     this.mnu_Save_Ann = ((System.Windows.Controls.MenuItem)(target));
     
     #line 39 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Save_Ann.Click += new System.Windows.RoutedEventHandler(this.mnu_Save_Ann_Click);
     
     #line default
     #line hidden
     return;
     case 16:
     this.mnu_3D_view = ((System.Windows.Controls.MenuItem)(target));
     return;
     case 17:
     this.mnu_3D_point = ((System.Windows.Controls.MenuItem)(target));
     
     #line 42 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_3D_point.Click += new System.Windows.RoutedEventHandler(this.mnu_3D_view_Click);
     
     #line default
     #line hidden
     return;
     case 18:
     this.mnu_3D_body = ((System.Windows.Controls.MenuItem)(target));
     
     #line 43 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_3D_body.Click += new System.Windows.RoutedEventHandler(this.mnu_3D_view_Click);
     
     #line default
     #line hidden
     return;
     case 19:
     this.mnu_Quit = ((System.Windows.Controls.MenuItem)(target));
     
     #line 45 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Quit.Click += new System.Windows.RoutedEventHandler(this.mnu_Quit_Click);
     
     #line default
     #line hidden
     return;
     case 20:
     this.mnu_Pipelines = ((System.Windows.Controls.MenuItem)(target));
     
     #line 48 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Pipelines.Click += new System.Windows.RoutedEventHandler(this.mnu_Pipelines_Click);
     
     #line default
     #line hidden
     return;
     case 21:
     this.mnu_Add_Stack = ((System.Windows.Controls.MenuItem)(target));
     
     #line 51 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Add_Stack.Click += new System.Windows.RoutedEventHandler(this.mnu_Add_Stack_Click);
     
     #line default
     #line hidden
     return;
     case 22:
     this.mnu_Remove_Stack = ((System.Windows.Controls.MenuItem)(target));
     
     #line 52 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Remove_Stack.Click += new System.Windows.RoutedEventHandler(this.mnu_Remove_Stack_Click);
     
     #line default
     #line hidden
     return;
     case 23:
     this.mnu_Sort_Slice = ((System.Windows.Controls.MenuItem)(target));
     
     #line 55 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Sort_Slice.Click += new System.Windows.RoutedEventHandler(this.mnu_Sort_Slice_Click);
     
     #line default
     #line hidden
     return;
     case 24:
     this.mnu_Rename_Slice = ((System.Windows.Controls.MenuItem)(target));
     
     #line 56 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Rename_Slice.Click += new System.Windows.RoutedEventHandler(this.mnu_Rename_Slice_Click);
     
     #line default
     #line hidden
     return;
     case 25:
     this.mnu_Remove_Segment = ((System.Windows.Controls.MenuItem)(target));
     
     #line 59 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Remove_Segment.Click += new System.Windows.RoutedEventHandler(this.mnu_Remove_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 26:
     this.mnu_Divide_Segment = ((System.Windows.Controls.MenuItem)(target));
     
     #line 60 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Divide_Segment.Click += new System.Windows.RoutedEventHandler(this.mnu_Divide_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 27:
     this.mnu_Add_Segment = ((System.Windows.Controls.MenuItem)(target));
     
     #line 61 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Add_Segment.Click += new System.Windows.RoutedEventHandler(this.mnu_Add_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 28:
     this.mnu_Rename_Segment = ((System.Windows.Controls.MenuItem)(target));
     
     #line 62 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Rename_Segment.Click += new System.Windows.RoutedEventHandler(this.mnu_Rename_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 29:
     this.mnu_View_3D = ((System.Windows.Controls.MenuItem)(target));
     
     #line 65 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_View_3D.Checked += new System.Windows.RoutedEventHandler(this.mnu_View_Switch_Checked);
     
     #line default
     #line hidden
     
     #line 65 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_View_3D.Unchecked += new System.Windows.RoutedEventHandler(this.mnu_View_Switch_Unchecked);
     
     #line default
     #line hidden
     return;
     case 30:
     this.mnu_View_Mini = ((System.Windows.Controls.MenuItem)(target));
     
     #line 66 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_View_Mini.Checked += new System.Windows.RoutedEventHandler(this.mnu_View_Switch_Checked);
     
     #line default
     #line hidden
     
     #line 66 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_View_Mini.Unchecked += new System.Windows.RoutedEventHandler(this.mnu_View_Switch_Unchecked);
     
     #line default
     #line hidden
     return;
     case 31:
     this.mnu_View_Annotation = ((System.Windows.Controls.MenuItem)(target));
     
     #line 67 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_View_Annotation.Checked += new System.Windows.RoutedEventHandler(this.mnu_View_Switch_Checked);
     
     #line default
     #line hidden
     
     #line 67 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_View_Annotation.Unchecked += new System.Windows.RoutedEventHandler(this.mnu_View_Switch_Unchecked);
     
     #line default
     #line hidden
     return;
     case 32:
     this.mnu_View_Segmentation = ((System.Windows.Controls.MenuItem)(target));
     
     #line 68 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_View_Segmentation.Checked += new System.Windows.RoutedEventHandler(this.mnu_View_Switch_Checked);
     
     #line default
     #line hidden
     
     #line 68 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_View_Segmentation.Unchecked += new System.Windows.RoutedEventHandler(this.mnu_View_Switch_Unchecked);
     
     #line default
     #line hidden
     return;
     case 33:
     this.grd_Main = ((System.Windows.Controls.Grid)(target));
     return;
     case 34:
     this.grd_Hidden = ((System.Windows.Controls.Grid)(target));
     return;
     case 35:
     this.txt_File = ((System.Windows.Controls.TextBox)(target));
     return;
     case 36:
     this.txt_Path = ((System.Windows.Controls.TextBox)(target));
     return;
     case 37:
     this.lbl_File = ((System.Windows.Controls.Label)(target));
     return;
     case 38:
     this.label2 = ((System.Windows.Controls.Label)(target));
     return;
     case 39:
     this.grd_Display_Mini = ((System.Windows.Controls.Grid)(target));
     return;
     case 40:
     this.grd_Display = ((System.Windows.Controls.Grid)(target));
     return;
     case 41:
     this.pnl_Image = ((System.Windows.Controls.Image)(target));
     return;
     case 42:
     this.pnl_Panel_Seg = ((PHICommon.DrawingCanvas)(target));
     return;
     case 43:
     this.pnl_Panel_Nuc = ((PHICommon.DrawingCanvas)(target));
     return;
     case 44:
     this.grd_Mouse_Position = ((System.Windows.Controls.Grid)(target));
     return;
     case 45:
     this._lbl_Mouse_Y = ((System.Windows.Controls.Label)(target));
     return;
     case 46:
     this._lbl_Mouse_X = ((System.Windows.Controls.Label)(target));
     return;
     case 47:
     this.lbl_Mouse_Y = ((System.Windows.Controls.Label)(target));
     return;
     case 48:
     this.lbl_Mouse_X = ((System.Windows.Controls.Label)(target));
     return;
     case 49:
     this.pnl_Annotation_Seg = ((PHICommon.DrawingCanvas)(target));
     return;
     case 50:
     this.pnl_Annotation_Nuc = ((PHICommon.DrawingCanvas)(target));
     return;
     case 51:
     this.pnl_User = ((PHICommon.DrawingCanvas)(target));
     
     #line 107 "..\..\..\..\Frames\MainWindow.xaml"
     this.pnl_User.MouseMove += new System.Windows.Input.MouseEventHandler(this.pnl_MouseMove);
     
     #line default
     #line hidden
     
     #line 107 "..\..\..\..\Frames\MainWindow.xaml"
     this.pnl_User.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.pnl_MouseDown);
     
     #line default
     #line hidden
     return;
     case 52:
     this.scl_Time = ((System.Windows.Controls.Primitives.ScrollBar)(target));
     
     #line 108 "..\..\..\..\Frames\MainWindow.xaml"
     this.scl_Time.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler<double>(this.scl_Time_ValueChanged);
     
     #line default
     #line hidden
     return;
     case 53:
     this.txt_Series_index = ((System.Windows.Controls.TextBox)(target));
     
     #line 109 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Series_index.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Series_index_TextChanged);
     
     #line default
     #line hidden
     return;
     case 54:
     this.grd_SharpGLControl = ((System.Windows.Controls.Grid)(target));
     return;
     case 55:
     this.pnl_SharpOpenGL = ((SharpGL.WPF.OpenGLControl)(target));
     
     #line 115 "..\..\..\..\Frames\MainWindow.xaml"
     this.pnl_SharpOpenGL.MouseMove += new System.Windows.Input.MouseEventHandler(this.OpenGLControl_MouseMove);
     
     #line default
     #line hidden
     
     #line 115 "..\..\..\..\Frames\MainWindow.xaml"
     this.pnl_SharpOpenGL.OpenGLDraw += new SharpGL.SceneGraph.OpenGLEventHandler(this.OpenGLControl_OpenGLDraw);
     
     #line default
     #line hidden
     
     #line 115 "..\..\..\..\Frames\MainWindow.xaml"
     this.pnl_SharpOpenGL.Resized += new SharpGL.SceneGraph.OpenGLEventHandler(this.OpenGLControl_Resized);
     
     #line default
     #line hidden
     
     #line 115 "..\..\..\..\Frames\MainWindow.xaml"
     this.pnl_SharpOpenGL.OpenGLInitialized += new SharpGL.SceneGraph.OpenGLEventHandler(this.OpenGLControl_OpenGLInitialized);
     
     #line default
     #line hidden
     return;
     case 56:
     this.wfh_renderControl = ((System.Windows.Forms.Integration.WindowsFormsHost)(target));
     return;
     case 57:
     this._renderControl = ((Kitware.VTK.RenderWindowControl)(target));
     return;
     case 58:
     this.grd_Controls = ((System.Windows.Controls.Grid)(target));
     return;
     case 59:
     this.grd_Segmentation = ((System.Windows.Controls.Grid)(target));
     return;
     case 60:
     this.tcl_Segmentation = ((System.Windows.Controls.TabControl)(target));
     return;
     case 61:
     this.tab_Con_Filter = ((System.Windows.Controls.TabItem)(target));
     return;
     case 62:
     this.grd_Con_Con = ((System.Windows.Controls.Grid)(target));
     return;
     case 63:
     this.btn_Capture_Segment_1 = ((System.Windows.Controls.Button)(target));
     
     #line 129 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Capture_Segment_1.Click += new System.Windows.RoutedEventHandler(this.btn_Capture_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 64:
     this.tab_Nei_Filter = ((System.Windows.Controls.TabItem)(target));
     return;
     case 65:
     this.grd_Con_Nei = ((System.Windows.Controls.Grid)(target));
     return;
     case 66:
     this.btn_Capture_Segment_2 = ((System.Windows.Controls.Button)(target));
     
     #line 134 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Capture_Segment_2.Click += new System.Windows.RoutedEventHandler(this.btn_Capture_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 67:
     this.tab_Wat_Filter = ((System.Windows.Controls.TabItem)(target));
     return;
     case 68:
     this.grd_Con_Wat = ((System.Windows.Controls.Grid)(target));
     return;
     case 69:
     this.btn_Capture_Segment_3 = ((System.Windows.Controls.Button)(target));
     
     #line 140 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Capture_Segment_3.Click += new System.Windows.RoutedEventHandler(this.btn_Capture_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 70:
     this.grd_3Dtools = ((System.Windows.Controls.Grid)(target));
     return;
     case 71:
     this.tcl_3Dtools = ((System.Windows.Controls.TabControl)(target));
     return;
     case 72:
     this.tab_3D_Render = ((System.Windows.Controls.TabItem)(target));
     return;
     case 73:
     this.grd_3D_Ren = ((System.Windows.Controls.Grid)(target));
     return;
     case 74:
     this.btn_Update_3D_Rendering = ((System.Windows.Controls.Button)(target));
     
     #line 151 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Update_3D_Rendering.Click += new System.Windows.RoutedEventHandler(this.btn_Update_3D_Rendering_Click);
     
     #line default
     #line hidden
     return;
     case 75:
     this.chb_3D_Display = ((System.Windows.Controls.CheckBox)(target));
     
     #line 152 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_3D_Display.Checked += new System.Windows.RoutedEventHandler(this.chb_3D_Display_Checked);
     
     #line default
     #line hidden
     
     #line 152 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_3D_Display.Unchecked += new System.Windows.RoutedEventHandler(this.chb_3D_Display_Checked);
     
     #line default
     #line hidden
     return;
     case 76:
     this.chb_3D_Display_mode = ((System.Windows.Controls.CheckBox)(target));
     return;
     case 77:
     this.grd_Annotation = ((System.Windows.Controls.Grid)(target));
     return;
     case 78:
     this.tcl_Annotation = ((System.Windows.Controls.TabControl)(target));
     
     #line 161 "..\..\..\..\Frames\MainWindow.xaml"
     this.tcl_Annotation.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.tcl_Annotation_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 79:
     this.tab_Ann_Stage = ((System.Windows.Controls.TabItem)(target));
     return;
     case 80:
     this.grd_Ann_Properties = ((System.Windows.Controls.Grid)(target));
     return;
     case 81:
     this.gbx_Ann_Stage = ((System.Windows.Controls.GroupBox)(target));
     return;
     case 82:
     this.cbx_Ann_Stage = ((System.Windows.Controls.ComboBox)(target));
     return;
     case 83:
     this.label56 = ((System.Windows.Controls.Label)(target));
     return;
     case 84:
     this.label57 = ((System.Windows.Controls.Label)(target));
     return;
     case 85:
     this.txt_Ann_Stage_Begin = ((System.Windows.Controls.TextBox)(target));
     
     #line 169 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_Stage_Begin.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_Stage);
     
     #line default
     #line hidden
     return;
     case 86:
     this.txt_Ann_Stage_End = ((System.Windows.Controls.TextBox)(target));
     
     #line 170 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_Stage_End.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_Stage);
     
     #line default
     #line hidden
     return;
     case 87:
     this.btn_Add_Stage = ((System.Windows.Controls.Button)(target));
     
     #line 171 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Add_Stage.Click += new System.Windows.RoutedEventHandler(this.btn_Add_Stage_Click);
     
     #line default
     #line hidden
     return;
     case 88:
     this.lbx_Ann_Stage = ((System.Windows.Controls.ListBox)(target));
     
     #line 172 "..\..\..\..\Frames\MainWindow.xaml"
     this.lbx_Ann_Stage.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbx_Ann_Stage_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 89:
     this.btn_Ann_Remove_Stage = ((System.Windows.Controls.Button)(target));
     
     #line 173 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Ann_Remove_Stage.Click += new System.Windows.RoutedEventHandler(this.btn_Ann_Remove_Stage_Click);
     
     #line default
     #line hidden
     return;
     case 90:
     this.gbx_Ann_Fragmentation = ((System.Windows.Controls.GroupBox)(target));
     return;
     case 91:
     this.cbx_Ann_Fragmentation = ((System.Windows.Controls.ComboBox)(target));
     return;
     case 92:
     this.label96 = ((System.Windows.Controls.Label)(target));
     return;
     case 93:
     this.label97 = ((System.Windows.Controls.Label)(target));
     return;
     case 94:
     this.txt_Ann_Fragmentation_Begin = ((System.Windows.Controls.TextBox)(target));
     
     #line 181 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_Fragmentation_Begin.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_Fragmentation);
     
     #line default
     #line hidden
     return;
     case 95:
     this.txt_Ann_Fragmentation_End = ((System.Windows.Controls.TextBox)(target));
     
     #line 182 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_Fragmentation_End.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_Fragmentation);
     
     #line default
     #line hidden
     return;
     case 96:
     this.btn_Add_Fragmentation = ((System.Windows.Controls.Button)(target));
     
     #line 183 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Add_Fragmentation.Click += new System.Windows.RoutedEventHandler(this.btn_Add_Fragmentation_Click);
     
     #line default
     #line hidden
     return;
     case 97:
     this.lbx_Ann_Fragmentation = ((System.Windows.Controls.ListBox)(target));
     
     #line 184 "..\..\..\..\Frames\MainWindow.xaml"
     this.lbx_Ann_Fragmentation.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbx_Ann_Fragmentation_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 98:
     this.btn_Ann_Remove_Fragmentation = ((System.Windows.Controls.Button)(target));
     
     #line 185 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Ann_Remove_Fragmentation.Click += new System.Windows.RoutedEventHandler(this.btn_Ann_Remove_Fragmentation_Click);
     
     #line default
     #line hidden
     return;
     case 99:
     this.cbx_Quality = ((System.Windows.Controls.ComboBox)(target));
     
     #line 189 "..\..\..\..\Frames\MainWindow.xaml"
     this.cbx_Quality.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cbx_Quality_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 100:
     this.label9 = ((System.Windows.Controls.Label)(target));
     return;
     case 101:
     this.tab_Ann_Outline = ((System.Windows.Controls.TabItem)(target));
     return;
     case 102:
     this.grd_Ann_Outline = ((System.Windows.Controls.Grid)(target));
     return;
     case 103:
     this.gbx_Nuclei = ((System.Windows.Controls.GroupBox)(target));
     return;
     case 104:
     this.label5 = ((System.Windows.Controls.Label)(target));
     return;
     case 105:
     this.chb_Ann_NewNuclei = ((System.Windows.Controls.CheckBox)(target));
     
     #line 198 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Ann_NewNuclei.Checked += new System.Windows.RoutedEventHandler(this.chb_Ann_NewNuclei_Checked);
     
     #line default
     #line hidden
     
     #line 198 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Ann_NewNuclei.Unchecked += new System.Windows.RoutedEventHandler(this.chb_Ann_NewNuclei_Checked);
     
     #line default
     #line hidden
     return;
     case 106:
     this.cbx_Color_Nuc = ((System.Windows.Controls.ComboBox)(target));
     
     #line 199 "..\..\..\..\Frames\MainWindow.xaml"
     this.cbx_Color_Nuc.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cbx_Color_Nuc_SelectionChanged);
     
     #line default
     #line hidden
     
     #line 199 "..\..\..\..\Frames\MainWindow.xaml"
     this.cbx_Color_Nuc.DropDownOpened += new System.EventHandler(this.cbx_Color_Nuc_DropDownOpened);
     
     #line default
     #line hidden
     return;
     case 107:
     this.label13 = ((System.Windows.Controls.Label)(target));
     return;
     case 108:
     this.chb_Annotation_Nuc = ((System.Windows.Controls.CheckBox)(target));
     
     #line 201 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Annotation_Nuc.Checked += new System.Windows.RoutedEventHandler(this.chb_Display_Checked);
     
     #line default
     #line hidden
     
     #line 201 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Annotation_Nuc.Unchecked += new System.Windows.RoutedEventHandler(this.chb_Display_Checked);
     
     #line default
     #line hidden
     return;
     case 109:
     this.chb_Outline_Nuc = ((System.Windows.Controls.CheckBox)(target));
     
     #line 202 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Outline_Nuc.Checked += new System.Windows.RoutedEventHandler(this.chb_Display_Checked);
     
     #line default
     #line hidden
     
     #line 202 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Outline_Nuc.Unchecked += new System.Windows.RoutedEventHandler(this.chb_Display_Checked);
     
     #line default
     #line hidden
     return;
     case 110:
     this.grd_Ann_Nuclei = ((System.Windows.Controls.Grid)(target));
     return;
     case 111:
     this.label6 = ((System.Windows.Controls.Label)(target));
     return;
     case 112:
     this.label7 = ((System.Windows.Controls.Label)(target));
     return;
     case 113:
     this.label8 = ((System.Windows.Controls.Label)(target));
     return;
     case 114:
     this.btn_Add_Nuclei = ((System.Windows.Controls.Button)(target));
     
     #line 207 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Add_Nuclei.Click += new System.Windows.RoutedEventHandler(this.btn_Add_Nuclei_Click);
     
     #line default
     #line hidden
     return;
     case 115:
     this.txt_Ann_NewNuclei_CenterX = ((System.Windows.Controls.TextBox)(target));
     
     #line 208 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_NewNuclei_CenterX.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_NewNuclei);
     
     #line default
     #line hidden
     return;
     case 116:
     this.txt_Ann_NewNuclei_CenterY = ((System.Windows.Controls.TextBox)(target));
     
     #line 209 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_NewNuclei_CenterY.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_NewNuclei);
     
     #line default
     #line hidden
     return;
     case 117:
     this.txt_Ann_NewNuclei_Radius = ((System.Windows.Controls.TextBox)(target));
     
     #line 210 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_NewNuclei_Radius.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_NewNuclei);
     
     #line default
     #line hidden
     return;
     case 118:
     this.lbx_Ann_Nuclei = ((System.Windows.Controls.ListBox)(target));
     
     #line 211 "..\..\..\..\Frames\MainWindow.xaml"
     this.lbx_Ann_Nuclei.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbx_Ann_Nuclei_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 119:
     this.btn_Ann_Remove_Nuclei = ((System.Windows.Controls.Button)(target));
     
     #line 212 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Ann_Remove_Nuclei.Click += new System.Windows.RoutedEventHandler(this.btn_Ann_Remove_Nuclei_Click);
     
     #line default
     #line hidden
     return;
     case 120:
     this.gbx_Cell = ((System.Windows.Controls.GroupBox)(target));
     return;
     case 121:
     this.label54 = ((System.Windows.Controls.Label)(target));
     return;
     case 122:
     this.chb_Ann_NewSegment = ((System.Windows.Controls.CheckBox)(target));
     
     #line 219 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Ann_NewSegment.Checked += new System.Windows.RoutedEventHandler(this.chb_Ann_NewSegment_Checked);
     
     #line default
     #line hidden
     
     #line 219 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Ann_NewSegment.Unchecked += new System.Windows.RoutedEventHandler(this.chb_Ann_NewSegment_Checked);
     
     #line default
     #line hidden
     return;
     case 123:
     this.cbx_Color_Seg = ((System.Windows.Controls.ComboBox)(target));
     
     #line 220 "..\..\..\..\Frames\MainWindow.xaml"
     this.cbx_Color_Seg.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cbx_Color_Seg_SelectionChanged);
     
     #line default
     #line hidden
     
     #line 220 "..\..\..\..\Frames\MainWindow.xaml"
     this.cbx_Color_Seg.DropDownOpened += new System.EventHandler(this.cbx_Color_Seg_DropDownOpened);
     
     #line default
     #line hidden
     return;
     case 124:
     this.label1 = ((System.Windows.Controls.Label)(target));
     return;
     case 125:
     this.chb_Annotation_Seg = ((System.Windows.Controls.CheckBox)(target));
     
     #line 222 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Annotation_Seg.Checked += new System.Windows.RoutedEventHandler(this.chb_Display_Checked);
     
     #line default
     #line hidden
     
     #line 222 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Annotation_Seg.Unchecked += new System.Windows.RoutedEventHandler(this.chb_Display_Checked);
     
     #line default
     #line hidden
     return;
     case 126:
     this.chb_Outline_Seg = ((System.Windows.Controls.CheckBox)(target));
     
     #line 223 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Outline_Seg.Checked += new System.Windows.RoutedEventHandler(this.chb_Display_Checked);
     
     #line default
     #line hidden
     
     #line 223 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Outline_Seg.Unchecked += new System.Windows.RoutedEventHandler(this.chb_Display_Checked);
     
     #line default
     #line hidden
     return;
     case 127:
     this.grd_Ann_Segment = ((System.Windows.Controls.Grid)(target));
     return;
     case 128:
     this.label47 = ((System.Windows.Controls.Label)(target));
     return;
     case 129:
     this.label48 = ((System.Windows.Controls.Label)(target));
     return;
     case 130:
     this.txt_Ann_NewSegment_StartX = ((System.Windows.Controls.TextBox)(target));
     
     #line 227 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_NewSegment_StartX.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_NewSegment);
     
     #line default
     #line hidden
     return;
     case 131:
     this.txt_Ann_NewSegment_StartY = ((System.Windows.Controls.TextBox)(target));
     
     #line 228 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Ann_NewSegment_StartY.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_Validate_NewSegment);
     
     #line default
     #line hidden
     return;
     case 132:
     this.btn_Add_Segment = ((System.Windows.Controls.Button)(target));
     
     #line 229 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Add_Segment.Click += new System.Windows.RoutedEventHandler(this.btn_Add_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 133:
     this.lbx_Ann_Segment = ((System.Windows.Controls.ListBox)(target));
     
     #line 230 "..\..\..\..\Frames\MainWindow.xaml"
     this.lbx_Ann_Segment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbx_Ann_Segment_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 134:
     this.btn_Ann_Remove_Segment = ((System.Windows.Controls.Button)(target));
     
     #line 231 "..\..\..\..\Frames\MainWindow.xaml"
     this.btn_Ann_Remove_Segment.Click += new System.Windows.RoutedEventHandler(this.btn_Ann_Remove_Segment_Click);
     
     #line default
     #line hidden
     return;
     case 135:
     this.grd_Navigator = ((System.Windows.Controls.Grid)(target));
     return;
     case 136:
     this.lbx_Slice = ((System.Windows.Controls.ListBox)(target));
     
     #line 243 "..\..\..\..\Frames\MainWindow.xaml"
     this.lbx_Slice.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbx_Slice_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 137:
     this.lbx_Segment = ((System.Windows.Controls.ListBox)(target));
     
     #line 244 "..\..\..\..\Frames\MainWindow.xaml"
     this.lbx_Segment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbx_Segment_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 138:
     this.label3 = ((System.Windows.Controls.Label)(target));
     return;
     case 139:
     this.label4 = ((System.Windows.Controls.Label)(target));
     return;
     case 140:
     this.txt_Volume = ((System.Windows.Controls.TextBox)(target));
     return;
     case 141:
     this.lbl_Volume = ((System.Windows.Controls.Label)(target));
     return;
     case 142:
     this.lbl_Area = ((System.Windows.Controls.Label)(target));
     return;
     case 143:
     this.txt_Area = ((System.Windows.Controls.TextBox)(target));
     return;
     case 144:
     this.txt_Z = ((System.Windows.Controls.TextBox)(target));
     
     #line 251 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_Z.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_scale_TextChanged);
     
     #line default
     #line hidden
     return;
     case 145:
     this.lbl_Z = ((System.Windows.Controls.Label)(target));
     return;
     case 146:
     this.lbl_XY = ((System.Windows.Controls.Label)(target));
     return;
     case 147:
     this.txt_XY = ((System.Windows.Controls.TextBox)(target));
     
     #line 254 "..\..\..\..\Frames\MainWindow.xaml"
     this.txt_XY.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txt_scale_TextChanged);
     
     #line default
     #line hidden
     return;
     case 148:
     this.lbl_Time = ((System.Windows.Controls.Label)(target));
     return;
     case 149:
     this.txt_Time = ((System.Windows.Controls.TextBox)(target));
     return;
     case 150:
     this._grd_Log = ((System.Windows.Controls.Grid)(target));
     return;
     case 151:
     this.mnu_Clear_Log = ((System.Windows.Controls.MenuItem)(target));
     
     #line 264 "..\..\..\..\Frames\MainWindow.xaml"
     this.mnu_Clear_Log.Click += new System.Windows.RoutedEventHandler(this.mnu_Clear_Log_Click);
     
     #line default
     #line hidden
     return;
     case 152:
     this._txt_Log = ((System.Windows.Controls.TextBox)(target));
     return;
     case 153:
     this.chb_Logging = ((System.Windows.Controls.CheckBox)(target));
     
     #line 268 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Logging.Unchecked += new System.Windows.RoutedEventHandler(this.chb_Logging_Checked);
     
     #line default
     #line hidden
     
     #line 268 "..\..\..\..\Frames\MainWindow.xaml"
     this.chb_Logging.Checked += new System.Windows.RoutedEventHandler(this.chb_Logging_Checked);
     
     #line default
     #line hidden
     return;
     case 154:
     this.button1 = ((System.Windows.Controls.Button)(target));
     
     #line 269 "..\..\..\..\Frames\MainWindow.xaml"
     this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
Пример #15
0
        //private void InitializeVTK()
        //{
        //    Kitware.VTK.RenderWindowControl vtkControl = new Kitware.VTK.RenderWindowControl();
        //    vtkControl.AddTestActors = false;
        //    vtkControl.Location = new System.Drawing.Point(10, 10);
        //    vtkControl.Name = "_renwin";
        //    vtkControl.Size = new System.Drawing.Size(100, 100);
        //    vtkControl.TabIndex = 0;
        //    vtkControl.TestText = null;
        //    vtkControl.Dock = System.Windows.Forms.DockStyle.Fill;
        //    vtkformhost.Child = vtkControl;
        //    vtkformhost.Visibility = System.Windows.Visibility.Visible;

        //    vtkSphereSource sphere = vtkSphereSource.New();
        //    sphere.SetThetaResolution(8);
        //    sphere.SetPhiResolution(16);

        //    vtkShrinkPolyData shrink = vtkShrinkPolyData.New();
        //    shrink.SetInputConnection(sphere.GetOutputPort());
        //    shrink.SetShrinkFactor(0.9);

        //    vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
        //    mapper.SetInputConnection(shrink.GetOutputPort());

        //    // The actor links the data pipeline to the rendering subsystem
        //    vtkActor actor = vtkActor.New();
        //    actor.SetMapper(mapper);
        //    actor.GetProperty().SetColor(1, 0, 0);

        //    // Create components of the rendering subsystem
        //    //
        //    Kitware.VTK.vtkRendererCollection rs = vtkControl.RenderWindow.GetRenderers();
        //    vtkRenderer ren1 = vtkControl.RenderWindow.GetRenderers().GetFirstRenderer();
        //    vtkRenderWindow renWin = vtkControl.RenderWindow;

        //    // Add the actors to the renderer, set the window size
        //    //
        //    ren1.AddViewProp(actor);
        //    renWin.SetSize(500, 500);
        //    renWin.Render();
        //    vtkCamera camera = ren1.GetActiveCamera();
        //    camera.Zoom(1.5);

        //}


        private void InitializeVTK()
        {
            Kitware.VTK.RenderWindowControl rw = new Kitware.VTK.RenderWindowControl();

            rw.AddTestActors       = false;
            rw.Dock                = System.Windows.Forms.DockStyle.Fill;
            vtkformhost.Child      = rw;
            vtkformhost.Visibility = System.Windows.Visibility.Visible;
            Kitware.VTK.vtkRendererCollection rs = rw.RenderWindow.GetRenderers();
            int rsc = rs.GetNumberOfItems();

            Console.WriteLine(rsc + " renderers");
            Kitware.VTK.vtkRenderer r = rs.GetFirstRenderer();
            r.SetBackground(0.1, 0.3, 0.7);
            r.SetBackground2(0.7, 0.8, 1.0);
            r.SetGradientBackground(true);

            int   i, j, k, kOffset, jOffset, offset;
            float s, sp, x, y, z;

            //创建结构化点数据集,(创建点和单元)
            vtkStructuredPoints vol = new vtkStructuredPoints();

            vol.SetDimensions(26, 26, 26);   //x,y,z三个坐标轴方向上各有26个点
            vol.SetOrigin(-0.5, -0.5, -0.5); //设置数据集在坐标空间内的起点
            sp = (float)(1.0 / 25.0);
            vol.SetSpacing(sp, sp, sp);      //设置坐标轴上每个点的间距

            //创建标量数据(作为结构化点数据集的属性数据)
            vtkFloatArray scalars = new vtkFloatArray();

            scalars.SetNumberOfTuples(26 * 26 * 26);//设置标量个数,因为是点属性所以和点的个数相同

            for (k = 0; k < 26; k++)
            {
                z       = (float)(-0.5 + k * sp);
                kOffset = k * 26 * 26;
                for (j = 0; j < 26; j++)
                {
                    y       = (float)(-0.5 + j * sp);
                    jOffset = j * 26;
                    for (i = 0; i < 26; i++)
                    {
                        x = (float)(-0.5 + i * sp);
                        s = (float)(x * x + y * y + z * z - (0.4 * 0.4));
                        //计算标量值,该方程为球体方程,位于球体上的点标量值为0
                        offset = i + jOffset + kOffset;  //计算id
                        scalars.InsertTuple1(offset, s); //插入标量值
                    }
                }
            }

            vol.GetPointData().SetScalars(scalars); //将标量值与点关联


            //抽取标量值为0的点所形成的面
            vtkContourFilter contour = new vtkContourFilter();

            contour.SetInput(vol);
            contour.SetValue(0, 0);

            vtkPolyDataMapper volmapper = new vtkPainterPolyDataMapper();

            volmapper.SetInput(contour.GetOutput());

            vtkActor actor = new vtkActor();

            actor.GetProperty().SetRepresentationToWireframe();
            // actor.GetProperty().SetRepresentationToSurface();
            // actor.GetProperty().SetRepresentationToPoints();
            actor.GetProperty().SetColor(0, 0, 0);
            actor.SetMapper(volmapper);

            vtkRenderWindow _renwin = rw.RenderWindow;
            vtkRenderer     _render = _renwin.GetRenderers().GetFirstRenderer();

            _render.AddActor(actor);

            _renwin.Render();

            _render.ResetCamera();
        }
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // OBJECT
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Initializes a new instance of the <see cref="TextDocumentItemViewModel"/> class.
        /// </summary>
        public VTKDocumentItemViewModel(VTKDataModel dataModel)
        {
            this.Title = string.Format("VTK Doc {0}", counter++);
            this.Text = string.Format("Dynamically created at {0}", DateTime.Now);
            this.Description = "VTK document";
            this.vtkData = dataModel;

            this.CellAttributeArrayNames = new ObservableCollection<string>();
            this.CellAttributeArrayNames.Add(this.vtkData.CellIdsArrayName);
            this.CellAttributeArrayNames.Add(this.vtkData.CellTypeArrayName);
            this.cellColorArrayName = this.CellAttributeArrayNames[0];
            this.cellColorMapSpaceModel = ColorSpaceModel.HSV;

            // create a VTK output control and make the forms host point to it
            rwc = new RenderWindowControl();
            wfh = new WindowsFormsHost();
            wfh.Child = rwc;
            rwc.CreateGraphics();
            rwc.RenderWindow.SetCurrentCursor(9);

            vtkInteractorStyleSwitch istyle = vtkInteractorStyleSwitch.New();
            rwc.RenderWindow.GetInteractor().SetInteractorStyle(istyle);
            rwc.RenderWindow.GetInteractor().SetPicker(vtkCellPicker.New());
            (istyle).SetCurrentStyleToTrackballCamera();

            rwc.RenderWindow.GetInteractor().LeftButtonPressEvt += new vtkObject.vtkObjectEventHandler(leftMouseDown);

            // set up basic viewing
            ren = rwc.RenderWindow.GetRenderers().GetFirstRenderer();
            vtkCamera camera = ren.GetActiveCamera();

            // background color
            ren.SetBackground(0.1, 0.1, 0.1);

            vtkSphereSource sph = vtkSphereSource.New();
            sph.SetThetaResolution(16);
            sph.SetPhiResolution(16);
            sph.SetRadius(0.02);

            vtkGlyph3D glyp = vtkGlyph3D.New();
            glyp.SetSourceConnection(sph.GetOutputPort(0));
            glyp.SetInputConnection(this.vtkData.OutputPort);
            glyp.ScalingOff();
            glyp.OrientOff();

            ctf = vtkColorTransferFunction.New();
            ctf_min_color = System.Windows.Media.Color.FromRgb(0, 128, 255);
            ctf_max_color = System.Windows.Media.Color.FromRgb(64, 255, 64);
            this.BuildCTF();

            //lut.SetValueRange(0.5, 1.0);
            //lut.SetSaturationRange(0.1, 1.0);
            //lut.SetHueRange(0.4, 0.6);
            //lut.SetAlphaRange(0.2, 1.0);
            //lut.SetRampToLinear();
            //lut.Build();

            mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection(glyp.GetOutputPort());
            mapper.SetLookupTable(ctf);
            mapper.ScalarVisibilityOn();
            mapper.SetScalarModeToUsePointFieldData();
            mapper.SelectColorArray(this.cellColorArrayName);
            // scalar range doens't affect anything when using a ctf (instead of a lut)
            // mapper.SetScalarRange(0, this.vtkData.NumPoints - 1);

            vtkActor actor = vtkActor.New();
            actor.SetMapper(mapper);
            //actor.GetProperty().SetRepresentationToWireframe();
            actor.GetProperty().SetRepresentationToSurface();
            rwc.RenderWindow.GetRenderers().GetFirstRenderer().AddViewProp(actor);
            ren.ResetCamera();
        }
Пример #17
0
        private void Window_Activated(object sender, EventArgs e)
        {
            vtkPolyData   cube    = new vtkPolyData();
            vtkPoints     points  = new vtkPoints();
            vtkCellArray  polys   = new vtkCellArray();
            vtkFloatArray scalars = new vtkFloatArray();

            Kitware.VTK.RenderWindowControl vtkControl = new Kitware.VTK.RenderWindowControl();
            vtkControl.AddTestActors = false;
            vtkControl.Location      = new System.Drawing.Point(10, 10);
            vtkControl.Name          = "_renwin";
            vtkControl.Size          = new System.Drawing.Size(100, 100);
            vtkControl.TabIndex      = 0;
            vtkControl.TestText      = null;
            vtkControl.Dock          = System.Windows.Forms.DockStyle.Fill;
            vtkformhost.Child        = vtkControl;
            vtkformhost.Visibility   = System.Windows.Visibility.Visible;


            int i;

            float[][] x = new float[8][]
            {
                new float[] { 0, 0, 0 }, //第0个点的坐标
                new float[] { 1, 0, 0 }, //第1个点的坐标
                new float[] { 1, 1, 0 }, //第2个点的坐标
                new float[] { 0, 1, 0 }, //3
                new float[] { 0, 0, 1 }, //4
                new float[] { 1, 0, 1 }, //5
                new float[] { 1, 1, 1 }, //6
                new float[] { 0, 1, 1 } //7
            };
            for (i = 0; i < 8; i++)
            {
                points.InsertPoint(i, x[i][0], x[i][1], x[i][2]);                    //加载点,创建数据结构的几何
            }
            List <int[]> temp = new List <int[]>();

            int[] temparray0 = new int[4] {
                0, 1, 2, 3
            };                                           //第0,1,2,3个点连接在一起,成为一个单元
            int[] temparray1 = new int[4] {
                4, 5, 6, 7
            };                                           //第4,5,6,7个点连接在一起,成为一个单元
            int[] temparray2 = new int[4] {
                0, 1, 5, 4
            };
            int[] temparray3 = new int[4] {
                1, 2, 6, 5
            };
            int[] temparray4 = new int[4] {
                2, 3, 7, 6
            };
            int[] temparray5 = new int[4] {
                3, 0, 4, 7
            };
            temp.Add(temparray0);
            temp.Add(temparray1);
            temp.Add(temparray2);
            temp.Add(temparray3);
            temp.Add(temparray4);
            temp.Add(temparray5);
            //因为在activiz中没有vtkIdType这个类,所以用了其他的方法代替C++代码中的实现。
            for (int j = 0; j < temp.Count; j++)
            {
                IntPtr pP = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * 4);
                Marshal.Copy(temp[j], 0, pP, 4);
                polys.InsertNextCell(4, pP);//加载单元,定义数据集的拓扑
                Marshal.FreeHGlobal(pP);
            }
            for (i = 0; i < 8; i++)
            {
                scalars.InsertTuple1(i, i);                    //为每一个点设置点属性。
            }
            cube.SetPoints(points);
            cube.SetPolys(polys);
            cube.GetPointData().SetScalars(scalars);

            vtkPolyDataMapper cubemapper = new vtkPainterPolyDataMapper();

            cubemapper.SetInput(cube);
            cubemapper.SetScalarRange(0, 7);

            vtkActor cubeactor = new vtkActor();

            cubeactor.SetMapper(cubemapper);

            // Create components of the rendering subsystem
            //
            vtkRenderWindow _renwin = vtkControl.RenderWindow;
            vtkRenderer     ren1    = _renwin.GetRenderers().GetFirstRenderer();


            // Add the actors to the renderer, set the window size
            //
            ren1.AddViewProp(cubeactor);
            _renwin.SetSize(250, 250);
            _renwin.Render();
            ren1.ResetCamera();
        }
Пример #18
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.treeColumn = ((System.Windows.Controls.ColumnDefinition)(target));
     return;
     case 2:
     this.deviceColumn = ((System.Windows.Controls.ColumnDefinition)(target));
     return;
     case 3:
     this.treeView = ((System.Windows.Controls.TreeView)(target));
     return;
     case 4:
     this.SimulationPanel = ((System.Windows.Controls.DockPanel)(target));
     return;
     case 5:
     this.WFHost = ((System.Windows.Forms.Integration.WindowsFormsHost)(target));
     
     #line 64 "..\..\..\MainWindow.xaml"
     this.WFHost.Loaded += new System.Windows.RoutedEventHandler(this.WFHost_Loaded);
     
     #line default
     #line hidden
     return;
     case 6:
     this.renderControl = ((Kitware.VTK.RenderWindowControl)(target));
     return;
     case 7:
     this.buttonTree = ((System.Windows.Controls.Button)(target));
     
     #line 68 "..\..\..\MainWindow.xaml"
     this.buttonTree.Click += new System.Windows.RoutedEventHandler(this.buttonTree_Click);
     
     #line default
     #line hidden
     return;
     case 8:
     this.buttonRobot = ((System.Windows.Controls.Button)(target));
     
     #line 70 "..\..\..\MainWindow.xaml"
     this.buttonRobot.Click += new System.Windows.RoutedEventHandler(this.buttonRobot_Click);
     
     #line default
     #line hidden
     return;
     case 9:
     this.buttonSensor = ((System.Windows.Controls.Button)(target));
     
     #line 75 "..\..\..\MainWindow.xaml"
     this.buttonSensor.Click += new System.Windows.RoutedEventHandler(this.buttonSensor_Click);
     
     #line default
     #line hidden
     return;
     case 10:
     this.tabControl = ((System.Windows.Controls.TabControl)(target));
     return;
     }
     this._contentLoaded = true;
 }
        private void SetUpRenderWindow()
        {
            // create a VTK output control and make the forms host point to it
            rwc = new RenderWindowControl();
            rwc.CreateGraphics();
            windowsFormsHost.Child = rwc;

            // set up basic viewing
            vtkRenderer ren = rwc.RenderWindow.GetRenderers().GetFirstRenderer();

            // background color
            ren.SetBackground(0.0, 0.0, 0.0);

            // interactor style
            vtkInteractorStyleSwitch istyle = vtkInteractorStyleSwitch.New();
            rwc.RenderWindow.GetInteractor().SetInteractorStyle(istyle);
            rwc.RenderWindow.GetInteractor().SetPicker(vtkCellPicker.New());
            (istyle).SetCurrentStyleToTrackballCamera();

            // Demonstrate how to use the vtkBoxWidget 3D widget,
            vtkSphereSource sphere = vtkSphereSource.New();
            sphere.SetRadius(0.25);

            vtkPolyDataMapper sphereMapper = vtkPolyDataMapper.New();
            sphereMapper.SetInputConnection(sphere.GetOutputPort());

            vtkActor sphereActor;
            vtkTransform widgetTransform = vtkTransform.New();
            List<Region> region_list = configurator.SimConfig.scenario.regions.ToList();
            for (int ii = 0; ii < region_list.Count; ++ii)
            {
                this.TransferMatrixToVTKTransform(region_list[ii].region_box_spec.transform_matrix, widgetTransform);
                sphereActor = vtkActor.New();
                sphereActor.SetMapper(sphereMapper);
                sphereActor.SetUserTransform(widgetTransform);
                sphereActor.GetProperty().SetOpacity(0.5);
                sphereActor.SetVisibility(region_list[ii].region_visibility ? 1 : 0);
                sphereActorList.Add(sphereActor);
                ren.AddActor(sphereActorList[ii]);
            }

            vtkCubeSource cube = vtkCubeSource.New();
            cube.SetXLength(5.0);
            cube.SetYLength(5.0);
            cube.SetZLength(5.0);

            vtkOutlineSource outline = vtkOutlineSource.New();
            outline.SetBounds(-2, 2, -2, 2, -2, 2);

            vtkPolyDataMapper cubeMapper = vtkPolyDataMapper.New();
            cubeMapper.SetInputConnection(outline.GetOutputPort());

            vtkLODActor cubeActor = vtkLODActor.New();
            cubeActor.SetMapper(cubeMapper);
            cubeActor.VisibilityOn();

            ren.AddActor(cubeActor);

            boxRep = vtkBoxRepresentation.New();
            boxRep.SetTransform(widgetTransform);

            boxWidget = vtkBoxWidget2.New();
            boxWidget.SetInteractor( rwc.RenderWindow.GetInteractor() );
            boxWidget.SetRepresentation( boxRep );
            boxWidget.SetPriority(1);
            boxWidget.InteractionEvt += this.boxInteractionCallback;

            ren.ResetCamera();
        }