コード例 #1
0
        /// <summary>
        /// Update 3d view after directory has changed.
        /// </summary>
        /// <param name="dicomLoader">Updated dicom loader.</param>
        public void ChangeDirectory(DicomLoader dicomLoader)
        {
            _dicomLoader = dicomLoader;
            _mapper.Dispose();
            _mapper = vtkSmartVolumeMapper.New();
            _mapper.SetInput(_dicomLoader.GetOutput());
            _mapper.Update();

            _window.RenderWindow.GetRenderers().GetFirstRenderer().RemoveVolume(_volume);
            _volume.Dispose();
            _volume = vtkVolume.New();
            _volume.SetMapper(_mapper);
            _volume.Update();

            _window.RenderWindow.GetRenderers().GetFirstRenderer().AddVolume(_volume);
            _window.RenderWindow.GetRenderers().GetFirstRenderer().Render();

            SetupPlane(PlaneWidgetX);
            SetupPlane(PlaneWidgetY);
            SetupPlane(PlaneWidgetZ);

            // Render
            _window.RenderWindow.Render();
            _window.Validate();
            _window.Update();

            _clipingModule = new ClipingObject(GetObjectSize());
        }
コード例 #2
0
        private void createVisialization3D()
        {
            if (_directoryPath != null)
            {
                _dicomLoader = new DicomLoader(_directoryPath);
                if (_dicomLoader.GetErrorCode() != 0)
                {
                    MessageBox.Show("Cannot load directory.",
                                    "Loading error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }

                _vizualization3D = new Visualization3D(fourthWindow, _dicomLoader);
                _vizualization3D.ChangeColorAndOpacityFunction(PresetInfo);


                //moving planes
                _vizualization3D.PlaneWidgetX.InteractionEvt += PlaneXMoved;
                _vizualization3D.PlaneWidgetY.InteractionEvt += PlaneYMoved;
                _vizualization3D.PlaneWidgetZ.InteractionEvt += PlaneZMoved;

                //handling events from ClipingToolbox
                clipingPanel.ClipingOperationEventHandlerDelegate += new EventHandler <ClipingEventArgs>(_vizualization3D.ExecuteClipingOperation);
                clipingPanel.InitialiseClipingToolbox(_vizualization3D.GetObjectSize());

                fourthWindow.RenderWindow.Render();
            }
        }
コード例 #3
0
        //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());
        }
コード例 #4
0
        //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());
        }
コード例 #5
0
        //TODO

        /// <summary>
        /// Update the 2D visualization window with new slice of pass X, Y or Z coordination.
        /// </summary>
        /// <param name="dicomLoader"> Dicom input from we are going to cut the slice.</param>
        /// <param name="slicePosition">Coordinates of the slice. </param>
        /// <param name="axis">Name of axis to set cut orientation (X,Y,Z). </param>
        public void SliceToAxes(DicomLoader dicomLoader, float slicePosition, Axis axis)
        {
            vtkImagePlaneWidget planeWidget = vtkImagePlaneWidget.New();

            planeWidget.SetInput(dicomLoader.GetOutput());
            if (axis == Axis.X)
            {
                planeWidget.SetPlaneOrientationToXAxes();
            }
            else if (axis == Axis.Y)
            {
                planeWidget.SetPlaneOrientationToYAxes();
            }
            else if (axis == Axis.Z)
            {
                planeWidget.SetPlaneOrientationToZAxes();
            }
            planeWidget.SetSliceIndex((int)slicePosition);
            _viewer.SetInput(planeWidget.GetResliceOutput());
            planeWidget.Dispose();

            UpdateViewer();
        }
コード例 #6
0
        /// <summary>
        /// Update the 2D visualization window with new slice of pass X, Y or Z coordination. 
        /// </summary>
        /// <param name="dicomLoader"> Dicom input from we are going to cut the slice.</param>
        /// <param name="slicePosition">Coordinates of the slice. </param>
        /// <param name="axis">Name of axis to set cut orientation (X,Y,Z). </param>
        public void SliceToAxes(DicomLoader dicomLoader, float slicePosition, Axis axis)
        {
            vtkImagePlaneWidget planeWidget = vtkImagePlaneWidget.New();
            planeWidget.SetInput(dicomLoader.GetOutput());
            if (axis == Axis.X)
            {
                planeWidget.SetPlaneOrientationToXAxes();
            }
            else if (axis == Axis.Y)
            {
                planeWidget.SetPlaneOrientationToYAxes();
            }
            else if (axis == Axis.Z)
            {
                planeWidget.SetPlaneOrientationToZAxes();
            }
            planeWidget.SetSliceIndex((int)slicePosition);
            _viewer.SetInput(planeWidget.GetResliceOutput());
            planeWidget.Dispose();

            UpdateViewer();
        }
コード例 #7
0
 public Form1()
 {
     InitializeComponent();
     _dicomLoader = new DicomLoader(_directoryPath);
 }
コード例 #8
0
        public void ChangeDirectory(DicomLoader dicomLoader)
        {
            _dicomLoader = dicomLoader;
            _mapper.Dispose();
            _mapper = vtkSmartVolumeMapper.New();
            _mapper.SetInput(_dicomLoader.GetOutput());
            _mapper.Update();

            _window.RenderWindow.GetRenderers().GetFirstRenderer().RemoveVolume(_volume);
            _volume.Dispose();
            _volume = vtkVolume.New();
            SetOpacityFunction();
            SetGradientOpacity();
            _volume.SetMapper(_mapper);
            _volume.Update();

            _window.RenderWindow.GetRenderers().GetFirstRenderer().AddVolume(_volume);
            _window.RenderWindow.GetRenderers().GetFirstRenderer().Render();

            SetupPlane(PlaneWidgetX);
            SetupPlane(PlaneWidgetY);
            SetupPlane(PlaneWidgetZ);

            // Render
            _window.RenderWindow.Render();
            _window.Validate();
            _window.Update();

            _clipingModule = new ClipingModule(GetObjectSize());
        }
コード例 #9
0
 public Form1()
 {
     InitializeComponent();
     InitImageExport();
     _dicomLoader = new DicomLoader(_directoryPath);
 }
コード例 #10
0
 public Form2(DicomLoader dicomLoader)
 {
     InitializeComponent();
     _dicomLoader = dicomLoader;
 }
コード例 #11
0
        private void createVisialization3D()
        {
            if (_directoryPath != null)
            {
                _dicomLoader = new DicomLoader(_directoryPath);
                if (_dicomLoader.GetErrorCode() != 0)
                {
                    MessageBox.Show("Cannot load directory.",
                    "Loading error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1);
                    return;
                }

                _vizualization3D = new Visualization3D(fourthWindow, _dicomLoader);
                _vizualization3D.ChangeColorAndOpacityFunction(PresetInfo);

                //moving planes
                _vizualization3D.PlaneWidgetX.InteractionEvt += PlaneXMoved;
                _vizualization3D.PlaneWidgetY.InteractionEvt += PlaneYMoved;
                _vizualization3D.PlaneWidgetZ.InteractionEvt += PlaneZMoved;

                //handling events from ClipingToolbox
                clipingPanel.ClipingOperationEventHandlerDelegate += new EventHandler<ClipingEventArgs>(_vizualization3D.ExecuteClipingOperation);
                clipingPanel.InitialiseClipingToolbox(_vizualization3D.GetObjectSize());

                fourthWindow.RenderWindow.Render();
            }
        }
コード例 #12
0
 public Form2(DicomLoader dicomLoader)
 {
     InitializeComponent();
     _dicomLoader = dicomLoader;
 }