コード例 #1
0
ファイル: Form1.cs プロジェクト: yanfeng1022/activizLearn
        private void DrawTexturePlane()
        {
            //load in the texture map
            vtkBMPReader bmpReader = vtkBMPReader.New();

            bmpReader.SetFileName(@"..\..\Data\masonry.bmp");
            vtkTexture atext = vtkTexture.New();

            atext.SetInputConnection(bmpReader.GetOutputPort());
            atext.InterpolateOn();

            //create a plane source and actor
            vtkPlaneSource plane = vtkPlaneSource.New();

            plane.SetPoint1(0, 0, 0);
            vtkPolyDataMapper planeMapper = vtkPolyDataMapper.New();

            planeMapper.SetInputConnection(plane.GetOutputPort());
            vtkActor planeActor = vtkActor.New();

            planeActor.SetMapper(planeMapper);
            planeActor.SetTexture(atext);

            vtkRenderer     renderer = vtkRenderer.New();
            vtkRenderWindow renWin   = myRenderWindowControl.RenderWindow;

            renWin.AddRenderer(renderer);
            renderer.AddActor(planeActor);
        }
コード例 #2
0
        public void ReadImageIntoObject(RenderWindowControl renderWindowControl, nvmImageModel camera)
        {
            vtkRenderWindow renderWindow = renderWindowControl.RenderWindow;
            vtkRenderer     renderer     = renderWindow.GetRenderers().GetFirstRenderer();

            string        filePath = Path.Combine(tempDirectory, $"{camera.fileName}");
            vtkJPEGReader reader   = vtkJPEGReader.New();

            reader.SetFileName(filePath);
            reader.Update();

            // Treba poriesit ako nasmerovat obrazky bez pokazenia textury
            var vectoris = Vector3.Transform(new Vector3(0, 0, 1), camera.quaternion);

            vtkPlaneSource planeSource = vtkPlaneSource.New();
            vtkTexture     texture     = new vtkTexture();

            texture.SetInputConnection(reader.GetOutputPort());
            vtkTransform transform = new vtkTransform();

            transform.RotateX(180);
            texture.SetTransform(transform);

            vtkTextureMapToPlane plane = new vtkTextureMapToPlane();

            plane.SetInputConnection(planeSource.GetOutputPort());
            planeSource.SetCenter(camera.cameraCenter.X, camera.cameraCenter.Y, camera.cameraCenter.Z);

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

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

            actor.SetMapper(mapper);
            actor.SetTexture(texture);

            renderer.SetBackground(0.2, 0.3, 0.4);
            renderer.AddActor(actor);
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: gbull122/VtkTest
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            vtkPoints points = vtkPoints.New();

            int GridSize = 10;

            for (int x = 0; x < GridSize; x++)
            {
                for (int y = 0; y < GridSize; y++)
                {
                    points.InsertNextPoint(x, y, (x + y) / (y + 1));
                }
            }

            // Add the grid points to a polydata object
            vtkPolyData polydata = vtkPolyData.New();

            polydata.SetPoints(points);

            // Triangulate the grid points
            vtkDelaunay2D delaunay = vtkDelaunay2D.New();

            delaunay.SetInput(polydata);
            delaunay.Update();

            vtkPlaneSource plane = vtkPlaneSource.New();

            //Read the image data from a file
            vtkJPEGReader reader = vtkJPEGReader.New();

            reader.SetFileName("C:\\Users\\georg\\Desktop\\texture.jpg");

            //Create texture object
            vtkTexture texture = vtkTexture.New();

            texture.SetInputConnection(reader.GetOutputPort());

            //Map texture coordinates
            vtkTextureMapToPlane map_to_plane = vtkTextureMapToPlane.New();

            map_to_plane.SetInputConnection(plane.GetOutputPort());
            map_to_plane.SetInputConnection(delaunay.GetOutputPort());

            //Create mapper and set the mapped texture as input
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(map_to_plane.GetOutputPort());

            //Create actor and set the mapper and the texture
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.SetTexture(texture);

            vtkRenderer renderer = vtkRenderer.New();

            renderer.AddActor(actor);


            RenderControl1.RenderWindow.AddRenderer(renderer);
        }
コード例 #4
0
        //切片模式_绘制
        private void DrawMode_Slice()
        {
            int[]    xyz = m_ImageData.GetDimensions();
            double[] sp  = m_ImageData.GetSpacing();

            double[] pos = new double[] { m_XPos, m_YPos, m_ZPos };

            #region -------------------XOY切片(垂直Z轴)-------------------

            m_ImageResliceXOY = vtkImageReslice.New();
            m_ImageResliceXOY.SetInput(m_ImageData);
            m_ImageResliceXOY.SetResliceAxesDirectionCosines(
                1, 0, 0,
                0, 1, 0,
                0, 0, 1
                );
            m_ImageResliceXOY.InterpolateOn();
            m_ImageResliceXOY.SetInterpolationModeToNearestNeighbor();
            m_ImageResliceXOY.SetResliceAxesOrigin(pos[0], pos[1], pos[2]);
            m_ImageResliceXOY.SetOutputDimensionality(2);
            m_ImageResliceXOY.Update();

            m_TextureXOY = vtkTexture.New();
            m_TextureXOY.InterpolateOff();
            m_TextureXOY.SetInput(m_ImageResliceXOY.GetOutput());
            m_TextureXOY.SetLookupTable(m_LookupTable);
            m_TextureXOY.MapColorScalarsThroughLookupTableOn();

            //---------------------set plane position----------
            m_PlaneSourceXOY = vtkPlaneSource.New();
            m_PlaneSourceXOY.SetXResolution(xyz[0]);
            m_PlaneSourceXOY.SetYResolution(xyz[1]);
            m_PlaneSourceXOY.SetOrigin(0, 0, 0);
            m_PlaneSourceXOY.SetPoint1((xyz[0] - 1) * sp[0], 0, 0);
            m_PlaneSourceXOY.SetPoint2(0, (xyz[1] - 1) * sp[1], 0);
            m_PlaneSourceXOY.Push(pos[2]);

            //---------------------pipeline--------------------
            m_PlaneMapperXOY = vtkPolyDataMapper.New();
            m_PlaneMapperXOY.SetInput(m_PlaneSourceXOY.GetOutput());

            m_ActorXOY = vtkActor.New();
            m_ActorXOY.SetMapper(m_PlaneMapperXOY);
            m_ActorXOY.SetTexture(m_TextureXOY);

            #endregion

            #region -------------------XOZ切片(垂直Y轴)-------------------

            m_ImageResliceXOZ = vtkImageReslice.New();
            m_ImageResliceXOZ.SetInput(m_ImageData);
            m_ImageResliceXOZ.SetResliceAxesDirectionCosines(
                1, 0, 0,
                0, 0, -1,
                0, 1, 0
                );
            m_ImageResliceXOZ.InterpolateOn();
            m_ImageResliceXOZ.SetInterpolationModeToNearestNeighbor();
            m_ImageResliceXOZ.SetResliceAxesOrigin(pos[0], pos[1], pos[2]);
            m_ImageResliceXOZ.SetOutputDimensionality(2);
            m_ImageResliceXOZ.Update();

            m_TextureXOZ = vtkTexture.New();
            m_TextureXOZ.SetInput(m_ImageResliceXOZ.GetOutput());
            m_TextureXOZ.SetLookupTable(m_LookupTable);
            m_TextureXOZ.MapColorScalarsThroughLookupTableOn();

            //---------------------set plane position--------------------
            m_PlaneSourceXOZ = vtkPlaneSource.New();
            m_PlaneSourceXOZ.SetXResolution(xyz[0]);
            m_PlaneSourceXOZ.SetYResolution(xyz[2]);
            m_PlaneSourceXOZ.SetOrigin(0, 0, (xyz[2] - 1) * sp[2]);
            m_PlaneSourceXOZ.SetPoint1((xyz[0] - 1) * sp[0], 0, (xyz[2] - 1) * sp[2]);
            m_PlaneSourceXOZ.SetPoint2(0, 0, 0);
            m_PlaneSourceXOZ.Push(pos[1]);

            //---------------------pipeline------------------------------
            m_PlaneMapperXOZ = vtkPolyDataMapper.New();
            m_PlaneMapperXOZ.SetInput(m_PlaneSourceXOZ.GetOutput());

            m_ActorXOZ = vtkActor.New();
            m_ActorXOZ.SetMapper(m_PlaneMapperXOZ);
            m_ActorXOZ.SetTexture(m_TextureXOZ);

            #endregion

            #region -------------------YOZ切片(垂直X轴)-------------------

            m_ImageResliceYOZ = vtkImageReslice.New();
            m_ImageResliceYOZ.SetInput(m_ImageData);
            m_ImageResliceYOZ.SetResliceAxesDirectionCosines(
                0, 0, -1,
                0, 1, 0,
                1, 0, 0
                );
            m_ImageResliceYOZ.InterpolateOn();
            m_ImageResliceYOZ.SetInterpolationModeToNearestNeighbor();
            m_ImageResliceYOZ.SetResliceAxesOrigin(pos[0], pos[1], pos[2]);
            m_ImageResliceYOZ.SetOutputDimensionality(2);
            m_ImageResliceYOZ.Update();

            m_TextureYOZ = vtkTexture.New();
            m_TextureYOZ.SetInput(m_ImageResliceYOZ.GetOutput());
            m_TextureYOZ.SetLookupTable(m_LookupTable);
            m_TextureYOZ.MapColorScalarsThroughLookupTableOn();

            //---------------------set plane position--------------------
            m_PlaneSourceYOZ = vtkPlaneSource.New();
            m_PlaneSourceYOZ.SetXResolution(xyz[2]);
            m_PlaneSourceYOZ.SetYResolution(xyz[1]);
            m_PlaneSourceYOZ.SetOrigin(0, 0, (xyz[2] - 1) * sp[2]);
            m_PlaneSourceYOZ.SetPoint1(0, 0, 0);
            m_PlaneSourceYOZ.SetPoint2(0, (xyz[1] - 1) * sp[1], (xyz[2] - 1) * sp[2]);
            m_PlaneSourceYOZ.Push(pos[0]);

            //---------------------pipeline------------------------------
            m_PlaneMapperYOZ = vtkPolyDataMapper.New();
            m_PlaneMapperYOZ.SetInput(m_PlaneSourceYOZ.GetOutput());

            m_ActorYOZ = vtkActor.New();
            m_ActorYOZ.SetMapper(m_PlaneMapperYOZ);
            m_ActorYOZ.SetTexture(m_TextureYOZ);

            #endregion

            m_Renderer.AddActor(m_ActorXOY);
            m_Renderer.AddActor(m_ActorXOZ);
            m_Renderer.AddActor(m_ActorYOZ);
        }
コード例 #5
0
    /// <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();
    }
コード例 #6
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Settexture(vtkTexture toSet)
 {
     texture = toSet;
 }
コード例 #7
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Settexture(vtkTexture toSet)
 {
     texture = toSet;
 }
コード例 #8
0
    /// <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();
    }
コード例 #9
0
ファイル: Form1.cs プロジェクト: yanfeng1022/activizLearn
        private void DrawTest()
        {
            vtkProp3D      prop3D;
            vtkActor       actor       = vtkActor.New();
            vtkActor2D     actor2D     = vtkActor2D.New();
            vtkLODActor    lODActor    = vtkLODActor.New();
            vtkLODProp3D   lodProp3d   = vtkLODProp3D.New();
            vtkCamera      camera      = vtkCamera.New();
            vtkCameraActor cameraActor = vtkCameraActor.New();
            vtkLight       light       = vtkLight.New();
            vtkLightActor  lightActor  = vtkLightActor.New();
            vtkPicker      picker      = vtkPicker.New();
            vtkPointPicker pointPicker = vtkPointPicker.New();
            vtkCellPicker  cellPicker  = vtkCellPicker.New();
            vtkAreaPicker  areaPicker  = vtkAreaPicker.New();

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

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

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

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

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

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


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

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

            vtkStructuredGridReader structuredGridReader = vtkStructuredGridReader.New();
            vtkRungeKutta4          integ                      = vtkRungeKutta4.New();
            vtkStreamTracer         streamer                   = vtkStreamTracer.New();
            vtkTubeFilter           streamTube                 = vtkTubeFilter.New();
            vtkRuledSurfaceFilter   ruledSurfaceFilter         = vtkRuledSurfaceFilter.New();
            vtkPlane                   plane                   = vtkPlane.New();
            vtkCutter                  cutter                  = new vtkCutter();
            vtkMergeFilter             mergeFilter             = vtkMergeFilter.New();
            vtkImageLuminance          imageLuminance          = vtkImageLuminance.New();
            vtkImageDataGeometryFilter imageDataGeometryFilter = vtkImageDataGeometryFilter.New();
            vtkWarpScalar              warpScalar              = vtkWarpScalar.New();
            vtkWarpVector              warpVector              = vtkWarpVector.New();
        }