示例#1
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();
            }
        }
示例#2
0
        //wizualizacja 3d -----------------------------------------------------------------
        private void fourthWindow_Load(object sender, EventArgs e)
        {
            _vizualization3D = new Visualization3D(fourthWindow, _dicomLoader, chart1);
            string[] filePaths = Directory.GetFiles(PresetDir, "*.xml");

            foreach (string dir in filePaths)
            {
                comboBox1.Items.Add(new FileInfo(dir).Name);
            }
            comboBox1.SelectedIndex = 1;
            _vizualization3D.ChangeColorAndOpacityFunction(String.IsNullOrEmpty(comboBox1.SelectedText) ? comboBox1.Text : comboBox1.SelectedText);

            comboBoxSeries.Items.Clear();
            int numberOfSeries = _vizualization3D.PresetInfo.Series.Count;

            for (int i = 0; i < numberOfSeries; i++)
            {
                comboBoxSeries.Items.Add(i.ToString(CultureInfo.InvariantCulture));
            }
            comboBoxSeries.SelectedIndex = 0;

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

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

            /*vtkImageExtractComponents extract = vtkImageExtractComponents.New();
             * extract.SetInput( _dicomLoader.GetOutput() );
             * extract.SetComponents(0);
             * extract.Update();
             *
             * double[] range = extract.GetOutput().GetScalarRange();
             *
             * vtkXYPlotActor xyPlotActor = new vtkXYPlotActor();
             * vtkActor actor = vtkActor.New();
             *
             * vtkImageAccumulate histogram = new vtkImageAccumulate();
             * histogram.SetInput(extract.GetOutput());
             * histogram.SetComponentOrigin(0, 0, 0);
             * histogram.SetComponentSpacing(1, 1, 1);
             * histogram.IgnoreZeroOn();
             * histogram.Update();
             *
             *
             * xyPlotActor.AddInput(histogram.GetOutput());
             * fourthWindow.RenderWindow.GetRenderers().GetFirstRenderer().AddActor(xyPlotActor); */
            fourthWindow.RenderWindow.Render();
        }
示例#3
0
        //wizualizacja 3d -----------------------------------------------------------------
        private void fourthWindow_Load(object sender, EventArgs e)
        {
            _vizualization3D = new Visualization3D(fourthWindow, _dicomLoader, chart1);
            string[] filePaths = Directory.GetFiles(PresetDir, "*.xml");

            foreach (string dir in filePaths)
            {
                comboBox1.Items.Add(new FileInfo(dir).Name);
            }
            comboBox1.SelectedIndex = 1;
            _vizualization3D.ChangeColorAndOpacityFunction(String.IsNullOrEmpty(comboBox1.SelectedText) ? comboBox1.Text : comboBox1.SelectedText);

            comboBoxSeries.Items.Clear();
            int numberOfSeries = _vizualization3D.PresetInfo.Series.Count;
            for (int i = 0; i < numberOfSeries; i++)
            {
                comboBoxSeries.Items.Add(i.ToString(CultureInfo.InvariantCulture));
            }
            comboBoxSeries.SelectedIndex = 0;

            //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());

            /*vtkImageExtractComponents extract = vtkImageExtractComponents.New();
            extract.SetInput( _dicomLoader.GetOutput() );
            extract.SetComponents(0);
            extract.Update();

            double[] range = extract.GetOutput().GetScalarRange();

            vtkXYPlotActor xyPlotActor = new vtkXYPlotActor();
            vtkActor actor = vtkActor.New();

            vtkImageAccumulate histogram = new vtkImageAccumulate();
            histogram.SetInput(extract.GetOutput());
            histogram.SetComponentOrigin(0, 0, 0);
            histogram.SetComponentSpacing(1, 1, 1);
            histogram.IgnoreZeroOn();
            histogram.Update();

            xyPlotActor.AddInput(histogram.GetOutput());
            fourthWindow.RenderWindow.GetRenderers().GetFirstRenderer().AddActor(xyPlotActor); */
            fourthWindow.RenderWindow.Render();
        }
        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();
            }
        }