Exemplo n.º 1
0
        public void VolumeRender(vtk.vtkImageData VoxelDatat)
        {
            VoxelData = VoxelDatat;
            renWin.AddRenderer(ren1);
            iren.SetRenderWindow(renWin);

            double[] inputRange = VoxelData.GetScalarRange();

            vtk.vtkPiecewiseFunction opacityTransferFunction = new vtk.vtkPiecewiseFunction();
            opacityTransferFunction.AddPoint(inputRange[0], 0);
            opacityTransferFunction.AddPoint(inputRange[1], 1);

            vtk.vtkColorTransferFunction colorTransferFunction = new vtk.vtkColorTransferFunction();
            colorTransferFunction.AddRGBPoint(inputRange[0], 1.0, 1.0, 1.0);
            colorTransferFunction.AddRGBPoint(inputRange[1], 1.0, 1.0, 1.0);

            volumeProperty.SetColor(colorTransferFunction);
            volumeProperty.SetScalarOpacity(opacityTransferFunction);
            volumeProperty.ShadeOff();
            volumeProperty.SetInterpolationTypeToLinear();

            volume.SetProperty(volumeProperty);

            setRAY();
            ren1.AddVolume(volume);
            ren1.ResetCamera();
            renWin.Render();
            addBusyObservers();
            iren.Initialize(); iren.Enable();
        }
Exemplo n.º 2
0
 public void UpdateIsoValue(double isovaluet)
 {
     isovalue = isovaluet;
     vtk.vtkPiecewiseFunction opacityIsoTransferFunction = setIsoTF();
     volumeProperty.SetScalarOpacity(opacityIsoTransferFunction);
     volume.Update();
     renWin.Render();
 }
Exemplo n.º 3
0
        public vtk.vtkPiecewiseFunction setIsoTF()
        {
            double[] inputRange = VoxelData.GetScalarRange();
            vtk.vtkPiecewiseFunction opacityIsoTransferFunction = new vtk.vtkPiecewiseFunction();
            double per = ((inputRange[1] - inputRange[0]) / 100);

            if (isovalue > (inputRange[0] + per))
            {
                opacityIsoTransferFunction.AddPoint(inputRange[0], 0);
                opacityIsoTransferFunction.AddPoint(isovalue - (per), 0);
            }
            opacityIsoTransferFunction.AddPoint(isovalue, 1);
            opacityIsoTransferFunction.AddPoint(inputRange[1], 1);
            return(opacityIsoTransferFunction);
        }
Exemplo n.º 4
0
        // This Function converts the selected Points to a VTK transfer function
        public vtk.vtkPiecewiseFunction getAlphaTransferFunction()
        {
            vtk.vtkPiecewiseFunction TransferFunction = new vtk.vtkPiecewiseFunction();
            double colorindex = 0; double alpha = 0; double per = 0;

            for (int i = 0; i < npoints; i++)
            {
                // Calulate color index and alpha from selected points
                per        = (double)pointsx[i] / (width - 1);
                colorindex = (1 - per) * inputRange[0] + per * inputRange[1];
                alpha      = (double)pointsy[i] / height;
                TransferFunction.AddPoint(colorindex, alpha);
            }
            return(TransferFunction);
        }
Exemplo n.º 5
0
 public void setAlphaTransferFunction(vtk.vtkPiecewiseFunction TransferFunction)
 {
     volumeProperty.SetScalarOpacity(TransferFunction);
     renWin.Render();
 }