Ejemplo n.º 1
0
        /// <summary>
        /// Set up the new PlaneWidget.
        /// </summary>
        /// <param name="planeWidget">Plane to set up.</param>
        private void SetupPlane(PlaneWidget planeWidget)
        {
            planeWidget.DisplayTextOff();
            planeWidget.SetInput(_dicomLoader.GetOutput());
            planeWidget.SetPlaneOrientationToXAxes();
            planeWidget.SetSliceIndex(250);
            planeWidget.SetInteractor(_renderWindowInteractor);
            planeWidget.SetLeftButtonAction(99);
            planeWidget.SetRightButtonAction(0);
            planeWidget.SetMarginSizeX(0);
            planeWidget.SetMarginSizeY(0);

            planeWidget.GetMarginProperty().SetColor(1, 0, 0);
            planeWidget.GetSelectedPlaneProperty().SetOpacity(0);
            planeWidget.GetCursorProperty().SetOpacity(0);
            planeWidget.GetPlaneProperty().SetOpacity(0);

            vtkColorTransferFunction colors = vtkColorTransferFunction.New();

            if (planeWidget.Axis == Axis.X)
            {
                planeWidget.SetPlaneOrientationToXAxes();
                colors.AddRGBPoint(0, 1, 0, 0); //red
            }
            else if (planeWidget.Axis == Axis.Y)
            {
                planeWidget.SetPlaneOrientationToYAxes();
                colors.AddRGBPoint(0, 0, 1, 0);
            }
            else if (planeWidget.Axis == Axis.Z)
            {
                planeWidget.SetPlaneOrientationToZAxes();
                colors.AddRGBPoint(0, 0, 0, 1);
            }
            colors.SetAlpha(0.4);
            colors.SetColorSpaceToRGB();
            colors.Build();
            planeWidget.GetColorMap().SetLookupTable(colors);
        }