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); }
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); }
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); }
//切片模式_绘制 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); }
/// <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(); }
/// <summary> /// Changes the actors to whatever the /// animal currently loaded is /// </summary> public void updateAnimal() { //----Go through the pipeline for the animal body //Convert the polydata to triangles (in the default files they are rectangles) triangleAnimal.SetInputConnection(animalData); if (this.checkBox1.Checked) { //smooth the polydata cleanAnimal.SetInputConnection(triangleAnimal.GetOutputPort()); smoothAnimal.SetInputConnection(cleanAnimal.GetOutputPort()); normalsAnimal.SetInputConnection(smoothAnimal.GetOutputPort()); //connect the smoothed data to a mapper animalMapper.SetInputConnection(normalsAnimal.GetOutputPort()); //decimate the smoothed polydata decimateAnimal.SetInputConnection(normalsAnimal.GetOutputPort()); } else { //connect the triangle polydata to a mapper before decimation animalMapper.SetInputConnection(triangleAnimal.GetOutputPort()); //decimate the triangled data decimateAnimal.SetInputConnection(triangleAnimal.GetOutputPort()); } double targetreduc = 0.5; if (double.TryParse(toolStripTextBox1.Text, out targetreduc)) { decimateAnimal.SetTargetReduction(targetreduc); } decimateAnimal.SetPreserveTopology(0); //connect the decimated polydata a mapper deciAnimalMapper.SetInputConnection(decimateAnimal.GetOutputPort()); //----Go through the pipeline for the first eye //Convert the polydata to triangles (in the default files they are rectangles) triangles.SetInputConnection(eyeData1); if (this.checkBox1.Checked) { //smooth the polydata clean.SetInputConnection(triangles.GetOutputPort()); smooth.SetInputConnection(clean.GetOutputPort()); normals.SetInputConnection(smooth.GetOutputPort()); //connect the smoothed data to a mapper sphereTexture.SetInputConnection(normals.GetOutputPort()); //decimate the smoothed polydata eyeMapper1.SetInputConnection(sphereTexture.GetOutputPort()); } else { sphereTexture.SetInputConnection(triangles.GetOutputPort()); //connect the triangle polydata to a mapper before decimation eyeMapper1.SetInputConnection(sphereTexture.GetOutputPort()); } decimate.SetInputConnection(sphereTexture.GetOutputPort()); if (double.TryParse(toolStripTextBox1.Text, out targetreduc)) { decimate.SetTargetReduction(targetreduc); } decimate.SetPreserveTopology(0); //connect the decimated polydata a mapper deciEyeMapper1.SetInputConnection(decimate.GetOutputPort()); //----Go through the pipeline for the second eye //Convert the polydata to triangles (in the default files they are rectangles) triangles.SetInputConnection(eyeData1); if (this.checkBox1.Checked) { //smooth the polydata clean.SetInputConnection(triangles.GetOutputPort()); smooth.SetInputConnection(clean.GetOutputPort()); normals.SetInputConnection(smooth.GetOutputPort()); //connect the smoothed data to a mapper sphereTexture.SetInputConnection(normals.GetOutputPort()); //decimate the smoothed polydata eyeMapper2.SetInputConnection(sphereTexture.GetOutputPort()); } else { sphereTexture.SetInputConnection(triangles.GetOutputPort()); //connect the triangle polydata to a mapper before decimation eyeMapper2.SetInputConnection(sphereTexture.GetOutputPort()); } decimate.SetInputConnection(sphereTexture.GetOutputPort()); if (double.TryParse(toolStripTextBox1.Text, out targetreduc)) { decimate.SetTargetReduction(targetreduc); } decimate.SetPreserveTopology(0); //connect the decimated polydata a mapper deciEyeMapper2.SetInputConnection(decimate.GetOutputPort()); //----Set the textures and position of the decimated model deciAnimalActor.SetMapper(deciAnimalMapper); if (this.checkBox2.Checked) { deciAnimalActor.SetTexture(deciAnimalColorTexture); } else { deciAnimalActor.SetTexture(null); } deciEyeActor1.SetMapper(deciEyeMapper1); if (this.checkBox2.Checked) { deciEyeActor1.SetTexture(eyeColorTexture1); deciEyeActor1.SetTexture(deciEyeColorTexture1); } else { deciEyeActor1.SetTexture(null); } deciEyeActor1.SetPosition(eyeX, eyeY, eyeZ); deciEyeActor2.SetMapper(deciEyeMapper2); if (this.checkBox2.Checked) { deciEyeActor2.SetTexture(eyeColorTexture2); deciEyeActor2.SetTexture(deciEyeColorTexture2); } else { deciEyeActor2.SetTexture(null); } deciEyeActor2.SetPosition(-eyeX, eyeY, eyeZ); //----Set the text to the decimated poly count //Update the mappers to get the number of polygons deciAnimalMapper.Update(); deciEyeMapper1.Update(); deciEyeMapper2.Update(); textAfter.SetInput(((((vtkPolyData)deciAnimalMapper.GetInput()).GetNumberOfPolys() + ((vtkPolyData)deciEyeMapper1.GetInput()).GetNumberOfPolys() + ((vtkPolyData)deciEyeMapper2.GetInput()).GetNumberOfPolys())).ToString() + " Polygons"); textAfter.SetDisplayPosition(10, 10); //----Set the textures and position of the decimated model animalActor.SetMapper(animalMapper); if (this.checkBox2.Checked) { animalActor.SetTexture(animalColorTexture); } else { animalActor.SetTexture(null); } eyeActor1.SetMapper(eyeMapper1); if (this.checkBox2.Checked) { eyeActor1.SetTexture(eyeColorTexture1); } else { eyeActor1.SetTexture(null); } eyeActor1.SetPosition(eyeX, eyeY, eyeZ); eyeActor2.SetMapper(eyeMapper2); if (this.checkBox2.Checked) { eyeActor2.SetTexture(eyeColorTexture2); } else { eyeActor2.SetTexture(null); } eyeActor2.SetPosition(-eyeX, eyeY, eyeZ); //Update the pipeline to get the number of polygons animalMapper.Update(); eyeMapper1.Update(); eyeMapper2.Update(); //----Set the text to the full poly count textBefore.SetInput((((vtkPolyData)animalMapper.GetInput()).GetNumberOfPolys() + ((vtkPolyData)eyeMapper1.GetInput()).GetNumberOfPolys() + ((vtkPolyData)eyeMapper2.GetInput()).GetNumberOfPolys()).ToString() + " Polygons"); textBefore.SetDisplayPosition(10, 10); }
/// <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(); }