예제 #1
0
        public void AddCylinderEdgeToActors(byte[] bgColor, ref vtkActorCollection actors)
        {
            vtkProperty pp = vtkProperty.New();

            pp.SetOpacity(0.7);
            pp.SetColor(bgColor[0], bgColor[1], bgColor[2]);
            pp.SetLineWidth(5);
            pp.SetLighting(false);

            vtkRegularPolygonSource circle = vtkRegularPolygonSource.New();

            circle.GeneratePolygonOn();
            circle.SetNumberOfSides(50);
            circle.SetRadius(radius);
            circle.SetCenter(0, 0, 0);

            vtkPolyDataMapper mappper = vtkPolyDataMapper.New();

            mappper.SetInputConnection(circle.GetOutputPort());

            vtkActor actor = vtkActor.New();

            actor.SetProperty(pp);
            actor.SetMapper(mappper);
            actors.AddItem(actor);

            actor.SetProperty(pp);
            actors.AddItem(actor);


            vtkLineSource ls = vtkLineSource.New();

            ls.SetPoint1(0, 0, 0);
            ls.SetPoint2(0, 0, height);
            vtkTubeFilter tf = vtkTubeFilter.New();

            tf.SetInputConnection(ls.GetOutputPort());
            tf.SetRadius(radius);
            tf.SetNumberOfSides(100);
            tf.CappingOff();

            vtkPolyDataMapper dm = vtkPolyDataMapper.New();

            dm.SetInputConnection(tf.GetOutputPort());

            vtkActor a2 = vtkActor.New();

            a2.SetMapper(dm);

            a2.SetProperty(pp);

            pp.SetOpacity(0.5);
            actor.SetProperty(pp);

            actors.AddItem(a2);
        }
예제 #2
0
        public void SetPosition(double[] xyz1, double[] xyz2)
        {
            vtkPoints points = vtkPoints.New();

            points.InsertPoint(0, xyz1[0], xyz1[1], xyz1[2]);
            points.InsertPoint(1, xyz2[0], xyz2[1], xyz2[2]);

            vtkCellArray lines = vtkCellArray.New();

            lines.InsertNextCell(2);

            lines.InsertCellPoint(0);
            lines.InsertCellPoint(1);

            vtkPolyData profileData = new vtkPolyData();

            profileData.SetPoints(points);
            profileData.SetLines(lines);
            profileData.SetVerts(lines);
            profileData.Update();

            vtkCleanPolyData cleanFilter = new vtkCleanPolyData();

            cleanFilter.SetInput(profileData);
            cleanFilter.Update();

            vtkTubeFilter profileTubes = new vtkTubeFilter();

            profileTubes.SetNumberOfSides(10);
            profileTubes.SetInput(cleanFilter.GetOutput());
            //profileTubes.SetVaryRadiusToVaryRadiusByVector();
            profileTubes.SetRadius(1);
            profileTubes.SetInputArrayToProcess(1, 0, 0, 0, "vectors");

            //vtkPolyDataMapper profileMapper = new vtkPolyDataMapper();
            //profileMapper.SetInputConnection(profileTubes.GetOutputPort());

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInput(profileTubes.GetOutput());

            centerLineActor.SetMapper(mapper);
            centerLineActor.GetProperty().SetOpacity(0.5);
        }
예제 #3
0
        private vtkActor DrawMapBar(Stop stop, string line)
        {
            if (stop.arrivalsByLine == null)
            {
                return(null);
            }
            if (!stop.arrivalsByLine.ContainsKey(line))
            {
                return(null);
            }

            float[] point = GetPointOnMap(stop.Location);
            float   z     = CalculateZ(stop.arrivalsByLine[line]) * 0.35f;

            vtkLineSource lineSource = new vtkLineSource();

            lineSource.SetPoint1(point[0], point[1], 0);
            lineSource.SetPoint2(point[0], point[1], z);

            vtkTubeFilter tubeSource = new vtkTubeFilter();

            tubeSource.SetInputConnection(lineSource.GetOutputPort());
            tubeSource.SetRadius(0.005);
            tubeSource.SetNumberOfSides(4);
            tubeSource.Update();

            vtkPolyDataMapper tubeMapper = vtkPolyDataMapper.New();

            tubeMapper.SetInputConnection(tubeSource.GetOutputPort());


            vtkActor actor = vtkActor.New();

            actor.GetProperty().SetOpacity(1);

            Color color = Color.GetColorFromPalette(z, 0, 0.35f);

            actor.GetProperty().SetColor(color.r, color.g, color.b);
            actor.SetMapper(tubeMapper);

            return(actor);
        }
예제 #4
0
        public static vtkPolyData Create(List <double[]> xyz1, double radius)
        {
            vtkPoints points = new vtkPoints();

            for (int index = 0; index < xyz1.Count; index++)
            {
                double[] doubles = xyz1[index];
                points.InsertPoint(index, doubles[0], doubles[1], doubles[2]);
            }

            vtkCellArray lines = new vtkCellArray();

            lines.InsertNextCell(xyz1.Count);

            for (int index = 0; index < xyz1.Count; index++)
            {
                lines.InsertCellPoint(index);
            }

            vtkPolyData profileData = new vtkPolyData();

            profileData.SetPoints(points);
            profileData.SetLines(lines);
            profileData.SetVerts(lines);
            profileData.Update();

            vtkCleanPolyData cleanFilter = new vtkCleanPolyData();

            cleanFilter.SetInput(profileData);
            cleanFilter.Update();

            vtkTubeFilter profileTubes = new vtkTubeFilter();

            profileTubes.SetNumberOfSides(10);
            profileTubes.SetInput(cleanFilter.GetOutput());
            //profileTubes.SetVaryRadiusToVaryRadiusByVector();
            profileTubes.SetRadius(radius);
            profileTubes.SetInputArrayToProcess(1, 0, 0, 0, "vectors");

            return(profileTubes.GetOutput());
        }
예제 #5
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Settubes(vtkTubeFilter toSet)
 {
     tubes = toSet;
 }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVEnSightRectGridASCII(String [] argv)
    {
        //Prefix Content is: ""

          VTK_VARY_RADIUS_BY_VECTOR = 2;
          // create pipeline[]
          //[]
          reader = new vtkGenericEnSightReader();
          // Make sure all algorithms use the composite data pipeline[]
          cdp = new vtkCompositeDataPipeline();
          vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
          reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/RectGrid_ascii.case");
          reader.Update();
          toRectilinearGrid = new vtkCastToConcrete();
          //    toRectilinearGrid SetInputConnection [reader GetOutputPort] []
          toRectilinearGrid.SetInput((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          plane = new vtkRectilinearGridGeometryFilter();
          plane.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          plane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)15,(int)15);
          tri = new vtkTriangleFilter();
          tri.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          warper = new vtkWarpVector();
          warper.SetInputConnection((vtkAlgorithmOutput)tri.GetOutputPort());
          warper.SetScaleFactor((double)0.05);
          planeMapper = new vtkDataSetMapper();
          planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
          planeMapper.SetScalarRange((double)0.197813,(double)0.710419);
          planeActor = new vtkActor();
          planeActor.SetMapper((vtkMapper)planeMapper);
          cutPlane = new vtkPlane();
          //    eval cutPlane SetOrigin [[reader GetOutput] GetCenter][]
          cutPlane.SetOrigin((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[1], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[2]);
          cutPlane.SetNormal((double)1,(double)0,(double)0);
          planeCut = new vtkCutter();
          planeCut.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
          cutMapper = new vtkDataSetMapper();
          cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
          cutMapper.SetScalarRange((double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
          cutActor = new vtkActor();
          cutActor.SetMapper((vtkMapper)cutMapper);
          iso = new vtkContourFilter();
          iso.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          iso.SetValue((int)0,(double)0.7);
          normals = new vtkPolyDataNormals();
          normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
          normals.SetFeatureAngle((double)45);
          isoMapper = vtkPolyDataMapper.New();
          isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
          isoMapper.ScalarVisibilityOff();
          isoActor = new vtkActor();
          isoActor.SetMapper((vtkMapper)isoMapper);
          isoActor.GetProperty().SetColor((double) 1.0000, 0.8941, 0.7686 );
          isoActor.GetProperty().SetRepresentationToWireframe();
          streamer = new vtkStreamLine();
          //    streamer SetInputConnection [reader GetOutputPort][]
          streamer.SetInput((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          streamer.SetStartPosition((double)-1.2,(double)-0.1,(double)1.3);
          streamer.SetMaximumPropagationTime((double)500);
          streamer.SetStepLength((double)0.05);
          streamer.SetIntegrationStepLength((double)0.05);
          streamer.SetIntegrationDirectionToIntegrateBothDirections();
          streamTube = new vtkTubeFilter();
          streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          streamTube.SetRadius((double)0.025);
          streamTube.SetNumberOfSides((int)6);
          streamTube.SetVaryRadius((int)VTK_VARY_RADIUS_BY_VECTOR);
          mapStreamTube = vtkPolyDataMapper.New();
          mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
          mapStreamTube.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
          //       [[[[reader GetOutput] GetPointData] GetScalars] GetRange][]
          streamTubeActor = new vtkActor();
          streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
          streamTubeActor.GetProperty().BackfaceCullingOn();
          outline = new vtkOutlineFilter();
          outline.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          outlineActor.GetProperty().SetColor((double) 0.0000, 0.0000, 0.0000 );
          // Graphics stuff[]
          // Create the RenderWindow, Renderer and both Actors[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)planeActor);
          ren1.AddActor((vtkProp)cutActor);
          ren1.AddActor((vtkProp)isoActor);
          ren1.AddActor((vtkProp)streamTubeActor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)400,(int)400);
          cam1 = ren1.GetActiveCamera();
          cam1.SetClippingRange((double)3.76213,(double)10.712);
          cam1.SetFocalPoint((double)-0.0842503,(double)-0.136905,(double)0.610234);
          cam1.SetPosition((double)2.53813,(double)2.2678,(double)-5.22172);
          cam1.SetViewUp((double)-0.241047,(double)0.930635,(double)0.275343);
          iren.Initialize();
          // render the image[]
          //[]
          // prevent the tk window from showing up then start the event loop[]
          vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);

        //deleteAllVTKObjects();
    }
예제 #7
0
    /// <summary>
    /// Entry Point
    /// </summary>
    /// <param name="argv"></param>
    public static void Main(String[] argv)
    {
        // This example demonstrates how to use 2D Delaunay triangulation.
        // We create a fancy image of a 2D Delaunay triangulation. Points are
        // randomly generated.
        // first we load in the standard vtk packages into tcl
        // Generate some random points
        math = vtkMath.New();
        points = vtkPoints.New();
        for(int i = 0; i < 50; i++)
        {
            points.InsertPoint(i, vtkMath.Random(0, 1), vtkMath.Random(0, 1), 0.0);
        }

        // Create a polydata with the points we just created.
        profile = vtkPolyData.New();
        profile.SetPoints(points);

        // Perform a 2D Delaunay triangulation on them.
        del = vtkDelaunay2D.New();
        del.SetInput(profile);
        del.SetTolerance(0.001);

        mapMesh = vtkPolyDataMapper.New();
        mapMesh.SetInputConnection(del.GetOutputPort());

        meshActor = vtkActor.New();
        meshActor.SetMapper(mapMesh);
        meshActor.GetProperty().SetColor(.1, .2, .4);

        // We will now create a nice looking mesh by wrapping the edges in tubes,
        // and putting fat spheres at the points.
        extract = vtkExtractEdges.New();
        extract.SetInputConnection(del.GetOutputPort());

        tubes = vtkTubeFilter.New();
        tubes.SetInputConnection(extract.GetOutputPort());
        tubes.SetRadius(0.01);
        tubes.SetNumberOfSides(6);

        mapEdges = vtkPolyDataMapper.New();
        mapEdges.SetInputConnection(tubes.GetOutputPort());

        edgeActor = vtkActor.New();
        edgeActor.SetMapper(mapEdges);
        edgeActor.GetProperty().SetColor(0.2000, 0.6300, 0.7900);
        edgeActor.GetProperty().SetSpecularColor(1, 1, 1);
        edgeActor.GetProperty().SetSpecular(0.3);
        edgeActor.GetProperty().SetSpecularPower(20);
        edgeActor.GetProperty().SetAmbient(0.2);
        edgeActor.GetProperty().SetDiffuse(0.8);

        ball = vtkSphereSource.New();
        ball.SetRadius(0.025);
        ball.SetThetaResolution(12);
        ball.SetPhiResolution(12);

        balls = vtkGlyph3D.New();
        balls.SetInputConnection(del.GetOutputPort());
        balls.SetSourceConnection(ball.GetOutputPort());

        mapBalls = vtkPolyDataMapper.New();
        mapBalls.SetInputConnection(balls.GetOutputPort());

        ballActor = vtkActor.New();
        ballActor.SetMapper(mapBalls);
        ballActor.GetProperty().SetColor(1.0000, 0.4118, 0.7059);
        ballActor.GetProperty().SetSpecularColor(1, 1, 1);
        ballActor.GetProperty().SetSpecular(0.3);
        ballActor.GetProperty().SetSpecularPower(20);
        ballActor.GetProperty().SetAmbient(0.2);
        ballActor.GetProperty().SetDiffuse(0.8);

        // Create graphics objects
        // Create the rendering window, renderer, and interactive renderer
        ren1 = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer(ren1);
        iren = vtkRenderWindowInteractor.New();
        iren.SetRenderWindow(renWin);

        // Add the actors to the renderer, set the background and size
        ren1.AddActor(ballActor);
        ren1.AddActor(edgeActor);
        ren1.SetBackground(1, 1, 1);
        renWin.SetSize(150, 150);

        // render the image
        ren1.ResetCamera();
        ren1.GetActiveCamera().Zoom(1.5);
        iren.Initialize();
        iren.Start();

        // Clean Up
        deleteAllVTKObjects();
    }
예제 #8
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetprobeTube(vtkTubeFilter toSet)
 {
     probeTube = toSet;
 }
예제 #9
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetTube(vtkTubeFilter toSet)
 {
     Tube = toSet;
 }
예제 #10
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetprofileKTubes(vtkTubeFilter toSet)
 {
     profileKTubes = toSet;
 }
예제 #11
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVmergeFilter(String [] argv)
    {
        //Prefix Content is: ""

        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1   = vtkRenderer.New();
        ren2   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.SetMultiSamples(0);
        renWin.AddRenderer((vtkRenderer)ren1);
        renWin.AddRenderer((vtkRenderer)ren2);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // create pipeline[]
        //[]
        pl3d = new vtkMultiBlockPLOT3DReader();
        pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
        pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
        pl3d.SetScalarFunctionNumber((int)110);
        pl3d.SetVectorFunctionNumber((int)202);
        pl3d.Update();
        probeLine = new vtkLineSource();
        probeLine.SetPoint1((double)1, (double)1, (double)29);
        probeLine.SetPoint2((double)16.5, (double)5, (double)31.7693);
        probeLine.SetResolution((int)500);
        probe = new vtkProbeFilter();
        probe.SetInputConnection((vtkAlgorithmOutput)probeLine.GetOutputPort());
        probe.SetSourceData((vtkDataObject)pl3d.GetOutput().GetBlock(0));
        probe.Update();
        probeTube = new vtkTubeFilter();
        probeTube.SetInputData((vtkDataObject)probe.GetPolyDataOutput());
        probeTube.SetNumberOfSides((int)5);
        probeTube.SetRadius((double).05);
        probeMapper = vtkPolyDataMapper.New();
        probeMapper.SetInputConnection((vtkAlgorithmOutput)probeTube.GetOutputPort());
        probeMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                   (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        probeActor = new vtkActor();
        probeActor.SetMapper((vtkMapper)probeMapper);
        displayLine = new vtkLineSource();
        displayLine.SetPoint1((double)0, (double)0, (double)0);
        displayLine.SetPoint2((double)1, (double)0, (double)0);
        displayLine.SetResolution((int)probeLine.GetResolution());
        displayMerge = new vtkMergeFilter();
        displayMerge.SetGeometryConnection(displayLine.GetOutputPort());
        displayMerge.SetScalarsData((vtkDataSet)probe.GetPolyDataOutput());
        displayMerge.Update();

        displayWarp = new vtkWarpScalar();
        displayWarp.SetInputData((vtkDataObject)displayMerge.GetPolyDataOutput());
        displayWarp.SetNormal((double)0, (double)1, (double)0);
        displayWarp.SetScaleFactor((double).000001);
        displayWarp.Update();

        displayMapper = vtkPolyDataMapper.New();
        displayMapper.SetInputData((vtkPolyData)displayWarp.GetPolyDataOutput());
        displayMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                     (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        displayActor = new vtkActor();
        displayActor.SetMapper((vtkMapper)displayMapper);
        outline = new vtkStructuredGridOutlineFilter();
        outline.SetInputData(pl3d.GetOutput().GetBlock(0));
        outlineMapper = vtkPolyDataMapper.New();
        outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)outlineMapper);
        outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)probeActor);
        ren1.SetBackground((double)1, (double)1, (double)1);
        ren1.SetViewport((double)0, (double).25, (double)1, (double)1);
        ren2.AddActor((vtkProp)displayActor);
        ren2.SetBackground((double)0, (double)0, (double)0);
        ren2.SetViewport((double)0, (double)0, (double)1, (double).25);
        renWin.SetSize((int)300, (int)300);
        ren1.ResetCamera();
        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange((double)3.95297, (double)50);
        cam1.SetFocalPoint((double)8.88908, (double)0.595038, (double)29.3342);
        cam1.SetPosition((double)9.9, (double)-26, (double)41);
        cam1.SetViewUp((double)0.060772, (double)-0.319905, (double)0.945498);
        ren2.ResetCamera();
        cam2 = ren2.GetActiveCamera();
        cam2.ParallelProjectionOn();
        cam2.SetParallelScale((double).15);
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
예제 #12
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVfieldToRGrid(String [] argv)
    {
        //Prefix Content is: ""

        //# Generate a rectilinear grid from a field.[]
        //#[]
        // get the interactor ui[]
        // Create a reader and write out the field[]
        reader = new vtkDataSetReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
        ds2do = new vtkDataSetToDataObjectFilter();
        ds2do.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        try
        {
            channel       = new StreamWriter("RGridField.vtk");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        { tryCatchError = "ERROR"; }

        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            writer = new vtkDataObjectWriter();
            writer.SetInputConnection((vtkAlgorithmOutput)ds2do.GetOutputPort());
            writer.SetFileName((string)"RGridField.vtk");
            writer.Write();
            // Read the field[]
            //[]
            dor = new vtkDataObjectReader();
            dor.SetFileName((string)"RGridField.vtk");
            do2ds = new vtkDataObjectToDataSetFilter();
            do2ds.SetInputConnection((vtkAlgorithmOutput)dor.GetOutputPort());
            do2ds.SetDataSetTypeToRectilinearGrid();
            do2ds.SetDimensionsComponent((string)"Dimensions", (int)0);
            do2ds.SetPointComponent((int)0, (string)"XCoordinates", (int)0);
            do2ds.SetPointComponent((int)1, (string)"YCoordinates", (int)0);
            do2ds.SetPointComponent((int)2, (string)"ZCoordinates", (int)0);
            do2ds.Update();

            fd2ad = new vtkFieldDataToAttributeDataFilter();
            fd2ad.SetInputData((vtkDataObject)do2ds.GetRectilinearGridOutput());
            fd2ad.SetInputFieldToDataObjectField();
            fd2ad.SetOutputAttributeDataToPointData();
            fd2ad.SetVectorComponent((int)0, (string)"vectors", (int)0);
            fd2ad.SetVectorComponent((int)1, (string)"vectors", (int)1);
            fd2ad.SetVectorComponent((int)2, (string)"vectors", (int)2);
            fd2ad.SetScalarComponent((int)0, (string)"scalars", (int)0);
            fd2ad.Update();

            // create pipeline[]
            //[]
            plane = new vtkRectilinearGridGeometryFilter();
            plane.SetInputData((vtkDataObject)fd2ad.GetRectilinearGridOutput());
            plane.SetExtent((int)0, (int)100, (int)0, (int)100, (int)15, (int)15);
            warper = new vtkWarpVector();
            warper.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
            warper.SetScaleFactor((double)0.05);
            planeMapper = new vtkDataSetMapper();
            planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
            planeMapper.SetScalarRange((double)0.197813, (double)0.710419);
            planeActor = new vtkActor();
            planeActor.SetMapper((vtkMapper)planeMapper);
            cutPlane = new vtkPlane();
            cutPlane.SetOrigin(fd2ad.GetOutput().GetCenter()[0], fd2ad.GetOutput().GetCenter()[1], fd2ad.GetOutput().GetCenter()[2]);
            cutPlane.SetNormal((double)1, (double)0, (double)0);
            planeCut = new vtkCutter();
            planeCut.SetInputData((vtkDataObject)fd2ad.GetRectilinearGridOutput());
            planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
            cutMapper = new vtkDataSetMapper();
            cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());

            cutMapper.SetScalarRange(
                (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[0],
                (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
            cutActor = new vtkActor();
            cutActor.SetMapper((vtkMapper)cutMapper);
            iso = new vtkContourFilter();
            iso.SetInputData((vtkDataObject)fd2ad.GetRectilinearGridOutput());

            iso.SetValue((int)0, (double)0.7);
            normals = new vtkPolyDataNormals();
            normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
            normals.SetFeatureAngle((double)45);

            isoMapper = vtkPolyDataMapper.New();
            isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
            isoMapper.ScalarVisibilityOff();
            isoActor = new vtkActor();
            isoActor.SetMapper((vtkMapper)isoMapper);
            isoActor.GetProperty().SetColor((double)1.0000, 0.8941, 0.7686);
            isoActor.GetProperty().SetRepresentationToWireframe();
            streamer = new vtkStreamLine();
            streamer.SetInputConnection((vtkAlgorithmOutput)fd2ad.GetOutputPort());
            streamer.SetStartPosition((double)-1.2, (double)-0.1, (double)1.3);
            streamer.SetMaximumPropagationTime((double)500);
            streamer.SetStepLength((double)0.05);
            streamer.SetIntegrationStepLength((double)0.05);
            streamer.SetIntegrationDirectionToIntegrateBothDirections();
            streamTube = new vtkTubeFilter();
            streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
            streamTube.SetRadius((double)0.025);
            streamTube.SetNumberOfSides((int)6);
            streamTube.SetVaryRadiusToVaryRadiusByVector();
            mapStreamTube = vtkPolyDataMapper.New();
            mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
            mapStreamTube.SetScalarRange(
                (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[0],
                (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
            streamTubeActor = new vtkActor();
            streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
            streamTubeActor.GetProperty().BackfaceCullingOn();
            outline = new vtkOutlineFilter();
            outline.SetInputData((vtkDataObject)fd2ad.GetRectilinearGridOutput());
            outlineMapper = vtkPolyDataMapper.New();
            outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
            outlineActor = new vtkActor();
            outlineActor.SetMapper((vtkMapper)outlineMapper);
            outlineActor.GetProperty().SetColor((double)0.0000, 0.0000, 0.0000);



            // Graphics stuff[]
            // Create the RenderWindow, Renderer and both Actors[]
            //[]
            ren1   = vtkRenderer.New();
            renWin = vtkRenderWindow.New();
            renWin.SetMultiSamples(0);
            renWin.AddRenderer((vtkRenderer)ren1);
            iren = new vtkRenderWindowInteractor();
            iren.SetRenderWindow((vtkRenderWindow)renWin);
            // Add the actors to the renderer, set the background and size[]
            //[]
            ren1.AddActor((vtkProp)outlineActor);
            ren1.AddActor((vtkProp)planeActor);
            ren1.AddActor((vtkProp)cutActor);
            ren1.AddActor((vtkProp)isoActor);
            ren1.AddActor((vtkProp)streamTubeActor);
            ren1.SetBackground((double)1, (double)1, (double)1);
            renWin.SetSize((int)300, (int)300);
            ren1.GetActiveCamera().SetPosition((double)0.0390893, (double)0.184813, (double)-3.94026);
            ren1.GetActiveCamera().SetFocalPoint((double)-0.00578326, (double)0, (double)0.701967);
            ren1.GetActiveCamera().SetViewAngle((double)30);
            ren1.GetActiveCamera().SetViewUp((double)0.00850257, (double)0.999169, (double)0.0398605);
            ren1.GetActiveCamera().SetClippingRange((double)3.08127, (double)6.62716);
            iren.Initialize();
            // render the image[]
            //[]

            File.Delete("RGridField.vtk");
        }


        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
예제 #13
0
        private void DrawTest()
        {
            vtkProp3D      prop3D;
            vtkActor       actor       = vtkActor.New();
            vtkActor2D     actor2D     = vtkActor2D.New();
            vtkLODActor    lODActor    = vtkLODActor.New();
            vtkLODProp3D   lodProp3d   = vtkLODProp3D.New();
            vtkCamera      camera      = vtkCamera.New();
            vtkCameraActor cameraActor = vtkCameraActor.New();
            vtkLight       light       = vtkLight.New();
            vtkLightActor  lightActor  = vtkLightActor.New();
            vtkPicker      picker      = vtkPicker.New();
            vtkPointPicker pointPicker = vtkPointPicker.New();
            vtkCellPicker  cellPicker  = vtkCellPicker.New();
            vtkAreaPicker  areaPicker  = vtkAreaPicker.New();

            vtkAssembly   assembly   = vtkAssembly.New();
            vtkConeSource coneSource = vtkConeSource.New();
            vtkCone       cone       = vtkCone.New();

            vtkArcSource   arcSource   = vtkArcSource.New();
            vtkLineSource  lineSource  = vtkLineSource.New();
            vtkPointSource pointSource = vtkPointSource.New();

            vtkPolyData                 polyData                 = vtkPolyData.New();
            vtkArrayReader              arrayReader              = vtkArrayReader.New();
            vtkArrayDataReader          arrayDataReader          = vtkArrayDataReader.New();
            vtkArrayWriter              arrayWriter              = vtkArrayWriter.New();
            vtkRenderWindowInteractor   renderWindowInteractor   = vtkRenderWindowInteractor.New();
            vtkRenderWindowInteractor3D renderWindowInteractor3D = vtkRenderWindowInteractor3D.New();
            vtkInteractorStyle          interactorStyle          = vtkInteractorStyle.New();
            vtkInteractorStyle3D        interactorStyle3D        = vtkInteractorStyle3D.New();
            vtkInteractorStyleFlight    interactorStyleFlight    = vtkInteractorStyleFlight.New();
            vtkInteractorStyleTrackball interactorStyleTrackball = vtkInteractorStyleTrackball.New();

            vtkVolume                              volume = vtkVolume.New();
            vtkVolumeMapper                        volumeMapper;
            vtkSmartVolumeMapper                   smartVolumeMapper = vtkSmartVolumeMapper.New();
            vtkUnstructuredGridVolumeMapper        unstructuredGridVolumeMapper;
            vtkUnstructuredGridVolumeRayCastMapper unstructuredGridVolumeRayCastMapper = vtkUnstructuredGridVolumeRayCastMapper.New();
            vtkGPUVolumeRayCastMapper              gPUVolumeRayCastMapper       = vtkGPUVolumeRayCastMapper.New();
            vtkVolumeRayCastMapper                 volumeRayCastMapper          = vtkVolumeRayCastMapper.New();
            vtkFixedPointVolumeRayCastMapper       pointVolumeRayCastMapper     = vtkFixedPointVolumeRayCastMapper.New();
            vtkOpenGLGPUVolumeRayCastMapper        openGLGPUVolumeRayCastMapper = vtkOpenGLGPUVolumeRayCastMapper.New();
            vtkVolumeProperty                      volumeProperty = vtkVolumeProperty.New();

            vtkTexture    texture    = vtkTexture.New();
            vtkCoordinate coordinate = vtkCoordinate.New();
            vtkImageData  vtkImage   = vtkImageData.New();

            vtkBMPReader  bMPReader  = vtkBMPReader.New();
            vtkJPEGReader jPEGReader = vtkJPEGReader.New();
            vtkPNGReader  pNGReader  = vtkPNGReader.New();
            vtkTIFFReader tIFFReader = vtkTIFFReader.New();
            vtkOBJReader  oBJReader  = vtkOBJReader.New();


            vtkContourFilter                 contourFilter                 = vtkContourFilter.New();
            vtkSynchronizedTemplates2D       synchronizedTemplates2D       = vtkSynchronizedTemplates2D.New();
            vtkSynchronizedTemplates3D       synchronizedTemplates3D       = vtkSynchronizedTemplates3D.New();
            vtkSynchronizedTemplatesCutter3D synchronizedTemplatesCutter3D = vtkSynchronizedTemplatesCutter3D.New();

            vtkImageMapper        imageMapper        = vtkImageMapper.New();
            vtkImageSliceMapper   imageSliceMapper   = vtkImageSliceMapper.New();
            vtkImageResliceMapper imageResliceMapper = vtkImageResliceMapper.New();

            vtkStructuredGridReader structuredGridReader = vtkStructuredGridReader.New();
            vtkRungeKutta4          integ                      = vtkRungeKutta4.New();
            vtkStreamTracer         streamer                   = vtkStreamTracer.New();
            vtkTubeFilter           streamTube                 = vtkTubeFilter.New();
            vtkRuledSurfaceFilter   ruledSurfaceFilter         = vtkRuledSurfaceFilter.New();
            vtkPlane                   plane                   = vtkPlane.New();
            vtkCutter                  cutter                  = new vtkCutter();
            vtkMergeFilter             mergeFilter             = vtkMergeFilter.New();
            vtkImageLuminance          imageLuminance          = vtkImageLuminance.New();
            vtkImageDataGeometryFilter imageDataGeometryFilter = vtkImageDataGeometryFilter.New();
            vtkWarpScalar              warpScalar              = vtkWarpScalar.New();
            vtkWarpVector              warpVector              = vtkWarpVector.New();
        }
예제 #14
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVrectGrid(String [] argv)
    {
        //Prefix Content is: ""

        VTK_VARY_RADIUS_BY_VECTOR = 2;
        // create pipeline[]
        //[]
        reader = new vtkDataSetReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
        reader.Update();
        toRectilinearGrid = new vtkCastToConcrete();
        toRectilinearGrid.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        toRectilinearGrid.Update();
        plane = new vtkRectilinearGridGeometryFilter();
        plane.SetInputData((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
        plane.SetExtent((int)0, (int)100, (int)0, (int)100, (int)15, (int)15);
        warper = new vtkWarpVector();
        warper.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
        warper.SetScaleFactor((double)0.05);
        planeMapper = new vtkDataSetMapper();
        planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
        planeMapper.SetScalarRange((double)0.197813, (double)0.710419);
        planeActor = new vtkActor();
        planeActor.SetMapper((vtkMapper)planeMapper);
        cutPlane = new vtkPlane();
        cutPlane.SetOrigin(reader.GetOutput().GetCenter()[0], reader.GetOutput().GetCenter()[1], reader.GetOutput().GetCenter()[2]);
        cutPlane.SetNormal((double)1, (double)0, (double)0);
        planeCut = new vtkCutter();
        planeCut.SetInputData((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
        planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
        cutMapper = new vtkDataSetMapper();
        cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
        cutMapper.SetScalarRange((double)((vtkDataSet)reader.GetOutput()).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)reader.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
        cutActor = new vtkActor();
        cutActor.SetMapper((vtkMapper)cutMapper);
        iso = new vtkContourFilter();
        iso.SetInputData((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
        iso.SetValue((int)0, (double)0.7);
        normals = new vtkPolyDataNormals();
        normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
        normals.SetFeatureAngle((double)45);
        isoMapper = vtkPolyDataMapper.New();
        isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
        isoMapper.ScalarVisibilityOff();
        isoActor = new vtkActor();
        isoActor.SetMapper((vtkMapper)isoMapper);
        isoActor.GetProperty().SetColor((double)1.0000, 0.8941, 0.7686);
        isoActor.GetProperty().SetRepresentationToWireframe();
        streamer = new vtkStreamLine();
        streamer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        streamer.SetStartPosition((double)-1.2, (double)-0.1, (double)1.3);
        streamer.SetMaximumPropagationTime((double)500);
        streamer.SetStepLength((double)0.05);
        streamer.SetIntegrationStepLength((double)0.05);
        streamer.SetIntegrationDirectionToIntegrateBothDirections();
        streamTube = new vtkTubeFilter();
        streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        streamTube.SetRadius((double)0.025);
        streamTube.SetNumberOfSides((int)6);
        streamTube.SetVaryRadius((int)VTK_VARY_RADIUS_BY_VECTOR);
        mapStreamTube = vtkPolyDataMapper.New();
        mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
        mapStreamTube.SetScalarRange((double)((vtkDataSet)reader.GetOutput()).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)reader.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
        streamTubeActor = new vtkActor();
        streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
        streamTubeActor.GetProperty().BackfaceCullingOn();
        outline = new vtkOutlineFilter();
        outline.SetInputData((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
        outlineMapper = vtkPolyDataMapper.New();
        outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)outlineMapper);
        outlineActor.GetProperty().SetColor((double)0.0000, 0.0000, 0.0000);
        // Graphics stuff[]
        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.SetMultiSamples(0);
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // Add the actors to the renderer, set the background and size[]
        //[]
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)planeActor);
        ren1.AddActor((vtkProp)cutActor);
        ren1.AddActor((vtkProp)isoActor);
        ren1.AddActor((vtkProp)streamTubeActor);
        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)400, (int)400);
        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange((double)3.76213, (double)10.712);
        cam1.SetFocalPoint((double)-0.0842503, (double)-0.136905, (double)0.610234);
        cam1.SetPosition((double)2.53813, (double)2.2678, (double)-5.22172);
        cam1.SetViewUp((double)-0.241047, (double)0.930635, (double)0.275343);
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
예제 #15
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetprobeTube(vtkTubeFilter toSet)
 {
     probeTube = toSet;
 }
예제 #16
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetstreamTube(vtkTubeFilter toSet)
 {
     streamTube = toSet;
 }
예제 #17
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVclosedSplines(String [] argv)
    {
        //Prefix Content is: ""

        // get the interactor ui[]
        // Now create the RenderWindow, Renderer and Interactor[]
        //[]
        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        math = new vtkMath();
        numberOfInputPoints = 30;
        aKSplineX           = new vtkKochanekSpline();
        aKSplineX.ClosedOn();
        aKSplineY = new vtkKochanekSpline();
        aKSplineY.ClosedOn();
        aKSplineZ = new vtkKochanekSpline();
        aKSplineZ.ClosedOn();
        aCSplineX = new vtkCardinalSpline();
        aCSplineX.ClosedOn();
        aCSplineY = new vtkCardinalSpline();
        aCSplineY.ClosedOn();
        aCSplineZ = new vtkCardinalSpline();
        aCSplineZ.ClosedOn();
        // add some points[]
        inputPoints = new vtkPoints();
        x           = -1.0;
        y           = -1.0;
        z           = 0.0;
        aKSplineX.AddPoint((double)0, (double)x);
        aKSplineY.AddPoint((double)0, (double)y);
        aKSplineZ.AddPoint((double)0, (double)z);
        aCSplineX.AddPoint((double)0, (double)x);
        aCSplineY.AddPoint((double)0, (double)y);
        aCSplineZ.AddPoint((double)0, (double)z);
        inputPoints.InsertPoint((int)0, (double)x, (double)y, (double)z);
        x = 1.0;
        y = -1.0;
        z = 0.0;
        aKSplineX.AddPoint((double)1, (double)x);
        aKSplineY.AddPoint((double)1, (double)y);
        aKSplineZ.AddPoint((double)1, (double)z);
        aCSplineX.AddPoint((double)1, (double)x);
        aCSplineY.AddPoint((double)1, (double)y);
        aCSplineZ.AddPoint((double)1, (double)z);
        inputPoints.InsertPoint((int)1, (double)x, (double)y, (double)z);
        x = 1.0;
        y = 1.0;
        z = 0.0;
        aKSplineX.AddPoint((double)2, (double)x);
        aKSplineY.AddPoint((double)2, (double)y);
        aKSplineZ.AddPoint((double)2, (double)z);
        aCSplineX.AddPoint((double)2, (double)x);
        aCSplineY.AddPoint((double)2, (double)y);
        aCSplineZ.AddPoint((double)2, (double)z);
        inputPoints.InsertPoint((int)2, (double)x, (double)y, (double)z);
        x = -1.0;
        y = 1.0;
        z = 0.0;
        aKSplineX.AddPoint((double)3, (double)x);
        aKSplineY.AddPoint((double)3, (double)y);
        aKSplineZ.AddPoint((double)3, (double)z);
        aCSplineX.AddPoint((double)3, (double)x);
        aCSplineY.AddPoint((double)3, (double)y);
        aCSplineZ.AddPoint((double)3, (double)z);
        inputPoints.InsertPoint((int)3, (double)x, (double)y, (double)z);
        inputData = new vtkPolyData();
        inputData.SetPoints((vtkPoints)inputPoints);
        balls = new vtkSphereSource();
        balls.SetRadius((double).04);
        balls.SetPhiResolution((int)10);
        balls.SetThetaResolution((int)10);
        balls.Update();
        glyphPoints = new vtkGlyph3D();
        glyphPoints.SetInputData((vtkDataObject)inputData);
        glyphPoints.SetSourceData((vtkPolyData)balls.GetOutput());
        glyphMapper = vtkPolyDataMapper.New();
        glyphMapper.SetInputConnection((vtkAlgorithmOutput)glyphPoints.GetOutputPort());
        glyph = new vtkActor();
        glyph.SetMapper((vtkMapper)glyphMapper);
        glyph.GetProperty().SetDiffuseColor((double)1.0000, 0.3882, 0.2784);
        glyph.GetProperty().SetSpecular((double).3);
        glyph.GetProperty().SetSpecularPower((double)30);
        ren1.AddActor((vtkProp)glyph);
        Kpoints              = new vtkPoints();
        Cpoints              = new vtkPoints();
        profileKData         = new vtkPolyData();
        profileCData         = new vtkPolyData();
        numberOfInputPoints  = 5;
        numberOfOutputPoints = 100;
        offset = 1.0;
        //method moved
        fit();
        lines = new vtkCellArray();
        lines.InsertNextCell((int)numberOfOutputPoints);
        i = 0;
        while ((i) < numberOfOutputPoints)
        {
            lines.InsertCellPoint((int)i);
            i = i + 1;
        }

        profileKData.SetPoints((vtkPoints)Kpoints);
        profileKData.SetLines((vtkCellArray)lines);
        profileCData.SetPoints((vtkPoints)Cpoints);
        profileCData.SetLines((vtkCellArray)lines);
        profileKTubes = new vtkTubeFilter();
        profileKTubes.SetNumberOfSides((int)8);
        profileKTubes.SetInputData((vtkDataObject)profileKData);
        profileKTubes.SetRadius((double).01);
        profileKMapper = vtkPolyDataMapper.New();
        profileKMapper.SetInputConnection((vtkAlgorithmOutput)profileKTubes.GetOutputPort());
        profileK = new vtkActor();
        profileK.SetMapper((vtkMapper)profileKMapper);
        profileK.GetProperty().SetDiffuseColor((double)0.8900, 0.8100, 0.3400);
        profileK.GetProperty().SetSpecular((double).3);
        profileK.GetProperty().SetSpecularPower((double)30);
        ren1.AddActor((vtkProp)profileK);
        profileCTubes = new vtkTubeFilter();
        profileCTubes.SetNumberOfSides((int)8);
        profileCTubes.SetInputData((vtkDataObject)profileCData);
        profileCTubes.SetRadius((double).01);
        profileCMapper = vtkPolyDataMapper.New();
        profileCMapper.SetInputConnection((vtkAlgorithmOutput)profileCTubes.GetOutputPort());
        profileC = new vtkActor();
        profileC.SetMapper((vtkMapper)profileCMapper);
        profileC.GetProperty().SetDiffuseColor((double)0.2000, 0.6300, 0.7900);
        profileC.GetProperty().SetSpecular((double).3);
        profileC.GetProperty().SetSpecularPower((double)30);
        ren1.AddActor((vtkProp)profileC);
        ren1.ResetCamera();
        ren1.GetActiveCamera().Dolly((double)1.5);
        ren1.ResetCameraClippingRange();
        renWin.SetSize((int)300, (int)300);
        // render the image[]
        //[]
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]
        //method moved
        //method moved
        //method moved
        //method moved
        //method moved
        //method moved

//deleteAllVTKObjects();
    }
예제 #18
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVclosedSplines(String [] argv)
    {
        //Prefix Content is: ""

          // get the interactor ui[]
          // Now create the RenderWindow, Renderer and Interactor[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          math = new vtkMath();
          numberOfInputPoints = 30;
          aKSplineX = new vtkKochanekSpline();
          aKSplineX.ClosedOn();
          aKSplineY = new vtkKochanekSpline();
          aKSplineY.ClosedOn();
          aKSplineZ = new vtkKochanekSpline();
          aKSplineZ.ClosedOn();
          aCSplineX = new vtkCardinalSpline();
          aCSplineX.ClosedOn();
          aCSplineY = new vtkCardinalSpline();
          aCSplineY.ClosedOn();
          aCSplineZ = new vtkCardinalSpline();
          aCSplineZ.ClosedOn();
          // add some points[]
          inputPoints = new vtkPoints();
          x = -1.0;
          y = -1.0;
          z = 0.0;
          aKSplineX.AddPoint((double)0,(double)x);
          aKSplineY.AddPoint((double)0,(double)y);
          aKSplineZ.AddPoint((double)0,(double)z);
          aCSplineX.AddPoint((double)0,(double)x);
          aCSplineY.AddPoint((double)0,(double)y);
          aCSplineZ.AddPoint((double)0,(double)z);
          inputPoints.InsertPoint((int)0,(double)x,(double)y,(double)z);
          x = 1.0;
          y = -1.0;
          z = 0.0;
          aKSplineX.AddPoint((double)1,(double)x);
          aKSplineY.AddPoint((double)1,(double)y);
          aKSplineZ.AddPoint((double)1,(double)z);
          aCSplineX.AddPoint((double)1,(double)x);
          aCSplineY.AddPoint((double)1,(double)y);
          aCSplineZ.AddPoint((double)1,(double)z);
          inputPoints.InsertPoint((int)1,(double)x,(double)y,(double)z);
          x = 1.0;
          y = 1.0;
          z = 0.0;
          aKSplineX.AddPoint((double)2,(double)x);
          aKSplineY.AddPoint((double)2,(double)y);
          aKSplineZ.AddPoint((double)2,(double)z);
          aCSplineX.AddPoint((double)2,(double)x);
          aCSplineY.AddPoint((double)2,(double)y);
          aCSplineZ.AddPoint((double)2,(double)z);
          inputPoints.InsertPoint((int)2,(double)x,(double)y,(double)z);
          x = -1.0;
          y = 1.0;
          z = 0.0;
          aKSplineX.AddPoint((double)3,(double)x);
          aKSplineY.AddPoint((double)3,(double)y);
          aKSplineZ.AddPoint((double)3,(double)z);
          aCSplineX.AddPoint((double)3,(double)x);
          aCSplineY.AddPoint((double)3,(double)y);
          aCSplineZ.AddPoint((double)3,(double)z);
          inputPoints.InsertPoint((int)3,(double)x,(double)y,(double)z);
          inputData = new vtkPolyData();
          inputData.SetPoints((vtkPoints)inputPoints);
          balls = new vtkSphereSource();
          balls.SetRadius((double).04);
          balls.SetPhiResolution((int)10);
          balls.SetThetaResolution((int)10);
          glyphPoints = new vtkGlyph3D();
          glyphPoints.SetInput((vtkDataObject)inputData);
          glyphPoints.SetSource((vtkPolyData)balls.GetOutput());
          glyphMapper = vtkPolyDataMapper.New();
          glyphMapper.SetInputConnection((vtkAlgorithmOutput)glyphPoints.GetOutputPort());
          glyph = new vtkActor();
          glyph.SetMapper((vtkMapper)glyphMapper);
          glyph.GetProperty().SetDiffuseColor((double) 1.0000, 0.3882, 0.2784 );
          glyph.GetProperty().SetSpecular((double).3);
          glyph.GetProperty().SetSpecularPower((double)30);
          ren1.AddActor((vtkProp)glyph);
          Kpoints = new vtkPoints();
          Cpoints = new vtkPoints();
          profileKData = new vtkPolyData();
          profileCData = new vtkPolyData();
          numberOfInputPoints = 5;
          numberOfOutputPoints = 100;
          offset = 1.0;
          //method moved
          fit();
          lines = new vtkCellArray();
          lines.InsertNextCell((int)numberOfOutputPoints);
          i = 0;
          while((i) < numberOfOutputPoints)
        {
          lines.InsertCellPoint((int)i);
          i = i + 1;
        }

          profileKData.SetPoints((vtkPoints)Kpoints);
          profileKData.SetLines((vtkCellArray)lines);
          profileCData.SetPoints((vtkPoints)Cpoints);
          profileCData.SetLines((vtkCellArray)lines);
          profileKTubes = new vtkTubeFilter();
          profileKTubes.SetNumberOfSides((int)8);
          profileKTubes.SetInput((vtkDataObject)profileKData);
          profileKTubes.SetRadius((double).01);
          profileKMapper = vtkPolyDataMapper.New();
          profileKMapper.SetInputConnection((vtkAlgorithmOutput)profileKTubes.GetOutputPort());
          profileK = new vtkActor();
          profileK.SetMapper((vtkMapper)profileKMapper);
          profileK.GetProperty().SetDiffuseColor((double) 0.8900, 0.8100, 0.3400 );
          profileK.GetProperty().SetSpecular((double).3);
          profileK.GetProperty().SetSpecularPower((double)30);
          ren1.AddActor((vtkProp)profileK);
          profileCTubes = new vtkTubeFilter();
          profileCTubes.SetNumberOfSides((int)8);
          profileCTubes.SetInput((vtkDataObject)profileCData);
          profileCTubes.SetRadius((double).01);
          profileCMapper = vtkPolyDataMapper.New();
          profileCMapper.SetInputConnection((vtkAlgorithmOutput)profileCTubes.GetOutputPort());
          profileC = new vtkActor();
          profileC.SetMapper((vtkMapper)profileCMapper);
          profileC.GetProperty().SetDiffuseColor((double) 0.2000, 0.6300, 0.7900 );
          profileC.GetProperty().SetSpecular((double).3);
          profileC.GetProperty().SetSpecularPower((double)30);
          ren1.AddActor((vtkProp)profileC);
          ren1.ResetCamera();
          ren1.GetActiveCamera().Dolly((double)1.5);
          ren1.ResetCameraClippingRange();
          renWin.SetSize((int)300,(int)300);
          // render the image[]
          //[]
          iren.Initialize();
          // prevent the tk window from showing up then start the event loop[]
          //method moved
          //method moved
          //method moved
          //method moved
          //method moved
          //method moved

        //deleteAllVTKObjects();
    }
예제 #19
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetprofileCTubes(vtkTubeFilter toSet)
 {
     profileCTubes = toSet;
 }
예제 #20
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVgaussian(String [] argv)
    {
        //Prefix Content is: ""

          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          renWin.SetSize((int)300,(int)300);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          camera = new vtkCamera();
          camera.ParallelProjectionOn();
          camera.SetViewUp((double)0,(double)1,(double)0);
          camera.SetFocalPoint((double)12,(double)10.5,(double)15);
          camera.SetPosition((double)-70,(double)15,(double)34);
          camera.ComputeViewPlaneNormal();
          ren1.SetActiveCamera((vtkCamera)camera);
          // Create the reader for the data[]
          //vtkStructuredPointsReader reader[]
          reader = new vtkGaussianCubeReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/m4_TotalDensity.cube");
          reader.SetHBScale((double)1.1);
          reader.SetBScale((double)10);
          reader.Update();
          range = reader.GetGridOutput().GetPointData().GetScalars().GetRange();
          min = (double)(lindex(range,0));
          max = (double)(lindex(range,1));
          readerSS = new vtkImageShiftScale();
          readerSS.SetInput((vtkDataObject)reader.GetGridOutput());
          readerSS.SetShift((double)min*-1);
          readerSS.SetScale((double)255/(max-min));
          readerSS.SetOutputScalarTypeToUnsignedChar();
          bounds = new vtkOutlineFilter();
          bounds.SetInput((vtkDataObject)reader.GetGridOutput());
          boundsMapper = vtkPolyDataMapper.New();
          boundsMapper.SetInputConnection((vtkAlgorithmOutput)bounds.GetOutputPort());
          boundsActor = new vtkActor();
          boundsActor.SetMapper((vtkMapper)boundsMapper);
          boundsActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          contour = new vtkContourFilter();
          contour.SetInput((vtkDataObject)reader.GetGridOutput());
          contour.GenerateValues((int)5,(double)0,(double).05);
          contourMapper = vtkPolyDataMapper.New();
          contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
          contourMapper.SetScalarRange((double)0,(double).1);
          ((vtkLookupTable)contourMapper.GetLookupTable()).SetHueRange(0.32,0);
          contourActor = new vtkActor();
          contourActor.SetMapper((vtkMapper)contourMapper);
          contourActor.GetProperty().SetOpacity((double).5);
          // Create transfer mapping scalar value to opacity[]
          opacityTransferFunction = new vtkPiecewiseFunction();
          opacityTransferFunction.AddPoint((double)0,(double)0.01);
          opacityTransferFunction.AddPoint((double)255,(double)0.35);
          opacityTransferFunction.ClampingOn();
          // Create transfer mapping scalar value to color[]
          colorTransferFunction = new vtkColorTransferFunction();
          colorTransferFunction.AddHSVPoint((double)0.0,(double)0.66,(double)1.0,(double)1.0);
          colorTransferFunction.AddHSVPoint((double)50.0,(double)0.33,(double)1.0,(double)1.0);
          colorTransferFunction.AddHSVPoint((double)100.0,(double)0.00,(double)1.0,(double)1.0);
          // The property describes how the data will look[]
          volumeProperty = new vtkVolumeProperty();
          volumeProperty.SetColor((vtkColorTransferFunction)colorTransferFunction);
          volumeProperty.SetScalarOpacity((vtkPiecewiseFunction)opacityTransferFunction);
          volumeProperty.SetInterpolationTypeToLinear();
          // The mapper / ray cast function know how to render the data[]
          compositeFunction = new vtkVolumeRayCastCompositeFunction();
          volumeMapper = new vtkVolumeRayCastMapper();
          //vtkVolumeTextureMapper2D volumeMapper[]
          volumeMapper.SetVolumeRayCastFunction((vtkVolumeRayCastFunction)compositeFunction);
          volumeMapper.SetInputConnection((vtkAlgorithmOutput)readerSS.GetOutputPort());
          // The volume holds the mapper and the property and[]
          // can be used to position/orient the volume[]
          volume = new vtkVolume();
          volume.SetMapper((vtkAbstractVolumeMapper)volumeMapper);
          volume.SetProperty((vtkVolumeProperty)volumeProperty);
          ren1.AddVolume((vtkProp)volume);
          //ren1 AddActor contourActor[]
          ren1.AddActor((vtkProp)boundsActor);
          //#####################################################################[]
          Sphere = new vtkSphereSource();
          Sphere.SetCenter((double)0,(double)0,(double)0);
          Sphere.SetRadius((double)1);
          Sphere.SetThetaResolution((int)16);
          Sphere.SetStartTheta((double)0);
          Sphere.SetEndTheta((double)360);
          Sphere.SetPhiResolution((int)16);
          Sphere.SetStartPhi((double)0);
          Sphere.SetEndPhi((double)180);
          Glyph = new vtkGlyph3D();
          Glyph.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          Glyph.SetOrient((int)1);
          Glyph.SetColorMode((int)1);
          //Glyph ScalingOn[]
          Glyph.SetScaleMode((int)2);
          Glyph.SetScaleFactor((double).6);
          Glyph.SetSource((vtkPolyData)Sphere.GetOutput());
          AtomsMapper = vtkPolyDataMapper.New();
          AtomsMapper.SetInputConnection((vtkAlgorithmOutput)Glyph.GetOutputPort());
          AtomsMapper.SetImmediateModeRendering((int)1);
          AtomsMapper.UseLookupTableScalarRangeOff();
          AtomsMapper.SetScalarVisibility((int)1);
          AtomsMapper.SetScalarModeToDefault();
          Atoms = new vtkActor();
          Atoms.SetMapper((vtkMapper)AtomsMapper);
          Atoms.GetProperty().SetRepresentationToSurface();
          Atoms.GetProperty().SetInterpolationToGouraud();
          Atoms.GetProperty().SetAmbient((double)0.15);
          Atoms.GetProperty().SetDiffuse((double)0.85);
          Atoms.GetProperty().SetSpecular((double)0.1);
          Atoms.GetProperty().SetSpecularPower((double)100);
          Atoms.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);
          Atoms.GetProperty().SetColor((double)1,(double)1,(double)1);
          Tube = new vtkTubeFilter();
          Tube.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          Tube.SetNumberOfSides((int)16);
          Tube.SetCapping((int)0);
          Tube.SetRadius((double)0.2);
          Tube.SetVaryRadius((int)0);
          Tube.SetRadiusFactor((double)10);
          BondsMapper = vtkPolyDataMapper.New();
          BondsMapper.SetInputConnection((vtkAlgorithmOutput)Tube.GetOutputPort());
          BondsMapper.SetImmediateModeRendering((int)1);
          BondsMapper.UseLookupTableScalarRangeOff();
          BondsMapper.SetScalarVisibility((int)1);
          BondsMapper.SetScalarModeToDefault();
          Bonds = new vtkActor();
          Bonds.SetMapper((vtkMapper)BondsMapper);
          Bonds.GetProperty().SetRepresentationToSurface();
          Bonds.GetProperty().SetInterpolationToGouraud();
          Bonds.GetProperty().SetAmbient((double)0.15);
          Bonds.GetProperty().SetDiffuse((double)0.85);
          Bonds.GetProperty().SetSpecular((double)0.1);
          Bonds.GetProperty().SetSpecularPower((double)100);
          Bonds.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);
          Bonds.GetProperty().SetColor((double)1,(double)1,(double)1);
          ren1.AddActor((vtkProp)Bonds);
          ren1.AddActor((vtkProp)Atoms);
          //###################################################[]
          ren1.SetBackground((double)1,(double)1,(double)1);
          ren1.ResetCamera();
          renWin.Render();
          //method moved

          renWin.AbortCheckEvt += new Kitware.VTK.vtkObject.vtkObjectEventHandler(TkCheckAbort_Command.Execute);
          iren.Initialize();

        //deleteAllVTKObjects();
    }
예제 #21
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVgaussian(String [] argv)
    {
        //Prefix Content is: ""

        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.SetMultiSamples(0);
        renWin.AddRenderer((vtkRenderer)ren1);
        renWin.SetSize((int)300, (int)300);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        camera = new vtkCamera();
        camera.ParallelProjectionOn();
        camera.SetViewUp((double)0, (double)1, (double)0);
        camera.SetFocalPoint((double)12, (double)10.5, (double)15);
        camera.SetPosition((double)-70, (double)15, (double)34);
        camera.ComputeViewPlaneNormal();
        ren1.SetActiveCamera((vtkCamera)camera);
        // Create the reader for the data[]
        //vtkStructuredPointsReader reader[]
        reader = new vtkGaussianCubeReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/m4_TotalDensity.cube");
        reader.SetHBScale((double)1.1);
        reader.SetBScale((double)10);
        reader.Update();
        range    = reader.GetGridOutput().GetPointData().GetScalars().GetRange();
        min      = (double)(lindex(range, 0));
        max      = (double)(lindex(range, 1));
        readerSS = new vtkImageShiftScale();
        readerSS.SetInputData((vtkDataObject)reader.GetGridOutput());
        readerSS.SetShift((double)min * -1);
        readerSS.SetScale((double)255 / (max - min));
        readerSS.SetOutputScalarTypeToUnsignedChar();
        bounds = new vtkOutlineFilter();
        bounds.SetInputData((vtkDataObject)reader.GetGridOutput());
        boundsMapper = vtkPolyDataMapper.New();
        boundsMapper.SetInputConnection((vtkAlgorithmOutput)bounds.GetOutputPort());
        boundsActor = new vtkActor();
        boundsActor.SetMapper((vtkMapper)boundsMapper);
        boundsActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        contour = new vtkContourFilter();
        contour.SetInputData((vtkDataObject)reader.GetGridOutput());
        contour.GenerateValues((int)5, (double)0, (double).05);
        contourMapper = vtkPolyDataMapper.New();
        contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
        contourMapper.SetScalarRange((double)0, (double).1);
        ((vtkLookupTable)contourMapper.GetLookupTable()).SetHueRange(0.32, 0);
        contourActor = new vtkActor();
        contourActor.SetMapper((vtkMapper)contourMapper);
        contourActor.GetProperty().SetOpacity((double).5);
        // Create transfer mapping scalar value to opacity[]
        opacityTransferFunction = new vtkPiecewiseFunction();
        opacityTransferFunction.AddPoint((double)0, (double)0.01);
        opacityTransferFunction.AddPoint((double)255, (double)0.35);
        opacityTransferFunction.ClampingOn();
        // Create transfer mapping scalar value to color[]
        colorTransferFunction = new vtkColorTransferFunction();
        colorTransferFunction.AddHSVPoint((double)0.0, (double)0.66, (double)1.0, (double)1.0);
        colorTransferFunction.AddHSVPoint((double)50.0, (double)0.33, (double)1.0, (double)1.0);
        colorTransferFunction.AddHSVPoint((double)100.0, (double)0.00, (double)1.0, (double)1.0);
        // The property describes how the data will look[]
        volumeProperty = new vtkVolumeProperty();
        volumeProperty.SetColor((vtkColorTransferFunction)colorTransferFunction);
        volumeProperty.SetScalarOpacity((vtkPiecewiseFunction)opacityTransferFunction);
        volumeProperty.SetInterpolationTypeToLinear();
        // The mapper / ray cast function know how to render the data[]
        compositeFunction = new vtkVolumeRayCastCompositeFunction();
        volumeMapper      = new vtkVolumeRayCastMapper();
        //vtkVolumeTextureMapper2D volumeMapper[]
        volumeMapper.SetVolumeRayCastFunction((vtkVolumeRayCastFunction)compositeFunction);
        volumeMapper.SetInputConnection((vtkAlgorithmOutput)readerSS.GetOutputPort());
        // The volume holds the mapper and the property and[]
        // can be used to position/orient the volume[]
        volume = new vtkVolume();
        volume.SetMapper((vtkAbstractVolumeMapper)volumeMapper);
        volume.SetProperty((vtkVolumeProperty)volumeProperty);
        ren1.AddVolume((vtkProp)volume);
        //ren1 AddActor contourActor[]
        ren1.AddActor((vtkProp)boundsActor);
        //#####################################################################[]
        Sphere = new vtkSphereSource();
        Sphere.SetCenter((double)0, (double)0, (double)0);
        Sphere.SetRadius((double)1);
        Sphere.SetThetaResolution((int)16);
        Sphere.SetStartTheta((double)0);
        Sphere.SetEndTheta((double)360);
        Sphere.SetPhiResolution((int)16);
        Sphere.SetStartPhi((double)0);
        Sphere.SetEndPhi((double)180);
        Glyph = new vtkGlyph3D();
        Glyph.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        Glyph.SetOrient((int)1);
        Glyph.SetColorMode((int)1);
        //Glyph ScalingOn[]
        Glyph.SetScaleMode((int)2);
        Glyph.SetScaleFactor((double).6);
        Glyph.SetSourceConnection(Sphere.GetOutputPort());
        AtomsMapper = vtkPolyDataMapper.New();
        AtomsMapper.SetInputConnection((vtkAlgorithmOutput)Glyph.GetOutputPort());
        AtomsMapper.SetImmediateModeRendering((int)1);
        AtomsMapper.UseLookupTableScalarRangeOff();
        AtomsMapper.SetScalarVisibility((int)1);
        AtomsMapper.SetScalarModeToDefault();
        Atoms = new vtkActor();
        Atoms.SetMapper((vtkMapper)AtomsMapper);
        Atoms.GetProperty().SetRepresentationToSurface();
        Atoms.GetProperty().SetInterpolationToGouraud();
        Atoms.GetProperty().SetAmbient((double)0.15);
        Atoms.GetProperty().SetDiffuse((double)0.85);
        Atoms.GetProperty().SetSpecular((double)0.1);
        Atoms.GetProperty().SetSpecularPower((double)100);
        Atoms.GetProperty().SetSpecularColor((double)1, (double)1, (double)1);
        Atoms.GetProperty().SetColor((double)1, (double)1, (double)1);
        Tube = new vtkTubeFilter();
        Tube.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        Tube.SetNumberOfSides((int)16);
        Tube.SetCapping((int)0);
        Tube.SetRadius((double)0.2);
        Tube.SetVaryRadius((int)0);
        Tube.SetRadiusFactor((double)10);
        BondsMapper = vtkPolyDataMapper.New();
        BondsMapper.SetInputConnection((vtkAlgorithmOutput)Tube.GetOutputPort());
        BondsMapper.SetImmediateModeRendering((int)1);
        BondsMapper.UseLookupTableScalarRangeOff();
        BondsMapper.SetScalarVisibility((int)1);
        BondsMapper.SetScalarModeToDefault();
        Bonds = new vtkActor();
        Bonds.SetMapper((vtkMapper)BondsMapper);
        Bonds.GetProperty().SetRepresentationToSurface();
        Bonds.GetProperty().SetInterpolationToGouraud();
        Bonds.GetProperty().SetAmbient((double)0.15);
        Bonds.GetProperty().SetDiffuse((double)0.85);
        Bonds.GetProperty().SetSpecular((double)0.1);
        Bonds.GetProperty().SetSpecularPower((double)100);
        Bonds.GetProperty().SetSpecularColor((double)1, (double)1, (double)1);
        Bonds.GetProperty().SetColor((double)1, (double)1, (double)1);
        ren1.AddActor((vtkProp)Bonds);
        ren1.AddActor((vtkProp)Atoms);
        //###################################################[]
        ren1.SetBackground((double)1, (double)1, (double)1);
        ren1.ResetCamera();
        renWin.Render();
        //method moved

        renWin.AbortCheckEvt += new Kitware.VTK.vtkObject.vtkObjectEventHandler(TkCheckAbort_Command.Execute);
        iren.Initialize();

//deleteAllVTKObjects();
    }
예제 #22
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVfieldToRGrid(String [] argv)
    {
        //Prefix Content is: ""

          //# Generate a rectilinear grid from a field.[]
          //#[]
          // get the interactor ui[]
          // Create a reader and write out the field[]
          reader = new vtkDataSetReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
          ds2do = new vtkDataSetToDataObjectFilter();
          ds2do.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          try
          {
         channel = new StreamWriter("RGridField.vtk");
          tryCatchError = "NOERROR";
          }
          catch(Exception)
          {tryCatchError = "ERROR";}

        if(tryCatchError.Equals("NOERROR"))
          {
          channel.Close();
          writer = new vtkDataObjectWriter();
          writer.SetInputConnection((vtkAlgorithmOutput)ds2do.GetOutputPort());
          writer.SetFileName((string)"RGridField.vtk");
          writer.Write();
          // Read the field[]
          //[]
          dor = new vtkDataObjectReader();
          dor.SetFileName((string)"RGridField.vtk");
          do2ds = new vtkDataObjectToDataSetFilter();
          do2ds.SetInputConnection((vtkAlgorithmOutput)dor.GetOutputPort());
          do2ds.SetDataSetTypeToRectilinearGrid();
          do2ds.SetDimensionsComponent((string)"Dimensions",(int)0);
          do2ds.SetPointComponent((int)0,(string)"XCoordinates",(int)0);
          do2ds.SetPointComponent((int)1,(string)"YCoordinates",(int)0);
          do2ds.SetPointComponent((int)2,(string)"ZCoordinates",(int)0);
          fd2ad = new vtkFieldDataToAttributeDataFilter();
          fd2ad.SetInput((vtkDataObject)do2ds.GetRectilinearGridOutput());
          fd2ad.SetInputFieldToDataObjectField();
          fd2ad.SetOutputAttributeDataToPointData();
          fd2ad.SetVectorComponent((int)0,(string)"vectors",(int)0);
          fd2ad.SetVectorComponent((int)1,(string)"vectors",(int)1);
          fd2ad.SetVectorComponent((int)2,(string)"vectors",(int)2);
          fd2ad.SetScalarComponent((int)0,(string)"scalars",(int)0);
          fd2ad.Update();
          // create pipeline[]
          //[]
          plane = new vtkRectilinearGridGeometryFilter();
          plane.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
          plane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)15,(int)15);
          warper = new vtkWarpVector();
          warper.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          warper.SetScaleFactor((double)0.05);
          planeMapper = new vtkDataSetMapper();
          planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
          planeMapper.SetScalarRange((double)0.197813,(double)0.710419);
          planeActor = new vtkActor();
          planeActor.SetMapper((vtkMapper)planeMapper);
          cutPlane = new vtkPlane();
          cutPlane.SetOrigin(fd2ad.GetOutput().GetCenter()[0],fd2ad.GetOutput().GetCenter()[1],fd2ad.GetOutput().GetCenter()[2]);
          cutPlane.SetNormal((double)1,(double)0,(double)0);
          planeCut = new vtkCutter();
          planeCut.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
          planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
          cutMapper = new vtkDataSetMapper();
          cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
          cutMapper.SetScalarRange(
          (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[0],
          (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
          cutActor = new vtkActor();
          cutActor.SetMapper((vtkMapper)cutMapper);
          iso = new vtkContourFilter();
          iso.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
          iso.SetValue((int)0,(double)0.7);
          normals = new vtkPolyDataNormals();
          normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
          normals.SetFeatureAngle((double)45);
          isoMapper = vtkPolyDataMapper.New();
          isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
          isoMapper.ScalarVisibilityOff();
          isoActor = new vtkActor();
          isoActor.SetMapper((vtkMapper)isoMapper);
          isoActor.GetProperty().SetColor((double) 1.0000, 0.8941, 0.7686 );
          isoActor.GetProperty().SetRepresentationToWireframe();
          streamer = new vtkStreamLine();
          streamer.SetInputConnection((vtkAlgorithmOutput)fd2ad.GetOutputPort());
          streamer.SetStartPosition((double)-1.2,(double)-0.1,(double)1.3);
          streamer.SetMaximumPropagationTime((double)500);
          streamer.SetStepLength((double)0.05);
          streamer.SetIntegrationStepLength((double)0.05);
          streamer.SetIntegrationDirectionToIntegrateBothDirections();
          streamTube = new vtkTubeFilter();
          streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          streamTube.SetRadius((double)0.025);
          streamTube.SetNumberOfSides((int)6);
          streamTube.SetVaryRadiusToVaryRadiusByVector();
          mapStreamTube = vtkPolyDataMapper.New();
          mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
          mapStreamTube.SetScalarRange(
          (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[0],
          (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
          streamTubeActor = new vtkActor();
          streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
          streamTubeActor.GetProperty().BackfaceCullingOn();
          outline = new vtkOutlineFilter();
          outline.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          outlineActor.GetProperty().SetColor((double) 0.0000, 0.0000, 0.0000 );
          // Graphics stuff[]
          // Create the RenderWindow, Renderer and both Actors[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)planeActor);
          ren1.AddActor((vtkProp)cutActor);
          ren1.AddActor((vtkProp)isoActor);
          ren1.AddActor((vtkProp)streamTubeActor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)300,(int)300);
          ren1.GetActiveCamera().SetPosition((double)0.0390893,(double)0.184813,(double)-3.94026);
          ren1.GetActiveCamera().SetFocalPoint((double)-0.00578326,(double)0,(double)0.701967);
          ren1.GetActiveCamera().SetViewAngle((double)30);
          ren1.GetActiveCamera().SetViewUp((double)0.00850257,(double)0.999169,(double)0.0398605);
          ren1.GetActiveCamera().SetClippingRange((double)3.08127,(double)6.62716);
          iren.Initialize();
          // render the image[]
          //[]

          File.Delete("RGridField.vtk");

        }

          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
예제 #23
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetTube(vtkTubeFilter toSet)
 {
     Tube = toSet;
 }
예제 #24
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVmergeFilter(String [] argv)
    {
        //Prefix Content is: ""

          // Create the RenderWindow, Renderer and both Actors[]
          //[]
          ren1 = vtkRenderer.New();
          ren2 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          renWin.AddRenderer((vtkRenderer)ren2);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // create pipeline[]
          //[]
          pl3d = new vtkPLOT3DReader();
          pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
          pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
          pl3d.SetScalarFunctionNumber((int)110);
          pl3d.SetVectorFunctionNumber((int)202);
          pl3d.Update();
          probeLine = new vtkLineSource();
          probeLine.SetPoint1((double)1,(double)1,(double)29);
          probeLine.SetPoint2((double)16.5,(double)5,(double)31.7693);
          probeLine.SetResolution((int)500);
          probe = new vtkProbeFilter();
          probe.SetInputConnection((vtkAlgorithmOutput)probeLine.GetOutputPort());
          probe.SetSource((vtkDataObject)pl3d.GetOutput());
          probeTube = new vtkTubeFilter();
          probeTube.SetInput((vtkDataObject)probe.GetPolyDataOutput());
          probeTube.SetNumberOfSides((int)5);
          probeTube.SetRadius((double).05);
          probeMapper = vtkPolyDataMapper.New();
          probeMapper.SetInputConnection((vtkAlgorithmOutput)probeTube.GetOutputPort());
          probeMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
          probeActor = new vtkActor();
          probeActor.SetMapper((vtkMapper)probeMapper);
          displayLine = new vtkLineSource();
          displayLine.SetPoint1((double)0,(double)0,(double)0);
          displayLine.SetPoint2((double)1,(double)0,(double)0);
          displayLine.SetResolution((int)probeLine.GetResolution());
          displayMerge = new vtkMergeFilter();
          displayMerge.SetGeometry((vtkDataSet)displayLine.GetOutput());
          displayMerge.SetScalars((vtkDataSet)probe.GetPolyDataOutput());
          displayWarp = new vtkWarpScalar();
          displayWarp.SetInput((vtkDataObject)displayMerge.GetPolyDataOutput());
          displayWarp.SetNormal((double)0,(double)1,(double)0);
          displayWarp.SetScaleFactor((double).000001);
          displayMapper = vtkPolyDataMapper.New();
          displayMapper.SetInput((vtkPolyData)displayWarp.GetPolyDataOutput());
          displayMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
          displayActor = new vtkActor();
          displayActor.SetMapper((vtkMapper)displayMapper);
          outline = new vtkStructuredGridOutlineFilter();
          outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort());
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)probeActor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          ren1.SetViewport((double)0,(double).25,(double)1,(double)1);
          ren2.AddActor((vtkProp)displayActor);
          ren2.SetBackground((double)0,(double)0,(double)0);
          ren2.SetViewport((double)0,(double)0,(double)1,(double).25);
          renWin.SetSize((int)300,(int)300);
          ren1.ResetCamera();
          cam1 = ren1.GetActiveCamera();
          cam1.SetClippingRange((double)3.95297,(double)50);
          cam1.SetFocalPoint((double)8.88908,(double)0.595038,(double)29.3342);
          cam1.SetPosition((double)9.9,(double)-26,(double)41);
          cam1.SetViewUp((double)0.060772,(double)-0.319905,(double)0.945498);
          ren2.ResetCamera();
          cam2 = ren2.GetActiveCamera();
          cam2.ParallelProjectionOn();
          cam2.SetParallelScale((double).15);
          iren.Initialize();
          // render the image[]
          //[]
          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Settubes(vtkTubeFilter toSet)
 {
     tubes = toSet;
 }
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetstreamTube(vtkTubeFilter toSet)
 {
     streamTube = toSet;
 }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestRectilinearGridToTetrahedra(String[] argv)
    {
        //Prefix Content is: ""

        //## SetUp the pipeline[]
        FormMesh = new vtkRectilinearGridToTetrahedra();
        FormMesh.SetInput((double)4, (double)2, (double)2, (double)1, (double)1, (double)1, (double)0.001);
        FormMesh.RememberVoxelIdOn();
        TetraEdges = new vtkExtractEdges();
        TetraEdges.SetInputConnection((vtkAlgorithmOutput)FormMesh.GetOutputPort());
        tubes = new vtkTubeFilter();
        tubes.SetInputConnection((vtkAlgorithmOutput)TetraEdges.GetOutputPort());
        tubes.SetRadius((double)0.05);
        tubes.SetNumberOfSides((int)6);
        //## Run the pipeline 3 times, with different conversions to TetMesh[]
        Tubes[0] = new vtkPolyData();
        FormMesh.SetTetraPerCellTo5();
        tubes.Update();
        Tubes[0].DeepCopy((vtkDataObject)tubes.GetOutput());
        Tubes[1] = new vtkPolyData();
        FormMesh.SetTetraPerCellTo6();
        tubes.Update();
        Tubes[1].DeepCopy((vtkDataObject)tubes.GetOutput());
        Tubes[2] = new vtkPolyData();
        FormMesh.SetTetraPerCellTo12();
        tubes.Update();
        Tubes[2].DeepCopy((vtkDataObject)tubes.GetOutput());
        //## Run the pipeline once more, this time converting some cells to[]
        //## 5 and some data to 12 TetMesh[]
        //## Determine which cells are which[]

        DivTypes = new vtkIntArray();
        numCell = (long)((vtkDataSet)FormMesh.GetInput()).GetNumberOfCells();
        DivTypes.SetNumberOfValues((int)numCell);

        i = 0;
        while ((i) < numCell)
        {
            DivTypes.SetValue((int)i, (int)5 + (7 * (i % 4)));
            i = i + 1;
        }

        //## Finish this pipeline[]
        Tubes[3] = new vtkPolyData();
        FormMesh.SetTetraPerCellTo5And12();
        ((vtkRectilinearGrid)FormMesh.GetInput()).GetCellData().SetScalars(DivTypes);
        tubes.Update();
        Tubes[3].DeepCopy((vtkDataObject)tubes.GetOutput());
        //## Finish the 4 pipelines[]
        i = 1;
        while ((i) < 5)
        {
            mapEdges[i] = vtkPolyDataMapper.New();
            mapEdges[i].SetInputData((vtkPolyData)Tubes[i - 1]);
            edgeActor[i] = new vtkActor();
            edgeActor[i].SetMapper((vtkMapper)mapEdges[i]);
            edgeActor[i].GetProperty().SetColor((double)0.2000, 0.6300, 0.7900);
            edgeActor[i].GetProperty().SetSpecularColor((double)1, (double)1, (double)1);
            edgeActor[i].GetProperty().SetSpecular((double)0.3);
            edgeActor[i].GetProperty().SetSpecularPower((double)20);
            edgeActor[i].GetProperty().SetAmbient((double)0.2);
            edgeActor[i].GetProperty().SetDiffuse((double)0.8);
            ren[i] = vtkRenderer.New();
            ren[i].AddActor((vtkProp)edgeActor[i]);
            ren[i].SetBackground((double)0, (double)0, (double)0);
            ren[i].ResetCamera();
            ren[i].GetActiveCamera().Zoom((double)1);
            ren[i].GetActiveCamera().SetPosition((double)1.73906, (double)12.7987, (double)-0.257808);
            ren[i].GetActiveCamera().SetViewUp((double)0.992444, (double)0.00890284, (double)-0.122379);
            ren[i].GetActiveCamera().SetClippingRange((double)9.36398, (double)15.0496);
            i = i + 1;
        }

        // Create graphics objects[]
        // Create the rendering window, renderer, and interactive renderer[]
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer(ren[1]);
        renWin.AddRenderer(ren[2]);
        renWin.AddRenderer(ren[3]);
        renWin.AddRenderer(ren[4]);
        renWin.SetSize(600, 300);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // Add the actors to the renderer, set the background and size[]
        ren[1].SetViewport((double).75, (double)0, (double)1, (double)1);
        ren[2].SetViewport((double).50, (double)0, (double).75, (double)1);
        ren[3].SetViewport((double).25, (double)0, (double).50, (double)1);
        ren[4].SetViewport((double)0, (double)0, (double).25, (double)1);
        // render the image[]
        //[]
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
예제 #28
0
        private void ReadPDB()
        {
            // Path to vtk data must be set as an environment variable
            // VTK_DATA_ROOT = "C:\VTK\vtkdata-5.8.0"
            vtkTesting test     = vtkTesting.New();
            string     root     = test.GetDataRoot();
            string     filePath = System.IO.Path.Combine(root, @"Data\caffeine.pdb");

            vtkPDBReader pdb = vtkPDBReader.New();

            pdb.SetFileName(filePath);
            pdb.SetHBScale(1.0);
            pdb.SetBScale(1.0);
            pdb.Update();
            Debug.WriteLine("# of atoms is: " + pdb.GetNumberOfAtoms());
            // if molecule contains a lot of atoms, reduce the resolution of the sphere (represents an atom) for faster rendering
            int resolution = (int)Math.Floor(Math.Sqrt(300000.0 / pdb.GetNumberOfAtoms())); // 300000.0 is an empriric value

            if (resolution > 20)
            {
                resolution = 20;
            }
            else if (resolution < 4)
            {
                resolution = 4;
            }

            Debug.WriteLine("Resolution is: " + resolution);
            vtkSphereSource sphere = vtkSphereSource.New();

            sphere.SetCenter(0, 0, 0);
            sphere.SetRadius(1);
            sphere.SetThetaResolution(resolution);
            sphere.SetPhiResolution(resolution);

            vtkGlyph3D glyph = vtkGlyph3D.New();

            glyph.SetInputConnection(pdb.GetOutputPort());
            glyph.SetOrient(1);
            glyph.SetColorMode(1);
            // glyph.ScalingOn();
            glyph.SetScaleMode(2);
            glyph.SetScaleFactor(.25);
            glyph.SetSourceConnection(sphere.GetOutputPort());

            vtkPolyDataMapper atomMapper = vtkPolyDataMapper.New();

            atomMapper.SetInputConnection(glyph.GetOutputPort());
            atomMapper.UseLookupTableScalarRangeOff();
            atomMapper.ScalarVisibilityOn();
            atomMapper.SetScalarModeToDefault();

            vtkLODActor atom = vtkLODActor.New();

            atom.SetMapper(atomMapper);
            atom.GetProperty().SetRepresentationToSurface();
            atom.GetProperty().SetInterpolationToGouraud();
            atom.GetProperty().SetAmbient(0.15);
            atom.GetProperty().SetDiffuse(0.85);
            atom.GetProperty().SetSpecular(0.1);
            atom.GetProperty().SetSpecularPower(30);
            atom.GetProperty().SetSpecularColor(1, 1, 1);
            atom.SetNumberOfCloudPoints(30000);


            vtkTubeFilter tube = vtkTubeFilter.New();

            tube.SetInputConnection(pdb.GetOutputPort());
            tube.SetNumberOfSides(resolution);
            tube.CappingOff();
            tube.SetRadius(0.2);
            // turn off variation of tube radius with scalar values
            tube.SetVaryRadius(0);
            tube.SetRadiusFactor(10);

            vtkPolyDataMapper bondMapper = vtkPolyDataMapper.New();

            bondMapper.SetInputConnection(tube.GetOutputPort());
            bondMapper.UseLookupTableScalarRangeOff();
            bondMapper.ScalarVisibilityOff();
            bondMapper.SetScalarModeToDefault();

            vtkLODActor bond = vtkLODActor.New();

            bond.SetMapper(bondMapper);
            bond.GetProperty().SetRepresentationToSurface();
            bond.GetProperty().SetInterpolationToGouraud();
            bond.GetProperty().SetAmbient(0.15);
            bond.GetProperty().SetDiffuse(0.85);
            bond.GetProperty().SetSpecular(0.1);
            bond.GetProperty().SetSpecularPower(30);
            bond.GetProperty().SetSpecularColor(1, 1, 1);
            bond.GetProperty().SetDiffuseColor(1.0000, 0.8941, 0.70981);


            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();

            // set background color
            renderer.SetBackground(0.2, 0.3, 0.4);
            // add our actor to the renderer
            renderer.AddActor(atom);
            renderer.AddActor(bond);
        }
예제 #29
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestRectilinearGridToTetrahedra(String[] argv)
    {
        //Prefix Content is: ""

        //## SetUp the pipeline[]
        FormMesh = new vtkRectilinearGridToTetrahedra();
        FormMesh.SetInput((double)4, (double)2, (double)2, (double)1, (double)1, (double)1, (double)0.001);
        FormMesh.RememberVoxelIdOn();
        TetraEdges = new vtkExtractEdges();
        TetraEdges.SetInputConnection((vtkAlgorithmOutput)FormMesh.GetOutputPort());
        tubes = new vtkTubeFilter();
        tubes.SetInputConnection((vtkAlgorithmOutput)TetraEdges.GetOutputPort());
        tubes.SetRadius((double)0.05);
        tubes.SetNumberOfSides((int)6);
        //## Run the pipeline 3 times, with different conversions to TetMesh[]
        Tubes[0] = new vtkPolyData();
        FormMesh.SetTetraPerCellTo5();
        tubes.Update();
        Tubes[0].DeepCopy((vtkDataObject)tubes.GetOutput());
        Tubes[1] = new vtkPolyData();
        FormMesh.SetTetraPerCellTo6();
        tubes.Update();
        Tubes[1].DeepCopy((vtkDataObject)tubes.GetOutput());
        Tubes[2] = new vtkPolyData();
        FormMesh.SetTetraPerCellTo12();
        tubes.Update();
        Tubes[2].DeepCopy((vtkDataObject)tubes.GetOutput());
        //## Run the pipeline once more, this time converting some cells to[]
        //## 5 and some data to 12 TetMesh[]
        //## Determine which cells are which[]

        DivTypes = new vtkIntArray();
        numCell  = (long)((vtkDataSet)FormMesh.GetInput()).GetNumberOfCells();
        DivTypes.SetNumberOfValues((int)numCell);

        i = 0;
        while ((i) < numCell)
        {
            DivTypes.SetValue((int)i, (int)5 + (7 * (i % 4)));
            i = i + 1;
        }

        //## Finish this pipeline[]
        Tubes[3] = new vtkPolyData();
        FormMesh.SetTetraPerCellTo5And12();
        ((vtkRectilinearGrid)FormMesh.GetInput()).GetCellData().SetScalars(DivTypes);
        tubes.Update();
        Tubes[3].DeepCopy((vtkDataObject)tubes.GetOutput());
        //## Finish the 4 pipelines[]
        i = 1;
        while ((i) < 5)
        {
            mapEdges[i] = vtkPolyDataMapper.New();
            mapEdges[i].SetInputData((vtkPolyData)Tubes[i - 1]);
            edgeActor[i] = new vtkActor();
            edgeActor[i].SetMapper((vtkMapper)mapEdges[i]);
            edgeActor[i].GetProperty().SetColor((double)0.2000, 0.6300, 0.7900);
            edgeActor[i].GetProperty().SetSpecularColor((double)1, (double)1, (double)1);
            edgeActor[i].GetProperty().SetSpecular((double)0.3);
            edgeActor[i].GetProperty().SetSpecularPower((double)20);
            edgeActor[i].GetProperty().SetAmbient((double)0.2);
            edgeActor[i].GetProperty().SetDiffuse((double)0.8);
            ren[i] = vtkRenderer.New();
            ren[i].AddActor((vtkProp)edgeActor[i]);
            ren[i].SetBackground((double)0, (double)0, (double)0);
            ren[i].ResetCamera();
            ren[i].GetActiveCamera().Zoom((double)1);
            ren[i].GetActiveCamera().SetPosition((double)1.73906, (double)12.7987, (double)-0.257808);
            ren[i].GetActiveCamera().SetViewUp((double)0.992444, (double)0.00890284, (double)-0.122379);
            ren[i].GetActiveCamera().SetClippingRange((double)9.36398, (double)15.0496);
            i = i + 1;
        }

        // Create graphics objects[]
        // Create the rendering window, renderer, and interactive renderer[]
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer(ren[1]);
        renWin.AddRenderer(ren[2]);
        renWin.AddRenderer(ren[3]);
        renWin.AddRenderer(ren[4]);
        renWin.SetSize(600, 300);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // Add the actors to the renderer, set the background and size[]
        ren[1].SetViewport((double).75, (double)0, (double)1, (double)1);
        ren[2].SetViewport((double).50, (double)0, (double).75, (double)1);
        ren[3].SetViewport((double).25, (double)0, (double).50, (double)1);
        ren[4].SetViewport((double)0, (double)0, (double).25, (double)1);
        // render the image[]
        //[]
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }