/// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVPlot3DVectors(String [] argv)
    {
        //Prefix Content is: ""

        //[]
        // All Plot3D vector functions[]
        //[]
        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        renWin = vtkRenderWindow.New();
        renWin.SetMultiSamples(0);
        ren1 = vtkRenderer.New();
        ren1.SetBackground((double).8, (double).8, (double).2);
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        vectorLabels    = "Velocity Vorticity Momentum Pressure_Gradient";
        vectorFunctions = "200 201 202 210";
        camera          = new vtkCamera();
        light           = new vtkLight();
        // All text actors will share the same text prop[]
        textProp = new vtkTextProperty();
        textProp.SetFontSize((int)10);
        textProp.SetFontFamilyToArial();
        textProp.SetColor((double).3, (double)1, (double)1);
        i = 0;
        foreach (string vectorFunction in vectorFunctions.Split(new char[] { ' ' }))
        {
            pl3d[getArrayIndex(vectorFunction)] = new vtkMultiBlockPLOT3DReader();
            pl3d[getArrayIndex(vectorFunction)].SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinxyz.bin");
            pl3d[getArrayIndex(vectorFunction)].SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinq.bin");
            pl3d[getArrayIndex(vectorFunction)].SetVectorFunctionNumber((int)(int)(getArrayIndex(vectorFunction)));
            pl3d[getArrayIndex(vectorFunction)].Update();
            plane[getArrayIndex(vectorFunction)] = new vtkStructuredGridGeometryFilter();
            plane[getArrayIndex(vectorFunction)].SetInputData((vtkDataSet)pl3d[getArrayIndex(vectorFunction)].GetOutput().GetBlock(0));
            plane[getArrayIndex(vectorFunction)].SetExtent((int)25, (int)25, (int)0, (int)100, (int)0, (int)100);
            hog[getArrayIndex(vectorFunction)] = new vtkHedgeHog();
            hog[getArrayIndex(vectorFunction)].SetInputConnection((vtkAlgorithmOutput)plane[getArrayIndex(vectorFunction)].GetOutputPort());
            maxnorm = ((vtkDataSet)pl3d[getArrayIndex(vectorFunction)].GetOutput().GetBlock(0)).GetPointData().GetVectors().GetMaxNorm();
            hog[getArrayIndex(vectorFunction)].SetScaleFactor((double)1.0 / maxnorm);
            mapper[getArrayIndex(vectorFunction)] = vtkPolyDataMapper.New();
            mapper[getArrayIndex(vectorFunction)].SetInputConnection((vtkAlgorithmOutput)hog[getArrayIndex(vectorFunction)].GetOutputPort());
            actor[getArrayIndex(vectorFunction)] = new vtkActor();
            actor[getArrayIndex(vectorFunction)].SetMapper((vtkMapper)mapper[getArrayIndex(vectorFunction)]);
            ren[getArrayIndex(vectorFunction)] = vtkRenderer.New();
            ren[getArrayIndex(vectorFunction)].SetBackground((double)0.5, (double).5, (double).5);
            ren[getArrayIndex(vectorFunction)].SetActiveCamera((vtkCamera)camera);
            ren[getArrayIndex(vectorFunction)].AddLight((vtkLight)light);
            renWin.AddRenderer(ren[getArrayIndex(vectorFunction)]);
            ren[getArrayIndex(vectorFunction)].AddActor((vtkProp)actor[getArrayIndex(vectorFunction)]);
            textMapper[getArrayIndex(vectorFunction)] = new vtkTextMapper();
            textMapper[getArrayIndex(vectorFunction)].SetInput(vectorLabels.Split(new char[] { ' ' })[i]);
            textMapper[getArrayIndex(vectorFunction)].SetTextProperty((vtkTextProperty)textProp);
            text[getArrayIndex(vectorFunction)] = new vtkActor2D();
            text[getArrayIndex(vectorFunction)].SetMapper((vtkMapper2D)textMapper[getArrayIndex(vectorFunction)]);
            text[getArrayIndex(vectorFunction)].SetPosition((double)2, (double)5);

            ren[getArrayIndex(vectorFunction)].AddActor2D((vtkProp)text[getArrayIndex(vectorFunction)]);


            i = i + 1;
        }
        //[]
        // now layout renderers[]
        column = 1;
        row    = 1;
        deltaX = 1.0 / 2.0;
        deltaY = 1.0 / 2.0;
        foreach (string vectorFunction in vectorFunctions.Split(new char[] { ' ' }))
        {
            ren[getArrayIndex(vectorFunction)].SetViewport((double)(column - 1) * deltaX + (deltaX * .05), (double)(row - 1) * deltaY + (deltaY * .05), (double)column * deltaX - (deltaX * .05), (double)row * deltaY - (deltaY * .05));
            column = column + 1;
            if ((column) > 2)
            {
                column = 1;
                row    = row + 1;
            }
        }
        camera.SetViewUp((double)1, (double)0, (double)0);
        camera.SetFocalPoint((double)0, (double)0, (double)0);
        camera.SetPosition((double).4, (double)-.5, (double)-.75);
        ren[200].ResetCamera();
        camera.Dolly((double)1.25);
        ren[200].ResetCameraClippingRange();
        ren[201].ResetCameraClippingRange();
        ren[202].ResetCameraClippingRange();
        ren[210].ResetCameraClippingRange();
        light.SetPosition(camera.GetPosition()[0], camera.GetPosition()[1], camera.GetPosition()[2]);
        light.SetFocalPoint(camera.GetFocalPoint()[0], camera.GetFocalPoint()[1], camera.GetFocalPoint()[2]);
        renWin.SetSize(350, 350);
        renWin.Render();
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

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

        // Image pipeline[]
        createReader = new vtkImageReader2Factory();
        reader       = vtkImageReader2Factory.CreateImageReader2((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/beach.tif");
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/beach.tif");
        // "beach.tif" image contains ORIENTATION tag which is []
        // ORIENTATION_TOPLEFT (row 0 top, col 0 lhs) type. The TIFF []
        // reader parses this tag and sets the internal TIFF image []
        // orientation accordingly.  To overwrite this orientation with a vtk[]
        // convention of ORIENTATION_BOTLEFT (row 0 bottom, col 0 lhs ), invoke[]
        // SetOrientationType method with parameter value of 4.[]
        ((vtkTIFFReader)reader).SetOrientationType(4);
        viewer = new vtkImageViewer();
        viewer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        viewer.SetColorWindow((double)256);
        viewer.SetColorLevel((double)127.5);
        //make interface[]
        viewer.Render();
        //reader.Unregister(['UnRegister', 'viewer']) Skipped

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

        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // read data[]
        //[]
        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/office_bin.case");
        reader.Update();
        // to add coverage for vtkOnePieceExtentTranslator[]
        translator = new vtkOnePieceExtentTranslator();
        vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator);
        outline = new vtkStructuredGridOutlineFilter();
        //    outline SetInputConnection [reader GetOutputPort][]
        outline.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
        mapOutline = vtkPolyDataMapper.New();
        mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)mapOutline);
        outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        // Create source for streamtubes[]
        streamer = new vtkStreamPoints();
        //    streamer SetInputConnection [reader GetOutputPort][]
        streamer.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
        streamer.SetStartPosition((double)0.1, (double)2.1, (double)0.5);
        streamer.SetMaximumPropagationTime((double)500);
        streamer.SetTimeIncrement((double)0.5);
        streamer.SetIntegrationDirectionToForward();
        cone = new vtkConeSource();
        cone.SetResolution((int)8);
        cones = new vtkGlyph3D();
        cones.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        cones.SetSourceConnection(cone.GetOutputPort());
        cones.SetScaleFactor((double)0.9);
        cones.SetScaleModeToScaleByVector();
        mapCones = vtkPolyDataMapper.New();
        mapCones.SetInputConnection((vtkAlgorithmOutput)cones.GetOutputPort());
        //    eval mapCones SetScalarRange [[reader GetOutput] GetScalarRange][]
        mapCones.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[0],
                                (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[1]);
        conesActor = new vtkActor();
        conesActor.SetMapper((vtkMapper)mapCones);
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)conesActor);
        ren1.SetBackground((double)0.4, (double)0.4, (double)0.5);
        renWin.SetSize((int)300, (int)300);
        iren.Initialize();
        // interact with data[]
        vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);

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

        // Image pipeline[]
        image1 = new vtkTIFFReader();
        image1.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/beach.tif");
        // "beach.tif" image contains ORIENTATION tag which is []
        // ORIENTATION_TOPLEFT (row 0 top, col 0 lhs) type. The TIFF []
        // reader parses this tag and sets the internal TIFF image []
        // orientation accordingly.  To overwrite this orientation with a vtk[]
        // convention of ORIENTATION_BOTLEFT (row 0 bottom, col 0 lhs ), invoke[]
        // SetOrientationType method with parameter value of 4.[]
        image1.SetOrientationType((uint)4);
        image1.Update();
        //[]
        // If the current directory is writable, then test the witers[]
        //[]
        try
        {
            channel       = new StreamWriter("test.tmp");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        { tryCatchError = "ERROR"; }

        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            File.Delete("test.tmp");
            piw = new vtkPImageWriter();
            piw.SetInputConnection((vtkAlgorithmOutput)image1.GetOutputPort());
            piw.SetFileName((string)"piw.raw");
            piw.SetMemoryLimit((uint)1);
            piw.Write();
            File.Delete("piw.raw");
        }


        viewer = new vtkImageViewer();
        viewer.SetInputConnection((vtkAlgorithmOutput)image1.GetOutputPort());
        viewer.SetColorWindow((double)255);
        viewer.SetColorLevel((double)127.5);
        viewer.Render();

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

        // create pipeline[]
        //[]
        reader = new vtkDataSetReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
        reader.Update();
        // here to force exact extent[]
        elev = new vtkElevationFilter();
        elev.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        outline = new vtkRectilinearGridOutlineFilter();
        outline.SetInput((vtkDataObject)elev.GetRectilinearGridOutput());
        outlineMapper = vtkPolyDataMapper.New();
        outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineMapper.SetNumberOfPieces((int)2);
        outlineMapper.SetPiece((int)1);
        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.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();
    }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestUnstructuredPieces(String [] argv)
    {
        //Prefix Content is: ""

        math = new vtkMath();
        vtkMath.RandomSeed((int)22);
        pf = new vtkParallelFactory();
        vtkParallelFactory.RegisterFactory((vtkObjectFactory)pf);
        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);
        dst = new vtkDataSetTriangleFilter();
        dst.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        extract = new vtkExtractUnstructuredGridPiece();
        extract.SetInputConnection((vtkAlgorithmOutput)dst.GetOutputPort());
        cf = new vtkContourFilter();
        cf.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort());
        cf.SetValue((int)0, (double)0.24);
        pdn = new vtkPolyDataNormals();
        pdn.SetInputConnection((vtkAlgorithmOutput)cf.GetOutputPort());
        ps = new vtkPieceScalars();
        ps.SetInputConnection((vtkAlgorithmOutput)pdn.GetOutputPort());
        mapper = vtkPolyDataMapper.New();
        mapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort());
        mapper.SetNumberOfPieces((int)3);
        actor = new vtkActor();
        actor.SetMapper((vtkMapper)mapper);
        ren = vtkRenderer.New();
        ren.AddActor((vtkProp)actor);
        ren.ResetCamera();
        camera = ren.GetActiveCamera();
        //$camera SetPosition 68.1939 -23.4323 12.6465[]
        //$camera SetViewUp 0.46563 0.882375 0.0678508  []
        //$camera SetFocalPoint 3.65707 11.4552 1.83509 []
        //$camera SetClippingRange 59.2626 101.825 []
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        iren.Initialize();

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

        reader = new vtkImageReader();
        reader.ReleaseDataFlagOff();
        reader.SetDataByteOrderToLittleEndian();
        reader.SetDataExtent((int)0, (int)63, (int)0, (int)63, (int)1, (int)93);
        reader.SetFilePrefix((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/headsq/quarter");
        reader.SetDataMask((int)0x7fff);
        rangeStart = 0.0;
        rangeEnd   = 0.2;
        LUT        = new vtkLookupTable();
        LUT.SetTableRange((double)0, (double)1800);
        LUT.SetSaturationRange((double)1, (double)1);
        LUT.SetHueRange((double)rangeStart, (double)rangeEnd);
        LUT.SetValueRange((double)1, (double)1);
        LUT.SetAlphaRange((double)1, (double)1);
        LUT.Build();
        // added these unused default arguments so that the prototype[]
        // matches as required in python.[]
        //method moved
        mapToRGBA = new vtkImageMapToColors();
        mapToRGBA.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        mapToRGBA.SetOutputFormatToRGBA();
        mapToRGBA.SetLookupTable((vtkScalarsToColors)LUT);

        mapToRGBA.EndEvt += new Kitware.VTK.vtkObject.vtkObjectEventHandler(changeLUT_Command.Execute);

        streamer = new vtkMemoryLimitImageDataStreamer();
        streamer.SetInputConnection((vtkAlgorithmOutput)mapToRGBA.GetOutputPort());
        streamer.SetMemoryLimit((uint)100);
        streamer.UpdateWholeExtent();
        // set the window/level to 255.0/127.5 to view full range[]
        viewer = new vtkImageViewer();
        viewer.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        viewer.SetColorWindow((double)255.0);
        viewer.SetColorLevel((double)127.5);
        viewer.SetZSlice((int)50);
        viewer.Render();

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

        // get the interactor ui[]
        //# 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);
        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();
        range = ((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetPointData().GetScalars().GetRange();
        min   = (double)(lindex(range, 0));
        max   = (double)(lindex(range, 1));
        value = (min + max) / 2.0;

        cf = new vtkContourFilter();
        cf.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        cf.SetValue((int)0, (double)value);
        cf.UseScalarTreeOn();
        numberOfContours = 5;
        epsilon          = (double)(max - min) / (double)(numberOfContours * 10);
        min = min + epsilon;
        max = max - epsilon;
        i   = 1;
        while ((i) <= numberOfContours)
        {
            cf.SetValue((int)0, (double)min + ((i - 1) / (double)(numberOfContours - 1)) * (max - min));
            cf.Update();
            pd[i] = new vtkPolyData();
            pd[i].CopyStructure((vtkDataSet)cf.GetOutput());
            pd[i].GetPointData().DeepCopy((vtkFieldData)cf.GetOutput().GetPointData());
            mapper[i] = vtkPolyDataMapper.New();
            mapper[i].SetInputData((vtkPolyData)pd[i]);
            mapper[i].SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetPointData().GetScalars().GetRange()[0],
                                     (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetPointData().GetScalars().GetRange()[1]);
            actor[i] = new vtkActor();
            actor[i].AddPosition((double)0, (double)i * 12, (double)0);
            actor[i].SetMapper((vtkMapper)mapper[i]);
            ren1.AddActor((vtkProp)actor[i]);
            i = i + 1;
        }

        // Add the actors to the renderer, set the background and size[]
        //[]
        ren1.SetBackground((double).3, (double).3, (double).3);
        renWin.SetSize((int)450, (int)150);
        cam1 = ren1.GetActiveCamera();
        ren1.GetActiveCamera().SetPosition((double)-36.3762, (double)32.3855, (double)51.3652);
        ren1.GetActiveCamera().SetFocalPoint((double)8.255, (double)33.3861, (double)29.7687);
        ren1.GetActiveCamera().SetViewAngle((double)30);
        ren1.GetActiveCamera().SetViewUp((double)0, (double)0, (double)1);
        ren1.ResetCameraClippingRange();
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
Example #9
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestExtractCTHPart(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
        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        Ren1 = vtkRenderer.New();
        Ren1.SetBackground((double)0.33, (double)0.35, (double)0.43);
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)Ren1);
        renWin.SetSize((int)300, (int)300);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        pvTemp59 = new vtkXMLRectilinearGridReader();
        pvTemp59.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/cth.vtr");
        pvTemp59.UpdateInformation();
        pvTemp59.SetCellArrayStatus((string)"X Velocity", (int)0);
        pvTemp59.SetCellArrayStatus((string)"Y Velocity", (int)0);
        pvTemp59.SetCellArrayStatus((string)"Z Velocity", (int)0);
        pvTemp59.SetCellArrayStatus((string)"Mass for Armor Plate", (int)0);
        pvTemp59.SetCellArrayStatus((string)"Mass for Body, Nose", (int)0);
        pvTemp79 = new vtkExtractCTHPart();
        pvTemp79.SetInputConnection((vtkAlgorithmOutput)pvTemp59.GetOutputPort());
        pvTemp79.AddVolumeArrayName((string)"Volume Fraction for Armor Plate");
        pvTemp79.AddVolumeArrayName((string)"Volume Fraction for Body, Nose");
        pvTemp79.SetClipPlane(null);
        pvTemp104 = new vtkLookupTable();
        pvTemp104.SetNumberOfTableValues((int)256);
        pvTemp104.SetHueRange((double)0.6667, (double)0);
        pvTemp104.SetSaturationRange((double)1, (double)1);
        pvTemp104.SetValueRange((double)1, (double)1);
        pvTemp104.SetTableRange((double)0, (double)1);
        pvTemp104.SetVectorComponent((int)0);
        pvTemp104.Build();
        pvTemp87 = new vtkCompositePolyDataMapper();
        pvTemp87.SetInputConnection((vtkAlgorithmOutput)pvTemp79.GetOutputPort());
        pvTemp87.SetImmediateModeRendering((int)1);
        pvTemp87.SetScalarRange((double)0, (double)1);
        pvTemp87.UseLookupTableScalarRangeOn();
        pvTemp87.SetScalarVisibility((int)1);
        pvTemp87.SetScalarModeToUsePointFieldData();
        pvTemp87.SelectColorArray((string)"Part Index");
        pvTemp87.SetLookupTable((vtkScalarsToColors)pvTemp104);
        pvTemp88 = new vtkActor();
        pvTemp88.SetMapper((vtkMapper)pvTemp87);
        pvTemp88.GetProperty().SetRepresentationToSurface();
        pvTemp88.GetProperty().SetInterpolationToGouraud();
        pvTemp88.GetProperty().SetAmbient((double)0);
        pvTemp88.GetProperty().SetDiffuse((double)1);
        pvTemp88.GetProperty().SetSpecular((double)0);
        pvTemp88.GetProperty().SetSpecularPower((double)1);
        pvTemp88.GetProperty().SetSpecularColor((double)1, (double)1, (double)1);
        Ren1.AddActor((vtkProp)pvTemp88);
        renWin.Render();
        vtkAlgorithm.SetDefaultExecutivePrototype(null);

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

        // create planes[]
        // 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);
        // 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();
        plane = new vtkPlaneSource();
        plane.SetResolution((int)50, (int)50);
        transP1 = new vtkTransform();
        transP1.Translate((double)3.7, (double)0.0, (double)28.37);
        transP1.Scale((double)5, (double)5, (double)5);
        transP1.RotateY((double)90);
        tpd1 = new vtkTransformPolyDataFilter();
        tpd1.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
        tpd1.SetTransform((vtkAbstractTransform)transP1);
        outTpd1 = new vtkOutlineFilter();
        outTpd1.SetInputConnection((vtkAlgorithmOutput)tpd1.GetOutputPort());
        mapTpd1 = vtkPolyDataMapper.New();
        mapTpd1.SetInputConnection((vtkAlgorithmOutput)outTpd1.GetOutputPort());
        tpd1Actor = new vtkActor();
        tpd1Actor.SetMapper((vtkMapper)mapTpd1);
        tpd1Actor.GetProperty().SetColor((double)0, (double)0, (double)0);
        transP2 = new vtkTransform();
        transP2.Translate((double)9.2, (double)0.0, (double)31.20);
        transP2.Scale((double)5, (double)5, (double)5);
        transP2.RotateY((double)90);
        tpd2 = new vtkTransformPolyDataFilter();
        tpd2.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
        tpd2.SetTransform((vtkAbstractTransform)transP2);
        outTpd2 = new vtkOutlineFilter();
        outTpd2.SetInputConnection((vtkAlgorithmOutput)tpd2.GetOutputPort());
        mapTpd2 = vtkPolyDataMapper.New();
        mapTpd2.SetInputConnection((vtkAlgorithmOutput)outTpd2.GetOutputPort());
        tpd2Actor = new vtkActor();
        tpd2Actor.SetMapper((vtkMapper)mapTpd2);
        tpd2Actor.GetProperty().SetColor((double)0, (double)0, (double)0);
        transP3 = new vtkTransform();
        transP3.Translate((double)13.27, (double)0.0, (double)33.30);
        transP3.Scale((double)5, (double)5, (double)5);
        transP3.RotateY((double)90);
        tpd3 = new vtkTransformPolyDataFilter();
        tpd3.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
        tpd3.SetTransform((vtkAbstractTransform)transP3);
        outTpd3 = new vtkOutlineFilter();
        outTpd3.SetInputConnection((vtkAlgorithmOutput)tpd3.GetOutputPort());
        mapTpd3 = vtkPolyDataMapper.New();
        mapTpd3.SetInputConnection((vtkAlgorithmOutput)outTpd3.GetOutputPort());
        tpd3Actor = new vtkActor();
        tpd3Actor.SetMapper((vtkMapper)mapTpd3);
        tpd3Actor.GetProperty().SetColor((double)0, (double)0, (double)0);
        appendF = new vtkAppendPolyData();
        appendF.AddInputConnection(tpd1.GetOutputPort());
        appendF.AddInputConnection(tpd2.GetOutputPort());
        appendF.AddInputConnection(tpd3.GetOutputPort());
        probe = new vtkProbeFilter();
        probe.SetInputConnection((vtkAlgorithmOutput)appendF.GetOutputPort());
        probe.SetSourceData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        contour = new vtkContourFilter();
        contour.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort());
        contour.GenerateValues((int)50, (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                               (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        contourMapper = vtkPolyDataMapper.New();
        contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
        contourMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                     (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        planeActor = new vtkActor();
        planeActor.SetMapper((vtkMapper)contourMapper);
        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);
        outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)planeActor);
        ren1.AddActor((vtkProp)tpd1Actor);
        ren1.AddActor((vtkProp)tpd2Actor);
        ren1.AddActor((vtkProp)tpd3Actor);
        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)400, (int)400);
        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange((double)3.95297, (double)50);
        cam1.SetFocalPoint((double)8.88908, (double)0.595038, (double)29.3342);
        cam1.SetPosition((double)-12.3332, (double)31.7479, (double)41.2387);
        cam1.SetViewUp((double)0.060772, (double)-0.319905, (double)0.945498);
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]

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

        // Image pipeline[]
        image1 = new vtkTIFFReader();
        image1.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/beach.tif");
        // "beach.tif" image contains ORIENTATION tag which is []
        // ORIENTATION_TOPLEFT (row 0 top, col 0 lhs) type. The TIFF []
        // reader parses this tag and sets the internal TIFF image []
        // orientation accordingly.  To overwrite this orientation with a vtk[]
        // convention of ORIENTATION_BOTLEFT (row 0 bottom, col 0 lhs ), invoke[]
        // SetOrientationType method with parameter value of 4.[]
        image1.SetOrientationType((uint)4);
        image1.Update();
        sp = new vtkStructuredPoints();
        sp.SetDimensions(image1.GetOutput().GetDimensions()[0], image1.GetOutput().GetDimensions()[1], image1.GetOutput().GetDimensions()[2]);
        sp.SetExtent(
            image1.GetOutput().GetExtent()[0],
            image1.GetOutput().GetExtent()[1],
            image1.GetOutput().GetExtent()[2],
            image1.GetOutput().GetExtent()[3],
            image1.GetOutput().GetExtent()[4],
            image1.GetOutput().GetExtent()[5]);
        //sp.SetScalarType((int)image1.GetOutput().GetScalarType());
        //sp.SetNumberOfScalarComponents((int)image1.GetOutput().GetNumberOfScalarComponents());
        vtkDataObject.SetPointDataActiveScalarInfo(sp.GetInformation(), (int)image1.GetOutput().GetScalarType(), (int)image1.GetOutput().GetNumberOfScalarComponents());

        sp.GetPointData().SetScalars((vtkDataArray)image1.GetOutput().GetPointData().GetScalars());
        luminance = new vtkImageLuminance();
        luminance.SetInputData((vtkDataObject)sp);
        //[]
        // write to the temp directory if possible, otherwise use .[]
        //[]
        dir = ".";
        dir = TclToCsScriptTestDriver.GetTempDirectory();


        // make sure it is writeable first[]
        try
        {
            channel       = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        { tryCatchError = "ERROR"; }

        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            File.Delete("" + (dir.ToString()) + "/test.tmp");
            tiff1 = new vtkTIFFWriter();
            tiff1.SetInputConnection((vtkAlgorithmOutput)image1.GetOutputPort());
            tiff1.SetFileName((string)"" + (dir.ToString()) + "/tiff1.tif");
            tiff2 = new vtkTIFFWriter();
            tiff2.SetInputConnection((vtkAlgorithmOutput)luminance.GetOutputPort());
            tiff2.SetFileName((string)"" + (dir.ToString()) + "/tiff2.tif");
            bmp1 = new vtkBMPWriter();
            bmp1.SetInputConnection((vtkAlgorithmOutput)image1.GetOutputPort());
            bmp1.SetFileName((string)"" + (dir.ToString()) + "/bmp1.bmp");
            bmp2 = new vtkBMPWriter();
            bmp2.SetInputConnection((vtkAlgorithmOutput)luminance.GetOutputPort());
            bmp2.SetFileName((string)"" + (dir.ToString()) + "/bmp2.bmp");
            pnm1 = new vtkPNMWriter();
            pnm1.SetInputConnection((vtkAlgorithmOutput)image1.GetOutputPort());
            pnm1.SetFileName((string)"" + (dir.ToString()) + "/pnm1.pnm");
            pnm2 = new vtkPNMWriter();
            pnm2.SetInputConnection((vtkAlgorithmOutput)luminance.GetOutputPort());
            pnm2.SetFileName((string)"" + (dir.ToString()) + "/pnm2.pnm");
            psw1 = new vtkPostScriptWriter();
            psw1.SetInputConnection((vtkAlgorithmOutput)image1.GetOutputPort());
            psw1.SetFileName((string)"" + (dir.ToString()) + "/psw1.ps");
            psw2 = new vtkPostScriptWriter();
            psw2.SetInputConnection((vtkAlgorithmOutput)luminance.GetOutputPort());
            psw2.SetFileName((string)"" + (dir.ToString()) + "/psw2.ps");
            pngw1 = new vtkPNGWriter();
            pngw1.SetInputConnection((vtkAlgorithmOutput)image1.GetOutputPort());
            pngw1.SetFileName((string)"" + (dir.ToString()) + "/pngw1.png");
            pngw2 = new vtkPNGWriter();
            pngw2.SetInputConnection((vtkAlgorithmOutput)luminance.GetOutputPort());
            pngw2.SetFileName((string)"" + (dir.ToString()) + "/pngw2.png");
            jpgw1 = new vtkJPEGWriter();
            jpgw1.SetInputConnection((vtkAlgorithmOutput)image1.GetOutputPort());
            jpgw1.SetFileName((string)"" + (dir.ToString()) + "/jpgw1.jpg");
            jpgw2 = new vtkJPEGWriter();
            jpgw2.SetInputConnection((vtkAlgorithmOutput)luminance.GetOutputPort());
            jpgw2.SetFileName((string)"" + (dir.ToString()) + "/jpgw2.jpg");
            tiff1.Write();
            tiff2.Write();
            bmp1.Write();
            bmp2.Write();
            pnm1.Write();
            pnm2.Write();
            psw1.Write();
            psw2.Write();
            pngw1.Write();
            pngw2.Write();
            jpgw1.Write();
            jpgw2.Write();
            File.Delete("" + (dir.ToString()) + "/tiff1.tif");
            File.Delete("" + (dir.ToString()) + "/tiff2.tif");
            File.Delete("" + (dir.ToString()) + "/bmp1.bmp");
            File.Delete("" + (dir.ToString()) + "/bmp2.bmp");
            File.Delete("" + (dir.ToString()) + "/pnm1.pnm");
            File.Delete("" + (dir.ToString()) + "/pnm2.pnm");
            File.Delete("" + (dir.ToString()) + "/psw1.ps");
            File.Delete("" + (dir.ToString()) + "/psw2.ps");
            File.Delete("" + (dir.ToString()) + "/pngw1.png");
            File.Delete("" + (dir.ToString()) + "/pngw2.png");
            File.Delete("" + (dir.ToString()) + "/jpgw1.jpg");
            File.Delete("" + (dir.ToString()) + "/jpgw2.jpg");
        }


        viewer = new vtkImageViewer();
        viewer.SetInputConnection((vtkAlgorithmOutput)luminance.GetOutputPort());
        viewer.SetColorWindow((double)255);
        viewer.SetColorLevel((double)127.5);
        viewer.Render();

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

        // Read a field representing unstructured grid and display it (similar to blow.tcl)[]
        // create a reader and write out field daya[]
        reader = new vtkUnstructuredGridReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/blow.vtk");
        reader.SetScalarsName((string)"thickness9");
        reader.SetVectorsName((string)"displacement9");
        ds2do = new vtkDataSetToDataObjectFilter();
        ds2do.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        // we must be able to write here[]
        try
        {
            channel       = new StreamWriter("UGridField.vtk");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        { tryCatchError = "ERROR"; }

        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            write = new vtkDataObjectWriter();
            write.SetInputConnection((vtkAlgorithmOutput)ds2do.GetOutputPort());
            write.SetFileName((string)"UGridField.vtk");
            write.Write();
            // Read the field and convert to unstructured grid.[]
            dor = new vtkDataObjectReader();
            dor.SetFileName((string)"UGridField.vtk");
            do2ds = new vtkDataObjectToDataSetFilter();
            do2ds.SetInputConnection((vtkAlgorithmOutput)dor.GetOutputPort());
            do2ds.SetDataSetTypeToUnstructuredGrid();
            do2ds.SetPointComponent((int)0, (string)"Points", (int)0);
            do2ds.SetPointComponent((int)1, (string)"Points", (int)1);
            do2ds.SetPointComponent((int)2, (string)"Points", (int)2);
            do2ds.SetCellTypeComponent((string)"CellTypes", (int)0);
            do2ds.SetCellConnectivityComponent((string)"Cells", (int)0);
            do2ds.Update();

            fd2ad = new vtkFieldDataToAttributeDataFilter();
            fd2ad.SetInputData((vtkDataObject)do2ds.GetUnstructuredGridOutput());
            fd2ad.SetInputFieldToDataObjectField();
            fd2ad.SetOutputAttributeDataToPointData();
            fd2ad.SetVectorComponent((int)0, (string)"displacement9", (int)0);
            fd2ad.SetVectorComponent((int)1, (string)"displacement9", (int)1);
            fd2ad.SetVectorComponent((int)2, (string)"displacement9", (int)2);
            fd2ad.SetScalarComponent((int)0, (string)"thickness9", (int)0);
            fd2ad.Update();

            // Now start visualizing[]
            warp = new vtkWarpVector();
            warp.SetInputData((vtkDataObject)fd2ad.GetUnstructuredGridOutput());
            // extract mold from mesh using connectivity[]
            connect = new vtkConnectivityFilter();
            connect.SetInputConnection((vtkAlgorithmOutput)warp.GetOutputPort());
            connect.SetExtractionModeToSpecifiedRegions();
            connect.AddSpecifiedRegion((int)0);
            connect.AddSpecifiedRegion((int)1);
            moldMapper = new vtkDataSetMapper();
            moldMapper.SetInputConnection((vtkAlgorithmOutput)connect.GetOutputPort());
            moldMapper.ScalarVisibilityOff();
            moldActor = new vtkActor();
            moldActor.SetMapper((vtkMapper)moldMapper);
            moldActor.GetProperty().SetColor((double).2, (double).2, (double).2);
            moldActor.GetProperty().SetRepresentationToWireframe();
            // extract parison from mesh using connectivity[]
            connect2 = new vtkConnectivityFilter();
            connect2.SetInputConnection((vtkAlgorithmOutput)warp.GetOutputPort());
            connect2.SetExtractionModeToSpecifiedRegions();
            connect2.AddSpecifiedRegion((int)2);
            parison = new vtkGeometryFilter();
            parison.SetInputConnection((vtkAlgorithmOutput)connect2.GetOutputPort());
            normals2 = new vtkPolyDataNormals();
            normals2.SetInputConnection((vtkAlgorithmOutput)parison.GetOutputPort());
            normals2.SetFeatureAngle((double)60);
            lut = new vtkLookupTable();
            lut.SetHueRange((double)0.0, (double)0.66667);
            parisonMapper = vtkPolyDataMapper.New();
            parisonMapper.SetInputConnection((vtkAlgorithmOutput)normals2.GetOutputPort());
            parisonMapper.SetLookupTable((vtkScalarsToColors)lut);
            parisonMapper.SetScalarRange((double)0.12, (double)1.0);
            parisonActor = new vtkActor();
            parisonActor.SetMapper((vtkMapper)parisonMapper);
            cf = new vtkContourFilter();
            cf.SetInputConnection((vtkAlgorithmOutput)connect2.GetOutputPort());
            cf.SetValue((int)0, (double).5);
            contourMapper = vtkPolyDataMapper.New();
            contourMapper.SetInputConnection((vtkAlgorithmOutput)cf.GetOutputPort());
            contours = new vtkActor();
            contours.SetMapper((vtkMapper)contourMapper);
            // Create graphics stuff[]
            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)moldActor);
            ren1.AddActor((vtkProp)parisonActor);
            ren1.AddActor((vtkProp)contours);
            ren1.ResetCamera();
            ren1.GetActiveCamera().Azimuth((double)60);
            ren1.GetActiveCamera().Roll((double)-90);
            ren1.GetActiveCamera().Dolly((double)2);
            ren1.ResetCameraClippingRange();
            ren1.SetBackground((double)1, (double)1, (double)1);
            renWin.SetSize((int)375, (int)200);
            iren.Initialize();
        }


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

//deleteAllVTKObjects();
    }
Example #13
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestPolygonWriters(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);
        // read data[]
        //[]
        input = new vtkPolyDataReader();
        input.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/brainImageSmooth.vtk");
        //[]
        // generate vectors[]
        clean = new vtkCleanPolyData();
        clean.SetInputConnection((vtkAlgorithmOutput)input.GetOutputPort());
        smooth = new vtkWindowedSincPolyDataFilter();
        smooth.SetInputConnection((vtkAlgorithmOutput)clean.GetOutputPort());
        smooth.GenerateErrorVectorsOn();
        smooth.GenerateErrorScalarsOn();
        smooth.Update();
        mapper = vtkPolyDataMapper.New();
        mapper.SetInputConnection((vtkAlgorithmOutput)smooth.GetOutputPort());
        mapper.SetScalarRange((double)((vtkDataSet)smooth.GetOutput()).GetScalarRange()[0],
                              (double)((vtkDataSet)smooth.GetOutput()).GetScalarRange()[1]);
        brain = new vtkActor();
        brain.SetMapper((vtkMapper)mapper);
        // Add the actors to the renderer, set the background and size[]
        //[]
        ren1.AddActor((vtkProp)brain);
        renWin.SetSize((int)320, (int)240);
        ren1.GetActiveCamera().SetPosition((double)149.653, (double)-65.3464, (double)96.0401);
        ren1.GetActiveCamera().SetFocalPoint((double)146.003, (double)22.3839, (double)0.260541);
        ren1.GetActiveCamera().SetViewAngle((double)30);
        ren1.GetActiveCamera().SetViewUp((double)-0.255578, (double)-0.717754, (double)-0.647695);
        ren1.GetActiveCamera().SetClippingRange((double)79.2526, (double)194.052);
        iren.Initialize();
        renWin.Render();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]
        //[]
        // If the current directory is writable, then test the witers[]
        //[]
        try
        {
            channel       = new StreamWriter("test.tmp");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        { tryCatchError = "ERROR"; }

        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            File.Delete("test.tmp");
            //[]
            //[]
            // test the writers[]
            dsw = new vtkDataSetWriter();
            dsw.SetInputConnection((vtkAlgorithmOutput)smooth.GetOutputPort());
            dsw.SetFileName((string)"brain.dsw");
            dsw.Write();
            File.Delete("brain.dsw");
            pdw = new vtkPolyDataWriter();
            pdw.SetInputConnection((vtkAlgorithmOutput)smooth.GetOutputPort());
            pdw.SetFileName((string)"brain.pdw");
            pdw.Write();
            File.Delete("brain.pdw");
            iv = new vtkIVWriter();
            iv.SetInputConnection((vtkAlgorithmOutput)smooth.GetOutputPort());
            iv.SetFileName((string)"brain.iv");
            iv.Write();
            File.Delete("brain.iv");


            //[]
            // the next writers only handle triangles[]
            triangles = new vtkTriangleFilter();
            triangles.SetInputConnection((vtkAlgorithmOutput)smooth.GetOutputPort());
            iv2 = new vtkIVWriter();
            iv2.SetInputConnection((vtkAlgorithmOutput)triangles.GetOutputPort());
            iv2.SetFileName((string)"brain2.iv");
            iv2.Write();
            File.Delete("brain2.iv");


            edges = new vtkExtractEdges();
            edges.SetInputConnection((vtkAlgorithmOutput)triangles.GetOutputPort());
            iv3 = new vtkIVWriter();
            iv3.SetInputConnection((vtkAlgorithmOutput)edges.GetOutputPort());
            iv3.SetFileName((string)"brain3.iv");
            iv3.Write();
            File.Delete("brain3.iv");


            byu = new vtkBYUWriter();
            byu.SetGeometryFileName((string)"brain.g");
            byu.SetScalarFileName((string)"brain.s");
            byu.SetDisplacementFileName((string)"brain.d");
            byu.SetInputConnection((vtkAlgorithmOutput)triangles.GetOutputPort());
            byu.Write();
            File.Delete("brain.g");
            File.Delete("brain.s");
            File.Delete("brain.d");
            mcubes = new vtkMCubesWriter();
            mcubes.SetInputConnection((vtkAlgorithmOutput)triangles.GetOutputPort());
            mcubes.SetFileName((string)"brain.tri");
            mcubes.SetLimitsFileName((string)"brain.lim");
            mcubes.Write();
            File.Delete("brain.lim");
            File.Delete("brain.tri");
            stl = new vtkSTLWriter();
            stl.SetInputConnection((vtkAlgorithmOutput)triangles.GetOutputPort());
            stl.SetFileName((string)"brain.stl");
            stl.Write();
            File.Delete("brain.stl");
            stlBinary = new vtkSTLWriter();
            stlBinary.SetInputConnection((vtkAlgorithmOutput)triangles.GetOutputPort());
            stlBinary.SetFileName((string)"brainBinary.stl");
            stlBinary.SetFileType((int)2);
            stlBinary.Write();
            File.Delete("brainBinary.stl");
        }



//deleteAllVTKObjects();
    }
Example #14
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVpolyConn(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);
        // read data[]
        //[]
        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();
        // planes to connect[]
        plane1 = new vtkStructuredGridGeometryFilter();
        plane1.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        plane1.SetExtent((int)20, (int)20, (int)0, (int)100, (int)0, (int)100);
        conn = new vtkPolyDataConnectivityFilter();
        conn.SetInputConnection((vtkAlgorithmOutput)plane1.GetOutputPort());
        conn.ScalarConnectivityOn();
        conn.SetScalarRange((double)0.19, (double)0.25);
        plane1Map = vtkPolyDataMapper.New();
        plane1Map.SetInputConnection((vtkAlgorithmOutput)conn.GetOutputPort());
        plane1Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                 (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        plane1Actor = new vtkActor();
        plane1Actor.SetMapper((vtkMapper)plane1Map);
        plane1Actor.GetProperty().SetOpacity((double)0.999);
        // outline[]
        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);
        outlineProp = outlineActor.GetProperty();
        outlineProp.SetColor((double)0, (double)0, (double)0);
        // Add the actors to the renderer, set the background and size[]
        //[]
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)plane1Actor);
        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)300, (int)300);
        cam1 = new vtkCamera();
        cam1.SetClippingRange((double)14.29, (double)63.53);
        cam1.SetFocalPoint((double)8.58522, (double)1.58266, (double)30.6486);
        cam1.SetPosition((double)37.6808, (double)-20.1298, (double)35.4016);
        cam1.SetViewAngle((double)30);
        cam1.SetViewUp((double)-0.0566235, (double)0.140504, (double)0.98846);
        ren1.SetActiveCamera((vtkCamera)cam1);
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

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

        // create pipeline - structured grid[]
        //[]
        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();
        gf = new vtkDataSetSurfaceFilter();
        gf.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        gMapper = vtkPolyDataMapper.New();
        gMapper.SetInputConnection((vtkAlgorithmOutput)gf.GetOutputPort());
        gMapper.SetScalarRange(
            (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
            (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        gActor = new vtkActor();
        gActor.SetMapper((vtkMapper)gMapper);
        gf2 = new vtkDataSetSurfaceFilter();
        gf2.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        gf2.UseStripsOn();
        g2Mapper = vtkPolyDataMapper.New();
        g2Mapper.SetInputConnection((vtkAlgorithmOutput)gf2.GetOutputPort());
        g2Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        g2Actor = new vtkActor();
        g2Actor.SetMapper((vtkMapper)g2Mapper);
        g2Actor.AddPosition((double)0, (double)15, (double)0);
        // create pipeline - poly data[]
        //[]
        gf3 = new vtkDataSetSurfaceFilter();
        gf3.SetInputConnection((vtkAlgorithmOutput)gf.GetOutputPort());
        g3Mapper = vtkPolyDataMapper.New();
        g3Mapper.SetInputConnection((vtkAlgorithmOutput)gf3.GetOutputPort());
        g3Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        g3Actor = new vtkActor();
        g3Actor.SetMapper((vtkMapper)g3Mapper);
        g3Actor.AddPosition((double)0, (double)0, (double)15);
        gf4 = new vtkDataSetSurfaceFilter();
        gf4.SetInputConnection((vtkAlgorithmOutput)gf2.GetOutputPort());
        gf4.UseStripsOn();
        g4Mapper = vtkPolyDataMapper.New();
        g4Mapper.SetInputConnection((vtkAlgorithmOutput)gf4.GetOutputPort());
        g4Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        g4Actor = new vtkActor();
        g4Actor.SetMapper((vtkMapper)g4Mapper);
        g4Actor.AddPosition((double)0, (double)15, (double)15);
        // create pipeline - unstructured grid[]
        //[]
        s = new vtkSphere();
        s.SetCenter(((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetCenter()[0],
                    ((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetCenter()[1],
                    ((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetCenter()[2]);
        s.SetRadius((double)100.0);
        //everything[]
        eg = new vtkExtractGeometry();
        eg.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        eg.SetImplicitFunction((vtkImplicitFunction)s);
        gf5 = new vtkDataSetSurfaceFilter();
        gf5.SetInputConnection((vtkAlgorithmOutput)eg.GetOutputPort());
        g5Mapper = vtkPolyDataMapper.New();
        g5Mapper.SetInputConnection((vtkAlgorithmOutput)gf5.GetOutputPort());
        g5Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        g5Actor = new vtkActor();
        g5Actor.SetMapper((vtkMapper)g5Mapper);
        g5Actor.AddPosition((double)0, (double)0, (double)30);
        gf6 = new vtkDataSetSurfaceFilter();
        gf6.SetInputConnection((vtkAlgorithmOutput)eg.GetOutputPort());
        gf6.UseStripsOn();
        g6Mapper = vtkPolyDataMapper.New();
        g6Mapper.SetInputConnection((vtkAlgorithmOutput)gf6.GetOutputPort());
        g6Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        g6Actor = new vtkActor();
        g6Actor.SetMapper((vtkMapper)g6Mapper);
        g6Actor.AddPosition((double)0, (double)15, (double)30);
        // create pipeline - rectilinear grid[]
        //[]
        rgridReader = new vtkRectilinearGridReader();
        rgridReader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
        rgridReader.Update();
        gf7 = new vtkDataSetSurfaceFilter();
        gf7.SetInputConnection((vtkAlgorithmOutput)rgridReader.GetOutputPort());
        g7Mapper = vtkPolyDataMapper.New();
        g7Mapper.SetInputConnection((vtkAlgorithmOutput)gf7.GetOutputPort());
        g7Mapper.SetScalarRange((double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[0],
                                (double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[1]);
        g7Actor = new vtkActor();
        g7Actor.SetMapper((vtkMapper)g7Mapper);
        g7Actor.SetScale((double)3, (double)3, (double)3);
        gf8 = new vtkDataSetSurfaceFilter();
        gf8.SetInputConnection((vtkAlgorithmOutput)rgridReader.GetOutputPort());
        gf8.UseStripsOn();
        g8Mapper = vtkPolyDataMapper.New();
        g8Mapper.SetInputConnection((vtkAlgorithmOutput)gf8.GetOutputPort());
        g8Mapper.SetScalarRange((double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[0],
                                (double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[1]);
        g8Actor = new vtkActor();
        g8Actor.SetMapper((vtkMapper)g8Mapper);
        g8Actor.SetScale((double)3, (double)3, (double)3);
        g8Actor.AddPosition((double)0, (double)15, (double)0);
        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        ren1.AddActor((vtkProp)gActor);
        ren1.AddActor((vtkProp)g2Actor);
        ren1.AddActor((vtkProp)g3Actor);
        ren1.AddActor((vtkProp)g4Actor);
        ren1.AddActor((vtkProp)g5Actor);
        ren1.AddActor((vtkProp)g6Actor);
        ren1.AddActor((vtkProp)g7Actor);
        ren1.AddActor((vtkProp)g8Actor);
        renWin.SetSize((int)340, (int)550);
        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange((double)84, (double)174);
        cam1.SetFocalPoint((double)5.22824, (double)6.09412, (double)35.9813);
        cam1.SetPosition((double)100.052, (double)62.875, (double)102.818);
        cam1.SetViewUp((double)-0.307455, (double)-0.464269, (double)0.830617);
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
Example #16
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();
    }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestPDataSetReaderGrid(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);
        //[]
        // If the current directory is writable, then test the witers[]
        //[]
        try
        {
            channel       = new StreamWriter("test.tmp");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        {
            tryCatchError = "ERROR";
        }
        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            File.Delete("test.tmp");
            // ====== Structured Grid ======[]
            // First save out a grid in parallel form.[]
            reader = new vtkMultiBlockPLOT3DReader();
            reader.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
            reader.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
            writer = new vtkPDataSetWriter();
            writer.SetFileName((string)"comb.pvtk");
            writer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
            writer.SetNumberOfPieces((int)4);
            writer.Write();
            pReader = new vtkPDataSetReader();
            pReader.SetFileName((string)"comb.pvtk");
            surface = new vtkDataSetSurfaceFilter();
            surface.SetInputConnection((vtkAlgorithmOutput)pReader.GetOutputPort());
            mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection((vtkAlgorithmOutput)surface.GetOutputPort());
            mapper.SetNumberOfPieces((int)2);
            mapper.SetPiece((int)0);
            mapper.SetGhostLevel((int)1);
            mapper.Update();
            File.Delete("comb.pvtk");
            File.Delete("comb.0.vtk");
            File.Delete("comb.1.vtk");
            File.Delete("comb.2.vtk");
            File.Delete("comb.3.vtk");
            actor = new vtkActor();
            actor.SetMapper((vtkMapper)mapper);
            actor.SetPosition((double)-5, (double)0, (double)-29);
            // Add the actors to the renderer, set the background and size[]
            //[]
            ren1.AddActor((vtkProp)actor);
            // ====== ImageData ======[]
            // First save out a grid in parallel form.[]
            fractal = new vtkImageMandelbrotSource();
            fractal.SetWholeExtent((int)0, (int)9, (int)0, (int)9, (int)0, (int)9);
            fractal.SetSampleCX((double)0.1, (double)0.1, (double)0.1, (double)0.1);
            fractal.SetMaximumNumberOfIterations((ushort)10);
            writer2 = new vtkPDataSetWriter();
            writer.SetFileName((string)"fractal.pvtk");
            writer.SetInputConnection((vtkAlgorithmOutput)fractal.GetOutputPort());
            writer.SetNumberOfPieces((int)4);
            writer.Write();
            pReader2 = new vtkPDataSetReader();
            pReader2.SetFileName((string)"fractal.pvtk");
            iso = new vtkContourFilter();
            iso.SetInputConnection((vtkAlgorithmOutput)pReader2.GetOutputPort());
            iso.SetValue((int)0, (double)4);
            mapper2 = vtkPolyDataMapper.New();
            mapper2.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
            mapper2.SetNumberOfPieces((int)3);
            mapper2.SetPiece((int)0);
            mapper2.SetGhostLevel((int)0);
            mapper2.Update();
            File.Delete("fractal.pvtk");
            File.Delete("fractal.0.vtk");
            File.Delete("fractal.1.vtk");
            File.Delete("fractal.2.vtk");
            File.Delete("fractal.3.vtk");
            actor2 = new vtkActor();
            actor2.SetMapper((vtkMapper)mapper2);
            actor2.SetScale((double)5, (double)5, (double)5);
            actor2.SetPosition((double)6, (double)6, (double)6);
            // Add the actors to the renderer, set the background and size[]
            //[]
            ren1.AddActor((vtkProp)actor2);
            // ====== PolyData ======[]
            // First save out a grid in parallel form.[]
            sphere = new vtkSphereSource();
            sphere.SetRadius((double)2);
            writer3 = new vtkPDataSetWriter();
            writer3.SetFileName((string)"sphere.pvtk");
            writer3.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
            writer3.SetNumberOfPieces((int)4);
            writer3.Write();
            pReader3 = new vtkPDataSetReader();
            pReader3.SetFileName((string)"sphere.pvtk");
            mapper3 = vtkPolyDataMapper.New();
            mapper3.SetInputConnection((vtkAlgorithmOutput)pReader3.GetOutputPort());
            mapper3.SetNumberOfPieces((int)2);
            mapper3.SetPiece((int)0);
            mapper3.SetGhostLevel((int)1);
            mapper3.Update();
            File.Delete("sphere.pvtk");
            File.Delete("sphere.0.vtk");
            File.Delete("sphere.1.vtk");
            File.Delete("sphere.2.vtk");
            File.Delete("sphere.3.vtk");
            actor3 = new vtkActor();
            actor3.SetMapper((vtkMapper)mapper3);
            actor3.SetPosition((double)6, (double)6, (double)6);
            // Add the actors to the renderer, set the background and size[]
            //[]
            ren1.AddActor((vtkProp)actor3);
        }


        ren1.SetBackground((double)0.1, (double)0.2, (double)0.4);
        renWin.SetSize((int)300, (int)300);
        // render the image[]
        //[]
        cam1 = ren1.GetActiveCamera();
        cam1.Azimuth((double)20);
        cam1.Elevation((double)40);
        ren1.ResetCamera();
        cam1.Zoom((double)1.2);
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]

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

        // cut data[]
        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();
        range = ((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetPointData().GetScalars().GetRange();
        min   = (double)(lindex(range, 0));
        max   = (double)(lindex(range, 1));
        value = (min + max) / 2.0;
        //vtkGridSynchronizedTemplates3D cf[]
        cf = new vtkContourFilter();
        cf.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        cf.SetValue((int)0, (double)value);
        //cf ComputeNormalsOff[]
        cfMapper = vtkPolyDataMapper.New();
        cfMapper.ImmediateModeRenderingOn();
        cfMapper.SetInputConnection((vtkAlgorithmOutput)cf.GetOutputPort());
        cfMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetPointData().GetScalars().GetRange()[1]);
        cfActor = new vtkActor();
        cfActor.SetMapper((vtkMapper)cfMapper);
        //outline[]
        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);
        outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        //# 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)cfActor);
        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)400, (int)400);
        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);
        iren.Initialize();
        // render the image[]
        //[]
        // loop over surfaces[]
        i = 0;
        while ((i) < 17)
        {
            cf.SetValue((int)0, (double)min + (i / 16.0) * (max - min));
            renWin.Render();
            i = i + 1;
        }

        cf.SetValue((int)0, (double)min + (0.2) * (max - min));
        renWin.Render();
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
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();
    }
Example #20
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();
    }
    /// <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();
    }
Example #22
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVextractRectGrid(String [] argv)
    {
        //Prefix Content is: ""

        // create pipeline - rectilinear grid[]
        //[]
        rgridReader = new vtkRectilinearGridReader();
        rgridReader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
        outline = new vtkOutlineFilter();
        outline.SetInputConnection((vtkAlgorithmOutput)rgridReader.GetOutputPort());
        mapper = vtkPolyDataMapper.New();
        mapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        actor = new vtkActor();
        actor.SetMapper((vtkMapper)mapper);
        rgridReader.Update();
        extract1 = new vtkExtractRectilinearGrid();
        extract1.SetInputConnection((vtkAlgorithmOutput)rgridReader.GetOutputPort());
        //extract1 SetVOI 0 46 0 32 0 10[]
        extract1.SetVOI((int)23, (int)40, (int)16, (int)30, (int)9, (int)9);
        extract1.SetSampleRate((int)2, (int)2, (int)1);
        extract1.IncludeBoundaryOn();
        extract1.Update();
        surf1 = new vtkDataSetSurfaceFilter();
        surf1.SetInputConnection((vtkAlgorithmOutput)extract1.GetOutputPort());
        tris = new vtkTriangleFilter();
        tris.SetInputConnection((vtkAlgorithmOutput)surf1.GetOutputPort());
        mapper1 = vtkPolyDataMapper.New();
        mapper1.SetInputConnection((vtkAlgorithmOutput)tris.GetOutputPort());
        mapper1.SetScalarRange((double)((vtkDataSet)extract1.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)extract1.GetOutput()).GetScalarRange()[1]);
        actor1 = new vtkActor();
        actor1.SetMapper((vtkMapper)mapper1);
        // write out a rect grid[]
        // write to the temp directory if possible, otherwise use .[]
        dir = ".";
        dir = TclToCsScriptTestDriver.GetTempDirectory();


        // make sure the directory is writeable first[]
        try
        {
            channel       = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        { tryCatchError = "ERROR"; }

        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            File.Delete("" + (dir.ToString()) + "/test.tmp");
            rectWriter = new vtkRectilinearGridWriter();
            rectWriter.SetInputConnection((vtkAlgorithmOutput)extract1.GetOutputPort());
            rectWriter.SetFileName((string)"" + (dir.ToString()) + "/rect.tmp");
            rectWriter.Write();
            // delete the file[]
            File.Delete("" + (dir.ToString()) + "/rect.tmp");
        }


        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        //ren1 AddActor actor[]
        ren1.AddActor((vtkProp)actor1);
        renWin.SetSize((int)340, (int)400);
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
Example #23
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();
    }
Example #24
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();
    }
Example #25
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVPlot3DScalars(String[] argv)
    {
        //Prefix Content is: ""

        //[]
        // All Plot3D scalar functions[]
        //[]
        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        renWin = vtkRenderWindow.New();
        renWin.SetMultiSamples(0);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        scalarLabels    = "Density Pressure Temperature Enthalpy Internal_Energy Kinetic_Energy Velocity_Magnitude Stagnation_Energy Entropy Swirl";
        scalarFunctions = "100 110 120 130 140 144 153 163 170 184";
        camera          = new vtkCamera();
        light           = new vtkLight();
        math            = new vtkMath();
        // All text actors will share the same text prop[]
        textProp = new vtkTextProperty();
        textProp.SetFontSize((int)10);
        textProp.SetFontFamilyToArial();
        textProp.SetColor((double)0, (double)0, (double)0);
        i = 0;
        foreach (string scalarFunction in scalarFunctions.Split(new char[] { ' ' }))
        {
            pl3d[getArrayIndex(scalarFunction)] = new vtkMultiBlockPLOT3DReader();
            pl3d[getArrayIndex(scalarFunction)].SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinxyz.bin");
            pl3d[getArrayIndex(scalarFunction)].SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinq.bin");
            pl3d[getArrayIndex(scalarFunction)].SetScalarFunctionNumber((int)(int)(Int32.Parse(scalarFunction)));
            pl3d[getArrayIndex(scalarFunction)].Update();

            plane[getArrayIndex(scalarFunction)] = new vtkStructuredGridGeometryFilter();
            plane[getArrayIndex(scalarFunction)].SetInputData((vtkDataSet)pl3d[getArrayIndex(scalarFunction)].GetOutput().GetBlock(0));
            plane[getArrayIndex(scalarFunction)].SetExtent((int)25, (int)25, (int)0, (int)100, (int)0, (int)100);

            mapper[getArrayIndex(scalarFunction)] = vtkPolyDataMapper.New();
            mapper[getArrayIndex(scalarFunction)].SetInputConnection((vtkAlgorithmOutput)plane[getArrayIndex(scalarFunction)].GetOutputPort());
            mapper[getArrayIndex(scalarFunction)].SetScalarRange((double)((vtkDataSet)pl3d[getArrayIndex(scalarFunction)].GetOutput().GetBlock(0)).GetPointData().GetScalars().GetRange()[0],
                                                                 (double)((vtkDataSet)pl3d[getArrayIndex(scalarFunction)].GetOutput().GetBlock(0)).GetPointData().GetScalars().GetRange()[1]);

            actor[getArrayIndex(scalarFunction)] = new vtkActor();
            actor[getArrayIndex(scalarFunction)].SetMapper((vtkMapper)mapper[getArrayIndex(scalarFunction)]);
            ren[getArrayIndex(scalarFunction)] = vtkRenderer.New();
            ren[getArrayIndex(scalarFunction)].SetBackground((double)0, (double)0, (double).5);
            ren[getArrayIndex(scalarFunction)].SetActiveCamera((vtkCamera)camera);
            ren[getArrayIndex(scalarFunction)].AddLight((vtkLight)light);
            renWin.AddRenderer(ren[getArrayIndex(scalarFunction)]);
            ren[getArrayIndex(scalarFunction)].SetBackground((double)vtkMath.Random((double).5, (double)1), (double)vtkMath.Random((double).5, (double)1), (double)vtkMath.Random((double).5, (double)1));
            ren[getArrayIndex(scalarFunction)].AddActor((vtkProp)actor[getArrayIndex(scalarFunction)]);

            textMapper[getArrayIndex(scalarFunction)] = new vtkTextMapper();
            textMapper[getArrayIndex(scalarFunction)].SetInput(scalarLabels.Split(new char[] { ' ' })[i]);
            textMapper[getArrayIndex(scalarFunction)].SetTextProperty((vtkTextProperty)textProp);

            text[getArrayIndex(scalarFunction)] = new vtkActor2D();
            text[getArrayIndex(scalarFunction)].SetMapper((vtkMapper2D)textMapper[getArrayIndex(scalarFunction)]);
            text[getArrayIndex(scalarFunction)].SetPosition((double)2, (double)3);

            ren[getArrayIndex(scalarFunction)].AddActor2D(text[getArrayIndex(scalarFunction)]);


            i = i + 1;
        }
        //[]
        // now layout renderers[]
        column = 1;
        row    = 1;
        deltaX = 1.0 / 5.0;
        deltaY = 1.0 / 2.0;
        foreach (string scalarFunction in scalarFunctions.Split(new char[] { ' ' }))
        {
            ren[getArrayIndex(scalarFunction)].SetViewport((double)(column - 1) * deltaX, (double)(row - 1) * deltaY, (double)column * deltaX, (double)row * deltaY);
            column = column + 1;
            if ((column) > 5)
            {
                column = 1;
                row    = row + 1;
            }
        }
        camera.SetViewUp((double)0, (double)1, (double)0);
        camera.SetFocalPoint((double)0, (double)0, (double)0);
        camera.SetPosition((double)1, (double)0, (double)0);
        ren[100].ResetCamera();
        camera.Dolly((double)1.25);
        ren[100].ResetCameraClippingRange();
        ren[110].ResetCameraClippingRange();
        ren[120].ResetCameraClippingRange();
        ren[130].ResetCameraClippingRange();
        ren[140].ResetCameraClippingRange();
        ren[144].ResetCameraClippingRange();
        ren[153].ResetCameraClippingRange();
        ren[163].ResetCameraClippingRange();
        ren[170].ResetCameraClippingRange();
        ren[184].ResetCameraClippingRange();

        light.SetPosition(camera.GetPosition()[0], camera.GetPosition()[1], camera.GetPosition()[2]);
        light.SetFocalPoint(camera.GetFocalPoint()[0], camera.GetFocalPoint()[1], camera.GetFocalPoint()[2]);

        renWin.SetSize(600, 180);
        renWin.Render();
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
    /// <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();
    }
Example #27
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVfieldToPolyData(String [] argv)
    {
        //Prefix Content is: ""

        // This example demonstrates the reading of a field and conversion to PolyData[]
        // The output should be the same as polyEx.tcl.[]
        // get the interactor ui[]
        // Create a reader and write out the field[]
        reader = new vtkPolyDataReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/polyEx.vtk");
        ds2do = new vtkDataSetToDataObjectFilter();
        ds2do.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        try
        {
            channel       = new StreamWriter("PolyField.vtk");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        { tryCatchError = "ERROR"; }

        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            writer = new vtkDataObjectWriter();
            writer.SetInputConnection((vtkAlgorithmOutput)ds2do.GetOutputPort());
            writer.SetFileName((string)"PolyField.vtk");
            writer.Write();
            // create pipeline[]
            //[]
            dor = new vtkDataObjectReader();
            dor.SetFileName((string)"PolyField.vtk");
            do2ds = new vtkDataObjectToDataSetFilter();
            do2ds.SetInputConnection((vtkAlgorithmOutput)dor.GetOutputPort());
            do2ds.SetDataSetTypeToPolyData();
            do2ds.SetPointComponent((int)0, (string)"Points", (int)0);
            do2ds.SetPointComponent((int)1, (string)"Points", (int)1);
            do2ds.SetPointComponent((int)2, (string)"Points", (int)2);
            do2ds.SetPolysComponent((string)"Polys", (int)0);

            fd2ad = new vtkFieldDataToAttributeDataFilter();
            fd2ad.SetInputConnection(do2ds.GetOutputPort());
            fd2ad.SetInputFieldToDataObjectField();
            fd2ad.SetOutputAttributeDataToPointData();
            fd2ad.SetScalarComponent((int)0, (string)"my_scalars", (int)0);
            mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection(fd2ad.GetOutputPort());
            mapper.SetScalarRange((double)((vtkDataSet)fd2ad.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)fd2ad.GetOutput()).GetScalarRange()[1]);
            actor = new vtkActor();
            actor.SetMapper((vtkMapper)mapper);
            // Create the RenderWindow, Renderer and both Actors[]
            ren1   = vtkRenderer.New();
            renWin = vtkRenderWindow.New();
            renWin.AddRenderer((vtkRenderer)ren1);
            iren = new vtkRenderWindowInteractor();
            iren.SetRenderWindow((vtkRenderWindow)renWin);
            ren1.AddActor((vtkProp)actor);
            ren1.SetBackground((double)1, (double)1, (double)1);
            renWin.SetSize((int)300, (int)300);
            ren1.ResetCamera();
            cam1 = ren1.GetActiveCamera();
            cam1.SetClippingRange((double).348, (double)17.43);
            cam1.SetPosition((double)2.92, (double)2.62, (double)-0.836);
            cam1.SetViewUp((double)-0.436, (double)-0.067, (double)-0.897);
            cam1.Azimuth((double)90);
            // render the image[]
            //[]
            renWin.Render();
            File.Delete("PolyField.vtk");
        }


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

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

        // demonstrate labeling of contour with scalar value[]
        // 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);
        // Read a slice and contour it[]
        v16 = new vtkVolume16Reader();
        v16.SetDataDimensions((int)64, (int)64);
        v16.GetOutput().SetOrigin((double)0.0, (double)0.0, (double)0.0);
        v16.SetDataByteOrderToLittleEndian();
        v16.SetFilePrefix((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/headsq/quarter");
        v16.SetImageRange((int)45, (int)45);
        v16.SetDataSpacing((double)3.2, (double)3.2, (double)1.5);
        iso = new vtkContourFilter();
        iso.SetInputConnection((vtkAlgorithmOutput)v16.GetOutputPort());
        iso.GenerateValues((int)6, (double)500, (double)1150);
        iso.Update();
        numPts    = iso.GetOutput().GetNumberOfPoints();
        isoMapper = vtkPolyDataMapper.New();
        isoMapper.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
        isoMapper.ScalarVisibilityOn();
        isoMapper.SetScalarRange((double)((vtkDataSet)iso.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)iso.GetOutput()).GetScalarRange()[1]);
        isoActor = new vtkActor();
        isoActor.SetMapper((vtkMapper)isoMapper);
        // Subsample the points and label them[]
        mask = new vtkMaskPoints();
        mask.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
        mask.SetOnRatio((int)(numPts / 50));
        mask.SetMaximumNumberOfPoints((int)50);
        mask.RandomModeOn();
        // Create labels for points - only show visible points[]
        visPts = new vtkSelectVisiblePoints();
        visPts.SetInputConnection((vtkAlgorithmOutput)mask.GetOutputPort());
        visPts.SetRenderer((vtkRenderer)ren1);
        ldm = new vtkLabeledDataMapper();
        ldm.SetInputConnection((vtkAlgorithmOutput)mask.GetOutputPort());
        //    ldm SetLabelFormat "%g"[]
        ldm.SetLabelModeToLabelScalars();
        tprop = ldm.GetLabelTextProperty();
        tprop.SetFontFamilyToArial();
        tprop.SetFontSize((int)10);
        tprop.SetColor((double)1, (double)0, (double)0);
        contourLabels = new vtkActor2D();
        contourLabels.SetMapper((vtkMapper2D)ldm);
        // Add the actors to the renderer, set the background and size[]
        //[]
        ren1.AddActor2D((vtkProp)isoActor);
        ren1.AddActor2D((vtkProp)contourLabels);
        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)500, (int)500);
        renWin.Render();
        ren1.GetActiveCamera().Zoom((double)1.5);
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

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

        // This little example shows how a cursor can be created in []
        // image viewers, and renderers.  The standard TkImageViewerWidget and[]
        // TkRenderWidget bindings are used.  There is a new binding:[]
        // middle button in the image viewer sets the position of the cursor.  []
        // First we include the VTK Tcl packages which will make available []
        // all of the vtk commands to Tcl[]
        // Global values[]
        CURSOR_X    = 20;
        CURSOR_Y    = 20;
        CURSOR_Z    = 20;
        IMAGE_MAG_X = 4;
        IMAGE_MAG_Y = 4;
        IMAGE_MAG_Z = 1;
        // Pipeline stuff[]
        reader = new vtkSLCReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/neghip.slc");
        // Cursor stuff[]
        magnify = new vtkImageMagnify();
        magnify.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        magnify.SetMagnificationFactors((int)IMAGE_MAG_X, (int)IMAGE_MAG_Y, (int)IMAGE_MAG_Z);
        image_cursor = new vtkImageCursor3D();
        image_cursor.SetInputConnection((vtkAlgorithmOutput)magnify.GetOutputPort());
        image_cursor.SetCursorPosition((double)CURSOR_X * IMAGE_MAG_X, (double)CURSOR_Y * IMAGE_MAG_Y, (double)CURSOR_Z * IMAGE_MAG_Z);
        image_cursor.SetCursorValue((double)255);
        image_cursor.SetCursorRadius((int)50 * IMAGE_MAG_X);
        axes = new vtkAxes();
        axes.SymmetricOn();
        axes.SetOrigin((double)CURSOR_X, (double)CURSOR_Y, (double)CURSOR_Z);
        axes.SetScaleFactor((double)50.0);
        axes_mapper = vtkPolyDataMapper.New();
        axes_mapper.SetInputConnection((vtkAlgorithmOutput)axes.GetOutputPort());
        axesActor = new vtkActor();
        axesActor.SetMapper((vtkMapper)axes_mapper);
        axesActor.GetProperty().SetAmbient((double)0.5);
        // Image viewer stuff[]
        viewer = new vtkImageViewer();
        viewer.SetInputConnection((vtkAlgorithmOutput)image_cursor.GetOutputPort());
        viewer.SetZSlice((int)CURSOR_Z * IMAGE_MAG_Z);
        viewer.SetColorWindow((double)256);
        viewer.SetColorLevel((double)128);
        //method moved
        //method moved
        //method moved
        // Create transfer functions for opacity and color[]
        opacity_transfer_function = new vtkPiecewiseFunction();
        opacity_transfer_function.AddPoint((double)20, (double)0.0);
        opacity_transfer_function.AddPoint((double)255, (double)0.2);
        color_transfer_function = new vtkColorTransferFunction();
        color_transfer_function.AddRGBPoint((double)0, (double)0, (double)0, (double)0);
        color_transfer_function.AddRGBPoint((double)64, (double)1, (double)0, (double)0);
        color_transfer_function.AddRGBPoint((double)128, (double)0, (double)0, (double)1);
        color_transfer_function.AddRGBPoint((double)192, (double)0, (double)1, (double)0);
        color_transfer_function.AddRGBPoint((double)255, (double)0, (double).2, (double)0);
        // Create properties, mappers, volume actors, and ray cast function[]
        volume_property = new vtkVolumeProperty();
        volume_property.SetColor((vtkColorTransferFunction)color_transfer_function);
        volume_property.SetScalarOpacity((vtkPiecewiseFunction)opacity_transfer_function);
        composite_function = new vtkVolumeRayCastCompositeFunction();
        volume_mapper      = new vtkVolumeRayCastMapper();
        volume_mapper.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        volume_mapper.SetVolumeRayCastFunction((vtkVolumeRayCastFunction)composite_function);
        volume = new vtkVolume();
        volume.SetMapper((vtkAbstractVolumeMapper)volume_mapper);
        volume.SetProperty((vtkVolumeProperty)volume_property);
        // Create outline[]
        outline = new vtkOutlineFilter();
        outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        outline_mapper = vtkPolyDataMapper.New();
        outline_mapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)outline_mapper);
        outlineActor.GetProperty().SetColor((double)1, (double)1, (double)1);
        // Create the renderer[]
        ren1 = vtkRenderer.New();
        ren1.AddActor((vtkProp)axesActor);
        ren1.AddVolume((vtkProp)volume);
        ren1.SetBackground((double)0.1, (double)0.2, (double)0.4);
        renWin2 = vtkRenderWindow.New();
        renWin2.AddRenderer((vtkRenderer)ren1);
        renWin2.SetSize((int)256, (int)256);
        // Create the GUI: two renderer widgets and a quit button[]
        //tk window skipped..
        // Set the window manager (wm command) so that it registers a[]
        // command to handle the WM_DELETE_WINDOW protocal request. This[]
        // request is triggered when the widget is closed using the standard[]
        // window manager icons or buttons. In this case the exit callback[]
        // will be called and it will free up any objects we created then exit[]
        // the application.[]
        // Help label, frame and quit button[]
        //tk window skipped..
        //tk window skipped..
        //tk window skipped..

//deleteAllVTKObjects();
    }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVtextureThreshold(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);
        // read data[]
        //[]
        pl3d = new vtkMultiBlockPLOT3DReader();
        pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinxyz.bin");
        pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinq.bin");
        pl3d.SetScalarFunctionNumber((int)100);
        pl3d.SetVectorFunctionNumber((int)202);
        pl3d.Update();
        // wall[]
        //[]
        wall = new vtkStructuredGridGeometryFilter();
        wall.SetInputData(pl3d.GetOutput().GetBlock(0));
        wall.SetExtent((int)0, (int)100, (int)0, (int)0, (int)0, (int)100);
        wallMap = vtkPolyDataMapper.New();
        wallMap.SetInputConnection((vtkAlgorithmOutput)wall.GetOutputPort());
        wallMap.ScalarVisibilityOff();
        wallActor = new vtkActor();
        wallActor.SetMapper((vtkMapper)wallMap);
        wallActor.GetProperty().SetColor((double)0.8, (double)0.8, (double)0.8);
        // fin[]
        // []
        fin = new vtkStructuredGridGeometryFilter();
        fin.SetInputData(pl3d.GetOutput().GetBlock(0));
        fin.SetExtent((int)0, (int)100, (int)0, (int)100, (int)0, (int)0);
        finMap = vtkPolyDataMapper.New();
        finMap.SetInputConnection((vtkAlgorithmOutput)fin.GetOutputPort());
        finMap.ScalarVisibilityOff();
        finActor = new vtkActor();
        finActor.SetMapper((vtkMapper)finMap);
        finActor.GetProperty().SetColor((double)0.8, (double)0.8, (double)0.8);
        // planes to threshold[]
        tmap = new vtkStructuredPointsReader();
        tmap.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/texThres2.vtk");
        texture = new vtkTexture();
        texture.SetInputConnection((vtkAlgorithmOutput)tmap.GetOutputPort());
        texture.InterpolateOff();
        texture.RepeatOff();
        plane1 = new vtkStructuredGridGeometryFilter();
        plane1.SetInputData(pl3d.GetOutput().GetBlock(0));
        plane1.SetExtent((int)10, (int)10, (int)0, (int)100, (int)0, (int)100);
        thresh1 = new vtkThresholdTextureCoords();
        thresh1.SetInputConnection((vtkAlgorithmOutput)plane1.GetOutputPort());
        thresh1.ThresholdByUpper((double)1.5);
        plane1Map = new vtkDataSetMapper();
        plane1Map.SetInputConnection((vtkAlgorithmOutput)thresh1.GetOutputPort());
        plane1Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                 (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        plane1Actor = new vtkActor();
        plane1Actor.SetMapper((vtkMapper)plane1Map);
        plane1Actor.SetTexture((vtkTexture)texture);
        plane1Actor.GetProperty().SetOpacity((double)0.999);
        plane2 = new vtkStructuredGridGeometryFilter();
        plane2.SetInputData(pl3d.GetOutput().GetBlock(0));
        plane2.SetExtent((int)30, (int)30, (int)0, (int)100, (int)0, (int)100);
        thresh2 = new vtkThresholdTextureCoords();
        thresh2.SetInputConnection((vtkAlgorithmOutput)plane2.GetOutputPort());
        thresh2.ThresholdByLower((double)1.5);
        plane2Map = new vtkDataSetMapper();
        plane2Map.SetInputConnection((vtkAlgorithmOutput)thresh2.GetOutputPort());
        plane2Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                 (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        plane2Actor = new vtkActor();
        plane2Actor.SetMapper((vtkMapper)plane2Map);
        plane2Actor.SetTexture((vtkTexture)texture);
        plane2Actor.GetProperty().SetOpacity((double)0.999);
        plane3 = new vtkStructuredGridGeometryFilter();
        plane3.SetInputData(pl3d.GetOutput().GetBlock(0));
        plane3.SetExtent((int)35, (int)35, (int)0, (int)100, (int)0, (int)100);
        thresh3 = new vtkThresholdTextureCoords();
        thresh3.SetInputConnection((vtkAlgorithmOutput)plane3.GetOutputPort());
        thresh3.ThresholdBetween((double)1.5, (double)1.8);
        plane3Map = new vtkDataSetMapper();
        plane3Map.SetInputConnection((vtkAlgorithmOutput)thresh3.GetOutputPort());
        plane3Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                 (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        plane3Actor = new vtkActor();
        plane3Actor.SetMapper((vtkMapper)plane3Map);
        plane3Actor.SetTexture((vtkTexture)texture);
        plane3Actor.GetProperty().SetOpacity((double)0.999);
        // outline[]
        outline = new vtkStructuredGridOutlineFilter();
        outline.SetInputData(pl3d.GetOutput().GetBlock(0));
        outlineMapper = vtkPolyDataMapper.New();
        outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)outlineMapper);
        outlineProp = outlineActor.GetProperty();
        outlineProp.SetColor((double)0, (double)0, (double)0);
        // Add the actors to the renderer, set the background and size[]
        //[]
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)wallActor);
        ren1.AddActor((vtkProp)finActor);
        ren1.AddActor((vtkProp)plane1Actor);
        ren1.AddActor((vtkProp)plane2Actor);
        ren1.AddActor((vtkProp)plane3Actor);
        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)256, (int)256);
        cam1 = new vtkCamera();
        cam1.SetClippingRange((double)1.51176, (double)75.5879);
        cam1.SetFocalPoint((double)2.33749, (double)2.96739, (double)3.61023);
        cam1.SetPosition((double)10.8787, (double)5.27346, (double)15.8687);
        cam1.SetViewAngle((double)30);
        cam1.SetViewUp((double)-0.0610856, (double)0.987798, (double)-0.143262);
        ren1.SetActiveCamera((vtkCamera)cam1);
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }