Ejemplo n.º 1
0
        private void CreateSurfaceRendering()
        {
            _contourFilter = new vtkContourFilter();
            _contourFilter.SetInput(_volumeGraphic.GetImageData());
            _contourFilter.SetValue(0, _volumeGraphic.GetRescaledLevel());

            vtkPolyDataNormals normals = new vtkPolyDataNormals();

            normals.SetInputConnection(_contourFilter.GetOutputPort());
            normals.SetFeatureAngle(60.0);

            vtkStripper stripper = new vtkStripper();

            stripper.SetInputConnection(normals.GetOutputPort());

            vtkPolyDataMapper mapper = new vtkPolyDataMapper();

            mapper.SetInputConnection(stripper.GetOutputPort());
            mapper.ScalarVisibilityOff();

            _vtkActor = new vtkActor();
            _vtkActor.SetMapper(mapper);
            _vtkActor.GetProperty().SetSpecular(.3);
            _vtkActor.GetProperty().SetSpecularPower(20);
            ApplySetting("Opacity");
            ApplySetting("Level");
        }
Ejemplo n.º 2
0
        private vtkProp CreateVolumeRendering()
        {
            _opacityTransferFunction = new vtkPiecewiseFunction();
            _opacityTransferFunction.ClampingOff();

            _colorTransferFunction = new vtkColorTransferFunction();
            _colorTransferFunction.SetColorSpaceToRGB();
            _colorTransferFunction.ClampingOff();

            SetOpacityTransferFunction();
            SetColorTransferFunction();

            vtkVolumeProperty volumeProperty = new vtkVolumeProperty();

            volumeProperty.ShadeOn();
            volumeProperty.SetInterpolationTypeToLinear();
            volumeProperty.SetColor(_colorTransferFunction);
            volumeProperty.SetScalarOpacity(_opacityTransferFunction);
            volumeProperty.SetDiffuse(0.7);
            volumeProperty.SetAmbient(0.1);
            volumeProperty.SetSpecular(.3);
            volumeProperty.SetSpecularPower(20);

            //vtkOpenGLVolumeTextureMapper2D volumeMapper = new vtkOpenGLVolumeTextureMapper2D();
            //vtkOpenGLVolumeTextureMapper3D volumeMapper = new vtkOpenGLVolumeTextureMapper3D();
            //volumeMapper.SetPreferredMethodToNVidia();
            //volumeMapper.SetSampleDistance(1.0f);
            //int supported = volumeMapper.IsRenderSupported(volumeProperty);

            vtkFixedPointVolumeRayCastMapper volumeMapper = new vtkFixedPointVolumeRayCastMapper();

            //vtkVolumeRayCastMapper volumeMapper = new vtkVolumeRayCastMapper();
            volumeMapper.SetInput(_volumeLayer.GetImageData());
            ////vtkVolumeRayCastCompositeFunction rayCastFunction = new vtkVolumeRayCastCompositeFunction();
            ////volumeMapper.SetVolumeRayCastFunction(rayCastFunction);
            //vtkVolumeRayCastIsosurfaceFunction rayCastFunction = new vtkVolumeRayCastIsosurfaceFunction();
            //volumeMapper.SetVolumeRayCastFunction(rayCastFunction);

            _vtkVolume = new vtkVolume();
            _vtkVolume.SetMapper(volumeMapper);
            _vtkVolume.SetProperty(volumeProperty);

            return(_vtkVolume);
        }