Example #1
0
        private List <vtkActor> DrawClockLines()
        {
            List <vtkActor> actors = new List <vtkActor>();

            // Create a line.
            vtkLineSource line1 = vtkLineSource.New();
            vtkLineSource line2 = vtkLineSource.New();
            vtkLineSource line3 = vtkLineSource.New();
            vtkLineSource line4 = vtkLineSource.New();

            line1.SetPoint1(0.05, 0, 0);
            line1.SetPoint2(1.05, 0, 0);
            line2.SetPoint1(0, 0.05, 0);
            line2.SetPoint2(0, 1.05, 0);
            line3.SetPoint1(-0.05, 0, 0);
            line3.SetPoint2(-1.05, 0, 0);
            line4.SetPoint1(0, -0.05, 0);
            line4.SetPoint2(0, -1.05, 0);

            vtkLineSource[] lines = { line1, line2, line3, line4 };

            foreach (vtkLineSource line in lines)
            {
                vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
                mapper.SetInputConnection(line.GetOutputPort());
                vtkActor lineActor = vtkActor.New();
                lineActor.SetMapper(mapper);
                lineActor.GetProperty().SetColor(0, 0, 0);
                actors.Add(lineActor);
            }

            return(actors);
        }
Example #2
0
        private void Line()
        {
            // Create a line.
            vtkLineSource lineSource = vtkLineSource.New();

            // Create two points, P0 and P1
            double[] p0 = new double[] { 1.0, 0.0, 0.0 };
            double[] p1 = new double[] { 0.0, 1.0, 0.0 };

            lineSource.SetPoint1(p0[0], p0[1], p0[2]);
            lineSource.SetPoint2(p1[0], p1[1], p1[2]);

            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(lineSource.GetOutputPort());
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetLineWidth(4);
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            vtkRenderer     renderer     = renderWindow.GetRenderers().GetFirstRenderer();

            renderer.SetBackground(0.2, 0.3, 0.4);
            renderer.AddActor(actor);
            renderer.ResetCamera();
        }
Example #3
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);
        }
Example #4
0
        public LinePackage(RendererPackage rendererPackage)
        {
            line = vtkLineSource.New();
            line.SetResolution(100);

            vtkPolyDataMapper sphereMapper = vtkPolyDataMapper.New();

            sphereMapper.SetInput(line.GetOutput());
            _lineActor = vtkActor.New();

            _lineActor.SetMapper(sphereMapper);
            rendererPackage.Renderer.AddActor(_lineActor);

            this._rendererPackage = rendererPackage;
        }
Example #5
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);
        }
Example #6
0
        private vtkActor DrawIndicatorLine(float curX, float yOffset)
        {
            // Create a line.
            vtkLineSource lineSource = vtkLineSource.New();

            // Create two points, P0 and P1
            double[] p0 = new double[] { curX, -Constants.INDICATOR_LINE_OFFSET + yOffset, 0.0 };
            double[] p1 = new double[] { curX, Constants.INDICATOR_LINE_OFFSET + yOffset, 0.0 };

            lineSource.SetPoint1(p0[0], p0[1], p0[2]);
            lineSource.SetPoint2(p1[0], p1[1], p1[2]);

            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(lineSource.GetOutputPort());
            vtkActor lineActor = vtkActor.New();

            lineActor.SetMapper(mapper);
            lineActor.GetProperty().SetColor(0, 0, 0);

            return(lineActor);
        }
Example #7
0
        private void Line()
        {
            // Create a line.
            vtkLineSource lineSource = vtkLineSource.New();

            // Create two points, P0 and P1
            double[] p0 = new double[] { 1.0, 0.0, 0.0 };
            double[] p1 = new double[] { 0.0, 1.0, 0.0 };

            lineSource.SetPoint1(p0[0], p0[1], p0[2]);
            lineSource.SetPoint2(p1[0], p1[1], p1[2]);

            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(lineSource.GetOutputPort());
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetLineWidth(4);

            RenderAddActor(actor);
        }
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetLineSourceWidget0(vtkLineSource toSet)
 {
     LineSourceWidget0 = toSet;
 }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestMultiBlockStreamer(String [] argv)
    {
        //Prefix Content is: ""

        // we need to use composite data pipeline with multiblock datasets[]
        alg = new vtkAlgorithm();
        pip = new vtkCompositeDataPipeline();
        vtkAlgorithm.SetDefaultExecutivePrototype((vtkExecutive)pip);
        //skipping Delete pip
        Ren1 = vtkRenderer.New();
        Ren1.SetBackground((double)0.33, (double)0.35, (double)0.43);

        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)Ren1);

        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);

        Plot3D0 = new vtkMultiBlockPLOT3DReader();
        Plot3D0.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
        Plot3D0.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
        Plot3D0.SetBinaryFile((int)1);
        Plot3D0.SetMultiGrid((int)0);
        Plot3D0.SetHasByteCount((int)0);
        Plot3D0.SetIBlanking((int)0);
        Plot3D0.SetTwoDimensionalGeometry((int)0);
        Plot3D0.SetForceRead((int)0);
        Plot3D0.SetByteOrder((int)0);
        Plot3D0.Update();

        Geometry5 = new vtkStructuredGridOutlineFilter();
        Geometry5.SetInputData((vtkDataSet)Plot3D0.GetOutput().GetBlock(0));

        Mapper5 = vtkPolyDataMapper.New();
        Mapper5.SetInputConnection((vtkAlgorithmOutput)Geometry5.GetOutputPort());
        Mapper5.SetImmediateModeRendering((int)1);
        Mapper5.UseLookupTableScalarRangeOn();
        Mapper5.SetScalarVisibility((int)0);
        Mapper5.SetScalarModeToDefault();

        Actor5 = new vtkActor();
        Actor5.SetMapper((vtkMapper)Mapper5);
        Actor5.GetProperty().SetRepresentationToSurface();
        Actor5.GetProperty().SetInterpolationToGouraud();
        Actor5.GetProperty().SetAmbient((double)0.15);
        Actor5.GetProperty().SetDiffuse((double)0.85);
        Actor5.GetProperty().SetSpecular((double)0.1);
        Actor5.GetProperty().SetSpecularPower((double)100);
        Actor5.GetProperty().SetSpecularColor((double)1, (double)1, (double)1);

        Actor5.GetProperty().SetColor((double)1, (double)1, (double)1);
        Ren1.AddActor((vtkProp)Actor5);

        ExtractGrid[0] = new vtkExtractGrid();
        ExtractGrid[0].SetInputData((vtkDataSet)Plot3D0.GetOutput().GetBlock(0));
        ExtractGrid[0].SetVOI((int)0, (int)14, (int)0, (int)32, (int)0, (int)24);
        ExtractGrid[0].SetSampleRate((int)1, (int)1, (int)1);
        ExtractGrid[0].SetIncludeBoundary((int)0);

        ExtractGrid[1] = new vtkExtractGrid();
        ExtractGrid[1].SetInputData((vtkDataSet)Plot3D0.GetOutput().GetBlock(0));
        ExtractGrid[1].SetVOI((int)14, (int)29, (int)0, (int)32, (int)0, (int)24);
        ExtractGrid[1].SetSampleRate((int)1, (int)1, (int)1);
        ExtractGrid[1].SetIncludeBoundary((int)0);

        ExtractGrid[2] = new vtkExtractGrid();
        ExtractGrid[2].SetInputData((vtkDataSet)Plot3D0.GetOutput().GetBlock(0));
        ExtractGrid[2].SetVOI((int)29, (int)56, (int)0, (int)32, (int)0, (int)24);
        ExtractGrid[2].SetSampleRate((int)1, (int)1, (int)1);
        ExtractGrid[2].SetIncludeBoundary((int)0);

        LineSourceWidget0 = new vtkLineSource();
        LineSourceWidget0.SetPoint1((double)3.05638, (double)-3.00497, (double)28.2211);
        LineSourceWidget0.SetPoint2((double)3.05638, (double)3.95916, (double)28.2211);
        LineSourceWidget0.SetResolution((int)20);

        mbds = new vtkMultiBlockDataSet();
        mbds.SetNumberOfBlocks((uint)3);
        i = 0;
        while ((i) < 3)
        {
            ExtractGrid[i].Update();
            sg[i] = vtkStructuredGrid.New();
            sg[i].ShallowCopy(ExtractGrid[i].GetOutput());
            mbds.SetBlock((uint)i, sg[i]);
            //skipping Delete sg[i]
            i = i + 1;
        }

        Stream0 = new vtkStreamTracer();
        Stream0.SetInputData((vtkDataObject)mbds);
        Stream0.SetSourceConnection(LineSourceWidget0.GetOutputPort());
        Stream0.SetIntegrationStepUnit(2);
        Stream0.SetMaximumPropagation((double)20);
        Stream0.SetInitialIntegrationStep((double)0.5);
        Stream0.SetIntegrationDirection((int)0);
        Stream0.SetIntegratorType((int)0);
        Stream0.SetMaximumNumberOfSteps((int)2000);
        Stream0.SetTerminalSpeed((double)1e-12);

        //skipping Delete mbds

        aa = new vtkAssignAttribute();
        aa.SetInputConnection((vtkAlgorithmOutput)Stream0.GetOutputPort());
        aa.Assign((string)"Normals", (string)"NORMALS", (string)"POINT_DATA");

        Ribbon0 = new vtkRibbonFilter();
        Ribbon0.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort());
        Ribbon0.SetWidth((double)0.1);
        Ribbon0.SetAngle((double)0);
        Ribbon0.SetDefaultNormal((double)0, (double)0, (double)1);
        Ribbon0.SetVaryWidth((int)0);

        LookupTable1 = new vtkLookupTable();
        LookupTable1.SetNumberOfTableValues((int)256);
        LookupTable1.SetHueRange((double)0, (double)0.66667);
        LookupTable1.SetSaturationRange((double)1, (double)1);
        LookupTable1.SetValueRange((double)1, (double)1);
        LookupTable1.SetTableRange((double)0.197813, (double)0.710419);
        LookupTable1.SetVectorComponent((int)0);
        LookupTable1.Build();

        Mapper10 = vtkPolyDataMapper.New();
        Mapper10.SetInputConnection((vtkAlgorithmOutput)Ribbon0.GetOutputPort());
        Mapper10.SetImmediateModeRendering((int)1);
        Mapper10.UseLookupTableScalarRangeOn();
        Mapper10.SetScalarVisibility((int)1);
        Mapper10.SetScalarModeToUsePointFieldData();
        Mapper10.SelectColorArray((string)"Density");
        Mapper10.SetLookupTable((vtkScalarsToColors)LookupTable1);

        Actor10 = new vtkActor();
        Actor10.SetMapper((vtkMapper)Mapper10);
        Actor10.GetProperty().SetRepresentationToSurface();
        Actor10.GetProperty().SetInterpolationToGouraud();
        Actor10.GetProperty().SetAmbient((double)0.15);
        Actor10.GetProperty().SetDiffuse((double)0.85);
        Actor10.GetProperty().SetSpecular((double)0);
        Actor10.GetProperty().SetSpecularPower((double)1);
        Actor10.GetProperty().SetSpecularColor((double)1, (double)1, (double)1);
        Ren1.AddActor((vtkProp)Actor10);

        // enable user interface interactor[]
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]
        vtkAlgorithm.SetDefaultExecutivePrototype(null);
        //skipping Delete alg

//deleteAllVTKObjects();
    }
    /// <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 SetprobeLine(vtkLineSource toSet)
 {
     probeLine = toSet;
 }
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetdisplayLine(vtkLineSource toSet)
 {
     displayLine = toSet;
 }
Example #13
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetprobeLine(vtkLineSource toSet)
 {
     probeLine = toSet;
 }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestMultiBlockStreamer(String [] argv)
    {
        //Prefix Content is: ""

          // we need to use composite data pipeline with multiblock datasets[]
          alg = new vtkAlgorithm();
          pip = new vtkCompositeDataPipeline();
          vtkAlgorithm.SetDefaultExecutivePrototype((vtkExecutive)pip);
          //skipping Delete pip
          Ren1 = vtkRenderer.New();
          Ren1.SetBackground((double)0.33,(double)0.35,(double)0.43);

          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)Ren1);

          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);

          Plot3D0 = new vtkPLOT3DReader();
          Plot3D0.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
          Plot3D0.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
          Plot3D0.SetBinaryFile((int)1);
          Plot3D0.SetMultiGrid((int)0);
          Plot3D0.SetHasByteCount((int)0);
          Plot3D0.SetIBlanking((int)0);
          Plot3D0.SetTwoDimensionalGeometry((int)0);
          Plot3D0.SetForceRead((int)0);
          Plot3D0.SetByteOrder((int)0);

          Geometry5 = new vtkStructuredGridOutlineFilter();
          Geometry5.SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort());

          Mapper5 = vtkPolyDataMapper.New();
          Mapper5.SetInputConnection((vtkAlgorithmOutput)Geometry5.GetOutputPort());
          Mapper5.SetImmediateModeRendering((int)1);
          Mapper5.UseLookupTableScalarRangeOn();
          Mapper5.SetScalarVisibility((int)0);
          Mapper5.SetScalarModeToDefault();

          Actor5 = new vtkActor();
          Actor5.SetMapper((vtkMapper)Mapper5);
          Actor5.GetProperty().SetRepresentationToSurface();
          Actor5.GetProperty().SetInterpolationToGouraud();
          Actor5.GetProperty().SetAmbient((double)0.15);
          Actor5.GetProperty().SetDiffuse((double)0.85);
          Actor5.GetProperty().SetSpecular((double)0.1);
          Actor5.GetProperty().SetSpecularPower((double)100);
          Actor5.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);

          Actor5.GetProperty().SetColor((double)1,(double)1,(double)1);
          Ren1.AddActor((vtkProp)Actor5);

          ExtractGrid[0] = new vtkExtractGrid();
          ExtractGrid[0].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort());
          ExtractGrid[0].SetVOI((int)0,(int)14,(int)0,(int)32,(int)0,(int)24);
          ExtractGrid[0].SetSampleRate((int)1,(int)1,(int)1);
          ExtractGrid[0].SetIncludeBoundary((int)0);

          ExtractGrid[1] = new vtkExtractGrid();
          ExtractGrid[1].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort());
          ExtractGrid[1].SetVOI((int)14,(int)29,(int)0,(int)32,(int)0,(int)24);
          ExtractGrid[1].SetSampleRate((int)1,(int)1,(int)1);
          ExtractGrid[1].SetIncludeBoundary((int)0);

          ExtractGrid[2] = new vtkExtractGrid();
          ExtractGrid[2].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort());
          ExtractGrid[2].SetVOI((int)29,(int)56,(int)0,(int)32,(int)0,(int)24);
          ExtractGrid[2].SetSampleRate((int)1,(int)1,(int)1);
          ExtractGrid[2].SetIncludeBoundary((int)0);

          LineSourceWidget0 = new vtkLineSource();
          LineSourceWidget0.SetPoint1((double)3.05638,(double)-3.00497,(double)28.2211);
          LineSourceWidget0.SetPoint2((double)3.05638,(double)3.95916,(double)28.2211);
          LineSourceWidget0.SetResolution((int)20);

          mbds = new vtkMultiBlockDataSet();
          mbds.SetNumberOfBlocks((uint)3);
          i = 0;
          while((i) < 3)
        {
          ExtractGrid[i].Update();
          sg[i] = vtkStructuredGrid.New();
          sg[i].ShallowCopy(ExtractGrid[i].GetOutput());
          mbds.SetBlock((uint)i, sg[i]);
          //skipping Delete sg[i]
          i = i + 1;
        }

          Stream0 = new vtkStreamTracer();
          Stream0.SetInput((vtkDataObject)mbds);
          Stream0.SetSource((vtkDataSet)LineSourceWidget0.GetOutput());
          Stream0.SetIntegrationStepUnit(2);
          Stream0.SetMaximumPropagation((double)20);
          Stream0.SetInitialIntegrationStep((double)0.5);
          Stream0.SetIntegrationDirection((int)0);
          Stream0.SetIntegratorType((int)0);
          Stream0.SetMaximumNumberOfSteps((int)2000);
          Stream0.SetTerminalSpeed((double)1e-12);

          //skipping Delete mbds

          aa = new vtkAssignAttribute();
          aa.SetInputConnection((vtkAlgorithmOutput)Stream0.GetOutputPort());
          aa.Assign((string)"Normals",(string)"NORMALS",(string)"POINT_DATA");

          Ribbon0 = new vtkRibbonFilter();
          Ribbon0.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort());
          Ribbon0.SetWidth((double)0.1);
          Ribbon0.SetAngle((double)0);
          Ribbon0.SetDefaultNormal((double)0,(double)0,(double)1);
          Ribbon0.SetVaryWidth((int)0);

          LookupTable1 = new vtkLookupTable();
          LookupTable1.SetNumberOfTableValues((int)256);
          LookupTable1.SetHueRange((double)0,(double)0.66667);
          LookupTable1.SetSaturationRange((double)1,(double)1);
          LookupTable1.SetValueRange((double)1,(double)1);
          LookupTable1.SetTableRange((double)0.197813,(double)0.710419);
          LookupTable1.SetVectorComponent((int)0);
          LookupTable1.Build();

          Mapper10 = vtkPolyDataMapper.New();
          Mapper10.SetInputConnection((vtkAlgorithmOutput)Ribbon0.GetOutputPort());
          Mapper10.SetImmediateModeRendering((int)1);
          Mapper10.UseLookupTableScalarRangeOn();
          Mapper10.SetScalarVisibility((int)1);
          Mapper10.SetScalarModeToUsePointFieldData();
          Mapper10.SelectColorArray((string)"Density");
          Mapper10.SetLookupTable((vtkScalarsToColors)LookupTable1);

          Actor10 = new vtkActor();
          Actor10.SetMapper((vtkMapper)Mapper10);
          Actor10.GetProperty().SetRepresentationToSurface();
          Actor10.GetProperty().SetInterpolationToGouraud();
          Actor10.GetProperty().SetAmbient((double)0.15);
          Actor10.GetProperty().SetDiffuse((double)0.85);
          Actor10.GetProperty().SetSpecular((double)0);
          Actor10.GetProperty().SetSpecularPower((double)1);
          Actor10.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);
          Ren1.AddActor((vtkProp)Actor10);

          // enable user interface interactor[]
          iren.Initialize();
          // prevent the tk window from showing up then start the event loop[]
          vtkAlgorithm.SetDefaultExecutivePrototype(null);
          //skipping Delete alg

        //deleteAllVTKObjects();
    }
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetLineSourceWidget0(vtkLineSource toSet)
 {
     LineSourceWidget0 = toSet;
 }
Example #16
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetdisplayLine(vtkLineSource toSet)
 {
     displayLine = toSet;
 }
Example #17
0
        private void CreateLine(cPoint3D Point1, cPoint3D Point2, Color Colour)
        {
            Position = new cPoint3D(Point1.X, Point1.Y, Point1.Z);

            Position = new cPoint3D(0, 0, 0);

            this.Colour = Colour;
            Line = vtkLineSource.New();

            this.Point1 = new cPoint3D(Point1.X, Point1.Y, Point1.Z);
            this.Point2 = new cPoint3D(Point2.X, Point2.Y, Point2.Z);

            Line.SetPoint1(Point1.X, Point1.Y, Point1.Z);
            Line.SetPoint2(Point2.X, Point2.Y, Point2.Z);

            vtk_PolyDataMapper = vtkPolyDataMapper.New();
            vtk_PolyDataMapper.SetInputConnection(Line.GetOutputPort());

            CreateVTK3DObject(0);
        }
Example #18
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();
        }
Example #19
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();
    }