/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVmergeFilter(String [] argv) { //Prefix Content is: "" // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); ren2 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); renWin.AddRenderer((vtkRenderer)ren2); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // create pipeline[] //[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)110); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); probeLine = new vtkLineSource(); probeLine.SetPoint1((double)1,(double)1,(double)29); probeLine.SetPoint2((double)16.5,(double)5,(double)31.7693); probeLine.SetResolution((int)500); probe = new vtkProbeFilter(); probe.SetInputConnection((vtkAlgorithmOutput)probeLine.GetOutputPort()); probe.SetSource((vtkDataObject)pl3d.GetOutput()); probeTube = new vtkTubeFilter(); probeTube.SetInput((vtkDataObject)probe.GetPolyDataOutput()); probeTube.SetNumberOfSides((int)5); probeTube.SetRadius((double).05); probeMapper = vtkPolyDataMapper.New(); probeMapper.SetInputConnection((vtkAlgorithmOutput)probeTube.GetOutputPort()); probeMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); probeActor = new vtkActor(); probeActor.SetMapper((vtkMapper)probeMapper); displayLine = new vtkLineSource(); displayLine.SetPoint1((double)0,(double)0,(double)0); displayLine.SetPoint2((double)1,(double)0,(double)0); displayLine.SetResolution((int)probeLine.GetResolution()); displayMerge = new vtkMergeFilter(); displayMerge.SetGeometry((vtkDataSet)displayLine.GetOutput()); displayMerge.SetScalars((vtkDataSet)probe.GetPolyDataOutput()); displayWarp = new vtkWarpScalar(); displayWarp.SetInput((vtkDataObject)displayMerge.GetPolyDataOutput()); displayWarp.SetNormal((double)0,(double)1,(double)0); displayWarp.SetScaleFactor((double).000001); displayMapper = vtkPolyDataMapper.New(); displayMapper.SetInput((vtkPolyData)displayWarp.GetPolyDataOutput()); displayMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); displayActor = new vtkActor(); displayActor.SetMapper((vtkMapper)displayMapper); outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0); ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)probeActor); ren1.SetBackground((double)1,(double)1,(double)1); ren1.SetViewport((double)0,(double).25,(double)1,(double)1); ren2.AddActor((vtkProp)displayActor); ren2.SetBackground((double)0,(double)0,(double)0); ren2.SetViewport((double)0,(double)0,(double)1,(double).25); renWin.SetSize((int)300,(int)300); ren1.ResetCamera(); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange((double)3.95297,(double)50); cam1.SetFocalPoint((double)8.88908,(double)0.595038,(double)29.3342); cam1.SetPosition((double)9.9,(double)-26,(double)41); cam1.SetViewUp((double)0.060772,(double)-0.319905,(double)0.945498); ren2.ResetCamera(); cam2 = ren2.GetActiveCamera(); cam2.ParallelProjectionOn(); cam2.SetParallelScale((double).15); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVExtractTensors(String [] argv) { //Prefix Content is: "" // create tensor ellipsoids[] // Create the RenderWindow, Renderer and interactive renderer[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); ptLoad = new vtkPointLoad(); ptLoad.SetLoadValue((double)100.0); ptLoad.SetSampleDimensions((int)30,(int)30,(int)30); ptLoad.ComputeEffectiveStressOn(); ptLoad.SetModelBounds((double)-10,(double)10,(double)-10,(double)10,(double)-10,(double)10); extractTensor = new vtkExtractTensorComponents(); extractTensor.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort()); extractTensor.ScalarIsEffectiveStress(); extractTensor.ScalarIsComponent(); extractTensor.ExtractScalarsOn(); extractTensor.ExtractVectorsOn(); extractTensor.ExtractNormalsOff(); extractTensor.ExtractTCoordsOn(); contour = new vtkContourFilter(); contour.SetInputConnection((vtkAlgorithmOutput)extractTensor.GetOutputPort()); contour.SetValue((int)0,(double)0); probe = new vtkProbeFilter(); probe.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort()); probe.SetSource((vtkDataObject)ptLoad.GetOutput()); su = new vtkLoopSubdivisionFilter(); su.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort()); su.SetNumberOfSubdivisions((int)1); s1Mapper = vtkPolyDataMapper.New(); s1Mapper.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort()); // s1Mapper SetInputConnection [su GetOutputPort][] s1Actor = new vtkActor(); s1Actor.SetMapper((vtkMapper)s1Mapper); //[] // plane for context[] //[] g = new vtkImageDataGeometryFilter(); g.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort()); g.SetExtent((int)0,(int)100,(int)0,(int)100,(int)0,(int)0); g.Update(); //for scalar range[] gm = vtkPolyDataMapper.New(); gm.SetInputConnection((vtkAlgorithmOutput)g.GetOutputPort()); gm.SetScalarRange((double)((vtkDataSet)g.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)g.GetOutput()).GetScalarRange()[1]); ga = new vtkActor(); ga.SetMapper((vtkMapper)gm); s1Mapper.SetScalarRange((double)((vtkDataSet)g.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)g.GetOutput()).GetScalarRange()[1]); //[] // Create outline around data[] //[] outline = new vtkOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0); //[] // Create cone indicating application of load[] //[] coneSrc = new vtkConeSource(); coneSrc.SetRadius((double).5); coneSrc.SetHeight((double)2); coneMap = vtkPolyDataMapper.New(); coneMap.SetInputConnection((vtkAlgorithmOutput)coneSrc.GetOutputPort()); coneActor = new vtkActor(); coneActor.SetMapper((vtkMapper)coneMap); coneActor.SetPosition((double)0,(double)0,(double)11); coneActor.RotateY((double)90); coneActor.GetProperty().SetColor((double)1,(double)0,(double)0); camera = new vtkCamera(); camera.SetFocalPoint((double)0.113766,(double)-1.13665,(double)-1.01919); camera.SetPosition((double)-29.4886,(double)-63.1488,(double)26.5807); camera.SetViewAngle((double)24.4617); camera.SetViewUp((double)0.17138,(double)0.331163,(double)0.927879); camera.SetClippingRange((double)1,(double)100); ren1.AddActor((vtkProp)s1Actor); ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)coneActor); ren1.AddActor((vtkProp)ga); ren1.SetBackground((double)1.0,(double)1.0,(double)1.0); ren1.SetActiveCamera((vtkCamera)camera); renWin.SetSize((int)300,(int)300); renWin.Render(); // 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 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 AVExtractTensors(String [] argv) { //Prefix Content is: "" // create tensor ellipsoids[] // Create the RenderWindow, Renderer and interactive renderer[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); ptLoad = new vtkPointLoad(); ptLoad.SetLoadValue((double)100.0); ptLoad.SetSampleDimensions((int)30, (int)30, (int)30); ptLoad.ComputeEffectiveStressOn(); ptLoad.SetModelBounds((double)-10, (double)10, (double)-10, (double)10, (double)-10, (double)10); extractTensor = new vtkExtractTensorComponents(); extractTensor.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort()); extractTensor.ScalarIsEffectiveStress(); extractTensor.ScalarIsComponent(); extractTensor.ExtractScalarsOn(); extractTensor.ExtractVectorsOn(); extractTensor.ExtractNormalsOff(); extractTensor.ExtractTCoordsOn(); contour = new vtkContourFilter(); contour.SetInputConnection((vtkAlgorithmOutput)extractTensor.GetOutputPort()); contour.SetValue((int)0, (double)0); probe = new vtkProbeFilter(); probe.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort()); probe.SetSourceConnection(ptLoad.GetOutputPort()); su = new vtkLoopSubdivisionFilter(); su.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort()); su.SetNumberOfSubdivisions((int)1); s1Mapper = vtkPolyDataMapper.New(); s1Mapper.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort()); // s1Mapper SetInputConnection [su GetOutputPort][] s1Actor = new vtkActor(); s1Actor.SetMapper((vtkMapper)s1Mapper); //[] // plane for context[] //[] g = new vtkImageDataGeometryFilter(); g.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort()); g.SetExtent((int)0, (int)100, (int)0, (int)100, (int)0, (int)0); g.Update(); //for scalar range[] gm = vtkPolyDataMapper.New(); gm.SetInputConnection((vtkAlgorithmOutput)g.GetOutputPort()); gm.SetScalarRange((double)((vtkDataSet)g.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)g.GetOutput()).GetScalarRange()[1]); ga = new vtkActor(); ga.SetMapper((vtkMapper)gm); s1Mapper.SetScalarRange((double)((vtkDataSet)g.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)g.GetOutput()).GetScalarRange()[1]); //[] // Create outline around data[] //[] outline = new vtkOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0); //[] // Create cone indicating application of load[] //[] coneSrc = new vtkConeSource(); coneSrc.SetRadius((double).5); coneSrc.SetHeight((double)2); coneMap = vtkPolyDataMapper.New(); coneMap.SetInputConnection((vtkAlgorithmOutput)coneSrc.GetOutputPort()); coneActor = new vtkActor(); coneActor.SetMapper((vtkMapper)coneMap); coneActor.SetPosition((double)0, (double)0, (double)11); coneActor.RotateY((double)90); coneActor.GetProperty().SetColor((double)1, (double)0, (double)0); camera = new vtkCamera(); camera.SetFocalPoint((double)0.113766, (double)-1.13665, (double)-1.01919); camera.SetPosition((double)-29.4886, (double)-63.1488, (double)26.5807); camera.SetViewAngle((double)24.4617); camera.SetViewUp((double)0.17138, (double)0.331163, (double)0.927879); camera.SetClippingRange((double)1, (double)100); ren1.AddActor((vtkProp)s1Actor); ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)coneActor); ren1.AddActor((vtkProp)ga); ren1.SetBackground((double)1.0, (double)1.0, (double)1.0); ren1.SetActiveCamera((vtkCamera)camera); renWin.SetSize((int)300, (int)300); renWin.Render(); // 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 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(); }
/// <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.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // create pipeline[] //[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)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.AddInput((vtkPolyData)tpd1.GetOutput()); appendF.AddInput((vtkPolyData)tpd2.GetOutput()); appendF.AddInput((vtkPolyData)tpd3.GetOutput()); probe = new vtkProbeFilter(); probe.SetInputConnection((vtkAlgorithmOutput)appendF.GetOutputPort()); probe.SetSource((vtkDataObject)pl3d.GetOutput()); contour = new vtkContourFilter(); contour.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort()); contour.GenerateValues((int)50,(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); contourMapper = vtkPolyDataMapper.New(); contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort()); contourMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); planeActor = new vtkActor(); planeActor.SetMapper((vtkMapper)contourMapper); outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0); ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)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 AVprobe(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); // cut data[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); plane = new vtkPlane(); plane.SetOrigin(pl3d.GetOutput().GetCenter()[0],pl3d.GetOutput().GetCenter()[1],pl3d.GetOutput().GetCenter()[2]); plane.SetNormal((double)-0.287,(double)0,(double)0.9579); planeCut = new vtkCutter(); planeCut.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); planeCut.SetCutFunction((vtkImplicitFunction)plane); probe = new vtkProbeFilter(); probe.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort()); probe.SetSourceConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); cutMapper = new vtkDataSetMapper(); cutMapper.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort()); cutMapper.SetScalarRange((double)((vtkStructuredGrid)pl3d.GetOutput()).GetPointData().GetScalars().GetRange()[0], (double)((vtkStructuredGrid)pl3d.GetOutput()).GetPointData().GetScalars().GetRange()[1]); cutActor = new vtkActor(); cutActor.SetMapper((vtkMapper)cutMapper); //extract plane[] compPlane = new vtkStructuredGridGeometryFilter(); compPlane.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); compPlane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)9,(int)9); planeMapper = vtkPolyDataMapper.New(); planeMapper.SetInputConnection((vtkAlgorithmOutput)compPlane.GetOutputPort()); planeMapper.ScalarVisibilityOff(); planeActor = new vtkActor(); planeActor.SetMapper((vtkMapper)planeMapper); planeActor.GetProperty().SetRepresentationToWireframe(); planeActor.GetProperty().SetColor((double)0,(double)0,(double)0); //outline[] outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); 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)planeActor); ren1.AddActor((vtkProp)cutActor); ren1.SetBackground((double)1,(double)1,(double)1); renWin.SetSize((int)400,(int)300); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange((double)11.1034,(double)59.5328); cam1.SetFocalPoint((double)9.71821,(double)0.458166,(double)29.3999); cam1.SetPosition((double)-2.95748,(double)-26.7271,(double)44.5309); cam1.SetViewUp((double)0.0184785,(double)0.479657,(double)0.877262); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }