Ejemplo n.º 1
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setrf(vtkRibbonFilter toSet)
 {
     rf = toSet;
 }
Ejemplo n.º 2
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVcombStreamers(String [] argv)
    {
        //Prefix Content is: ""

          // Create the RenderWindow, Renderer and both Actors[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          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)100);
          pl3d.SetVectorFunctionNumber((int)202);
          pl3d.Update();
          ps = new vtkPlaneSource();
          ps.SetXResolution((int)4);
          ps.SetYResolution((int)4);
          ps.SetOrigin((double)2,(double)-2,(double)26);
          ps.SetPoint1((double)2,(double)2,(double)26);
          ps.SetPoint2((double)2,(double)-2,(double)32);
          psMapper = vtkPolyDataMapper.New();
          psMapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort());
          psActor = new vtkActor();
          psActor.SetMapper((vtkMapper)psMapper);
          psActor.GetProperty().SetRepresentationToWireframe();
          rk4 = new vtkRungeKutta4();
          streamer = new vtkStreamLine();
          streamer.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
          streamer.SetSourceConnection(ps.GetOutputPort());
          streamer.SetMaximumPropagationTime((double)100);
          streamer.SetIntegrationStepLength((double).2);
          streamer.SetStepLength((double).001);
          streamer.SetNumberOfThreads((int)1);
          streamer.SetIntegrationDirectionToForward();
          streamer.VorticityOn();
          streamer.SetIntegrator((vtkInitialValueProblemSolver)rk4);
          rf = new vtkRibbonFilter();
          rf.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          rf.SetWidth((double)0.1);
          rf.SetWidthFactor((double)5);
          streamMapper = vtkPolyDataMapper.New();
          streamMapper.SetInputConnection((vtkAlgorithmOutput)rf.GetOutputPort());
          streamMapper.SetScalarRange(
          (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
          streamline = new vtkActor();
          streamline.SetMapper((vtkMapper)streamMapper);
          outline = new vtkStructuredGridOutlineFilter();
          outline.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.AddActor((vtkProp)psActor);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)streamline);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)300,(int)300);
          ren1.SetBackground((double)0.1,(double)0.2,(double)0.4);
          cam1 = ren1.GetActiveCamera();
          cam1.SetClippingRange((double)3.95297,(double)50);
          cam1.SetFocalPoint((double)9.71821,(double)0.458166,(double)29.3999);
          cam1.SetPosition((double)2.7439,(double)-37.3196,(double)38.7167);
          cam1.SetViewUp((double)-0.16123,(double)0.264271,(double)0.950876);
          // render the image[]
          //[]
          renWin.Render();
          // prevent the tk window from showing up then start the event loop[]
          // for testing[]
          threshold = 15;

        //deleteAllVTKObjects();
    }
Ejemplo n.º 3
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setrf1(vtkRibbonFilter toSet)
 {
     rf1 = toSet;
 }
Ejemplo n.º 4
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVstreamTracer(String [] argv)
    {
        //Prefix Content is: ""

          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();

          // this test has some wireframe geometry
          // Make sure multisampling is disabled to avoid generating multiple
          // regression images
          // renWin SetMultiSamples 0

          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // read data[]
          //[]
          reader = new vtkStructuredGridReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/office.binary.vtk");
          reader.Update();
          //force a read to occur[]
          outline = new vtkStructuredGridOutlineFilter();
          outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          mapOutline = vtkPolyDataMapper.New();
          mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)mapOutline);
          outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          rk = new vtkRungeKutta45();
          // Create source for streamtubes[]
          streamer = new vtkStreamTracer();
          streamer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          streamer.SetStartPosition((double)0.1,(double)2.1,(double)0.5);
          streamer.SetMaximumPropagation((double)500);
          streamer.SetIntegrationStepUnit(2);
          streamer.SetMinimumIntegrationStep((double)0.1);
          streamer.SetMaximumIntegrationStep((double)1.0);
          streamer.SetInitialIntegrationStep((double)0.2);
          streamer.SetIntegrationDirection((int)0);
          streamer.SetIntegrator((vtkInitialValueProblemSolver)rk);
          streamer.SetRotationScale((double)0.5);
          streamer.SetMaximumError((double)1.0e-8);
          aa = new vtkAssignAttribute();
          aa.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          aa.Assign((string)"Normals",(string)"NORMALS",(string)"POINT_DATA");
          rf1 = new vtkRibbonFilter();
          rf1.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort());
          rf1.SetWidth((double)0.1);
          rf1.VaryWidthOff();
          mapStream = vtkPolyDataMapper.New();
          mapStream.SetInputConnection((vtkAlgorithmOutput)rf1.GetOutputPort());
          mapStream.SetScalarRange((double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[1]);
          streamActor = new vtkActor();
          streamActor.SetMapper((vtkMapper)mapStream);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)streamActor);
          ren1.SetBackground((double)0.4,(double)0.4,(double)0.5);
          cam = ren1.GetActiveCamera();
          cam.SetPosition((double)-2.35599,(double)-3.35001,(double)4.59236);
          cam.SetFocalPoint((double)2.255,(double)2.255,(double)1.28413);
          cam.SetViewUp((double)0.311311,(double)0.279912,(double)0.908149);
          cam.SetClippingRange((double)1.12294,(double)16.6226);
          renWin.SetSize((int)300,(int)200);
          iren.Initialize();
          // interact with data[]

        //deleteAllVTKObjects();
    }
 ///<summary> A Set Method for Static Variables </summary>
 public static void SetRibbon0(vtkRibbonFilter toSet)
 {
     Ribbon0 = toSet;
 }
Ejemplo n.º 6
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVstreamTracer(String [] argv)
    {
        //Prefix Content is: ""

        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();

        // this test has some wireframe geometry
        // Make sure multisampling is disabled to avoid generating multiple
        // regression images
        // renWin SetMultiSamples 0

        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // read data[]
        //[]
        reader = new vtkStructuredGridReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/office.binary.vtk");
        reader.Update();
        //force a read to occur[]
        outline = new vtkStructuredGridOutlineFilter();
        outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        mapOutline = vtkPolyDataMapper.New();
        mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)mapOutline);
        outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        rk = new vtkRungeKutta45();
        // Create source for streamtubes[]
        streamer = new vtkStreamTracer();
        streamer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        streamer.SetStartPosition((double)0.1, (double)2.1, (double)0.5);
        streamer.SetMaximumPropagation((double)500);
        streamer.SetIntegrationStepUnit(2);
        streamer.SetMinimumIntegrationStep((double)0.1);
        streamer.SetMaximumIntegrationStep((double)1.0);
        streamer.SetInitialIntegrationStep((double)0.2);
        streamer.SetIntegrationDirection((int)0);
        streamer.SetIntegrator((vtkInitialValueProblemSolver)rk);
        streamer.SetRotationScale((double)0.5);
        streamer.SetMaximumError((double)1.0e-8);
        aa = new vtkAssignAttribute();
        aa.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        aa.Assign((string)"Normals", (string)"NORMALS", (string)"POINT_DATA");
        rf1 = new vtkRibbonFilter();
        rf1.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort());
        rf1.SetWidth((double)0.1);
        rf1.VaryWidthOff();
        mapStream = vtkPolyDataMapper.New();
        mapStream.SetInputConnection((vtkAlgorithmOutput)rf1.GetOutputPort());
        mapStream.SetScalarRange((double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[1]);
        streamActor = new vtkActor();
        streamActor.SetMapper((vtkMapper)mapStream);
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)streamActor);
        ren1.SetBackground((double)0.4, (double)0.4, (double)0.5);
        cam = ren1.GetActiveCamera();
        cam.SetPosition((double)-2.35599, (double)-3.35001, (double)4.59236);
        cam.SetFocalPoint((double)2.255, (double)2.255, (double)1.28413);
        cam.SetViewUp((double)0.311311, (double)0.279912, (double)0.908149);
        cam.SetClippingRange((double)1.12294, (double)16.6226);
        renWin.SetSize((int)300, (int)200);
        iren.Initialize();
        // interact with data[]

//deleteAllVTKObjects();
    }
    /// <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 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 SetRibbon0(vtkRibbonFilter toSet)
 {
     Ribbon0 = toSet;
 }
    /// <summary>
    /// Entry Point
    /// </summary>
    /// <param name="argv"></param>
    public static void Main(String[] argv)
    {
        // This example demonstrates how to use the vtkLineWidget to seed
        // and manipulate streamlines. Two line widgets are created. One is
        // invoked by pressing 'W', the other by pressing 'L'. Both can exist
        // together.
        // Start by loading some data.
        pl3d = vtkMultiBlockPLOT3DReader.New();
        pl3d.SetXYZFileName("../../../combxyz.bin");
        pl3d.SetQFileName("../../../combq.bin");
        pl3d.SetScalarFunctionNumber(100);
        pl3d.SetVectorFunctionNumber(202);
        pl3d.Update();
        // The line widget is used seed the streamlines.
        lineWidget = vtkLineWidget.New();
        seeds = vtkPolyData.New();

        lineWidget.SetInput(pl3d.GetOutput());
        lineWidget.SetAlignToYAxis();
        lineWidget.PlaceWidget();
        lineWidget.GetPolyData(seeds);
        lineWidget.ClampToBoundsOn();

        rk4 = vtkRungeKutta4.New();
        streamer = vtkStreamLine.New();
        streamer.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        streamer.SetSource(seeds);
        streamer.SetMaximumPropagationTime(100);
        streamer.SetIntegrationStepLength(.2);
        streamer.SetStepLength(.001);
        streamer.SetNumberOfThreads(1);
        streamer.SetIntegrationDirectionToForward();
        streamer.VorticityOn();
        streamer.SetIntegrator(rk4);

        rf = vtkRibbonFilter.New();
        rf.SetInputConnection(streamer.GetOutputPort());
        rf.SetWidth(0.1);
        rf.SetWidthFactor(5);

        streamMapper = vtkPolyDataMapper.New();
        streamMapper.SetInputConnection(rf.GetOutputPort());
        streamMapper.SetScalarRange(pl3d.GetOutput().GetScalarRange()[0], pl3d.GetOutput().GetScalarRange()[1]);
        streamline = vtkActor.New();
        streamline.SetMapper(streamMapper);
        streamline.VisibilityOff();

        // The second line widget is used seed more streamlines.
        lineWidget2 = vtkLineWidget.New();
        seeds2 = vtkPolyData.New();
        lineWidget2.SetInput(pl3d.GetOutput());
        lineWidget2.PlaceWidget();
        lineWidget2.GetPolyData(seeds2);
        lineWidget2.SetKeyPressActivationValue((sbyte)108);

        streamer2 = vtkStreamLine.New();
        streamer2.SetInputDaat((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        streamer2.SetSource(seeds2);
        streamer2.SetMaximumPropagationTime(100);
        streamer2.SetIntegrationStepLength(.2);
        streamer2.SetStepLength(.001);
        streamer2.SetNumberOfThreads(1);
        streamer2.SetIntegrationDirectionToForward();
        streamer2.VorticityOn();
        streamer2.SetIntegrator(rk4);

        rf2 = vtkRibbonFilter.New();
        rf2.SetInputConnection(streamer2.GetOutputPort());
        rf2.SetWidth(0.1);
        rf2.SetWidthFactor(5);

        streamMapper2 = vtkPolyDataMapper.New();
        streamMapper2.SetInputConnection(rf2.GetOutputPort());
        streamMapper2.SetScalarRange(pl3d.GetOutput().GetScalarRange()[0], pl3d.GetOutput().GetScalarRange()[1]);

        streamline2 = vtkActor.New();
        streamline2.SetMapper(streamMapper2);
        streamline2.VisibilityOff();

        outline = vtkStructuredGridOutlineFilter.New();
        outline.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));

        outlineMapper = vtkPolyDataMapper.New();
        outlineMapper.SetInputConnection(outline.GetOutputPort());
        outlineActor = vtkActor.New();
        outlineActor.SetMapper(outlineMapper);

        // Create the RenderWindow, Renderer and both Actors
        ren1 = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer(ren1);
        iren = vtkRenderWindowInteractor.New();
        iren.SetRenderWindow(renWin);

        // Associate the line widget with the interactor
        lineWidget.SetInteractor(iren);
        lineWidget.StartInteractionEvt += new vtkObject.vtkObjectEventHandler(BeginInteraction);
        lineWidget.InteractionEvt += new vtkObject.vtkObjectEventHandler(GenerateStreamlines);
        lineWidget2.SetInteractor(iren);
        lineWidget2.StartInteractionEvt += new vtkObject.vtkObjectEventHandler(BeginInteraction2);
        lineWidget2.EndInteractionEvt += new vtkObject.vtkObjectEventHandler(GenerateStreamlines2);

        // Add the actors to the renderer, set the background and size
        ren1.AddActor(outlineActor);
        ren1.AddActor(streamline);
        ren1.AddActor(streamline2);

        ren1.SetBackground(1, 1, 1);
        renWin.SetSize(300, 300);
        ren1.SetBackground(0.1, 0.2, 0.4);

        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange(3.95297, 50);
        cam1.SetFocalPoint(9.71821, 0.458166, 29.3999);
        cam1.SetPosition(2.7439, -37.3196, 38.7167);
        cam1.SetViewUp(-0.16123, 0.264271, 0.950876);

        // render the image
        renWin.Render();
        lineWidget2.On();
        iren.Initialize();
        iren.Start();

        //Clean Up
        deleteAllVTKObjects();
    }
Ejemplo n.º 11
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestSplineFilter(String [] argv)
    {
        //Prefix Content is: ""

        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        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)100);
        pl3d.SetVectorFunctionNumber((int)202);
        pl3d.Update();
        ps = new vtkPlaneSource();
        ps.SetXResolution((int)4);
        ps.SetYResolution((int)4);
        ps.SetOrigin((double)2, (double)-2, (double)26);
        ps.SetPoint1((double)2, (double)2, (double)26);
        ps.SetPoint2((double)2, (double)-2, (double)32);
        psMapper = vtkPolyDataMapper.New();
        psMapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort());
        psActor = new vtkActor();
        psActor.SetMapper((vtkMapper)psMapper);
        psActor.GetProperty().SetRepresentationToWireframe();
        rk4      = new vtkRungeKutta4();
        streamer = new vtkStreamLine();
        streamer.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        streamer.SetSourceConnection(ps.GetOutputPort());
        streamer.SetMaximumPropagationTime((double)100);
        streamer.SetIntegrationStepLength((double).2);
        streamer.SetStepLength((double).001);
        streamer.SetNumberOfThreads((int)1);
        streamer.SetIntegrationDirectionToForward();
        streamer.VorticityOn();
        streamer.SetIntegrator((vtkInitialValueProblemSolver)rk4);
        sf = new vtkSplineFilter();
        sf.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        sf.SetSubdivideToLength();
        sf.SetLength((double)0.15);
        rf = new vtkRibbonFilter();
        rf.SetInputConnection((vtkAlgorithmOutput)sf.GetOutputPort());
        rf.SetWidth((double)0.1);
        rf.SetWidthFactor((double)5);
        streamMapper = vtkPolyDataMapper.New();
        streamMapper.SetInputConnection((vtkAlgorithmOutput)rf.GetOutputPort());
        streamMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                    (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        streamline = new vtkActor();
        streamline.SetMapper((vtkMapper)streamMapper);
        outline = new vtkStructuredGridOutlineFilter();
        outline.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        outlineMapper = vtkPolyDataMapper.New();
        outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)outlineMapper);
        // Add the actors to the renderer, set the background and size[]
        //[]
        ren1.AddActor((vtkProp)psActor);
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)streamline);
        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)300, (int)300);
        ren1.SetBackground((double)0.1, (double)0.2, (double)0.4);
        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange((double)3.95297, (double)50);
        cam1.SetFocalPoint((double)9.71821, (double)0.458166, (double)29.3999);
        cam1.SetPosition((double)2.7439, (double)-37.3196, (double)38.7167);
        cam1.SetViewUp((double)-0.16123, (double)0.264271, (double)0.950876);
        // render the image[]
        //[]
        renWin.Render();
        // prevent the tk window from showing up then start the event loop[]
        // for testing[]
        threshold = 15;

//deleteAllVTKObjects();
    }