///<summary> A Set Method for Static Variables </summary> public static void Settranslator(vtkBranchExtentTranslator toSet) { translator = toSet; }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVTestBranchExtentTranslator(String [] argv) { //Prefix Content is: "" gauss = new vtkImageGaussianSource(); gauss.SetWholeExtent((int)0,(int)30,(int)0,(int)30,(int)0,(int)2); gauss.SetCenter((double)18,(double)12,(double)0); gauss.SetMaximum((double)1.0); gauss.SetStandardDeviation((double)6.0); gauss.Update(); translator = new vtkBranchExtentTranslator(); translator.SetOriginalSource((vtkImageData)gauss.GetOutput()); gauss.GetOutput().SetExtentTranslator((vtkExtentTranslator)translator); clip1 = new vtkImageClip(); clip1.SetOutputWholeExtent((int)7,(int)28,(int)0,(int)15,(int)1,(int)1); clip1.SetInputConnection((vtkAlgorithmOutput)gauss.GetOutputPort()); surf1 = new vtkDataSetSurfaceFilter(); surf1.SetInputConnection((vtkAlgorithmOutput)clip1.GetOutputPort()); tf1 = new vtkTriangleFilter(); tf1.SetInputConnection((vtkAlgorithmOutput)surf1.GetOutputPort()); mapper1 = vtkPolyDataMapper.New(); mapper1.SetInputConnection((vtkAlgorithmOutput)tf1.GetOutputPort()); mapper1.SetScalarRange((double)0,(double)1); mapper1.SetNumberOfPieces((int)4); mapper1.SetPiece((int)1); actor1 = new vtkActor(); actor1.SetMapper((vtkMapper)mapper1); actor1.SetPosition((double)0,(double)0,(double)0); // For coverage, a case where all four sides get clipped by the whole extent.[] clip2 = new vtkImageClip(); clip2.SetOutputWholeExtent((int)16,(int)18,(int)3,(int)10,(int)0,(int)0); clip2.SetInputConnection((vtkAlgorithmOutput)gauss.GetOutputPort()); surf2 = new vtkDataSetSurfaceFilter(); surf2.SetInputConnection((vtkAlgorithmOutput)clip2.GetOutputPort()); tf2 = new vtkTriangleFilter(); tf2.SetInputConnection((vtkAlgorithmOutput)surf2.GetOutputPort()); mapper2 = vtkPolyDataMapper.New(); mapper2.SetInputConnection((vtkAlgorithmOutput)tf2.GetOutputPort()); mapper2.SetScalarRange((double)0,(double)1); mapper2.SetNumberOfPieces((int)4); mapper2.SetPiece((int)1); actor2 = new vtkActor(); actor2.SetMapper((vtkMapper)mapper2); actor2.SetPosition((double)15,(double)0,(double)0); // nothing in intersection (empty case)[] clip3 = new vtkImageClip(); clip3.SetOutputWholeExtent((int)1,(int)10,(int)0,(int)15,(int)0,(int)2); clip3.SetInputConnection((vtkAlgorithmOutput)gauss.GetOutputPort()); surf3 = new vtkDataSetSurfaceFilter(); surf3.SetInputConnection((vtkAlgorithmOutput)clip3.GetOutputPort()); tf3 = new vtkTriangleFilter(); tf3.SetInputConnection((vtkAlgorithmOutput)surf3.GetOutputPort()); mapper3 = vtkPolyDataMapper.New(); mapper3.SetInputConnection((vtkAlgorithmOutput)tf3.GetOutputPort()); mapper3.SetScalarRange((double)0,(double)1); mapper3.SetNumberOfPieces((int)4); mapper3.SetPiece((int)1); actor3 = new vtkActor(); actor3.SetMapper((vtkMapper)mapper3); actor3.SetPosition((double)30,(double)0,(double)0); ren = vtkRenderer.New(); ren.AddActor((vtkProp)actor1); ren.AddActor((vtkProp)actor2); ren.AddActor((vtkProp)actor3); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren); //set cam [ren GetActiveCamera][] //ren ResetCamera[] iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); iren.Initialize(); renWin.Render(); // break loop to avoid a memory leak.[] translator.SetOriginalSource(null); //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVTestBranchExtentTranslator(String [] argv) { //Prefix Content is: "" gauss = new vtkImageGaussianSource(); gauss.SetWholeExtent((int)0, (int)30, (int)0, (int)30, (int)0, (int)2); gauss.SetCenter((double)18, (double)12, (double)0); gauss.SetMaximum((double)1.0); gauss.SetStandardDeviation((double)6.0); gauss.Update(); translator = new vtkBranchExtentTranslator(); translator.SetOriginalSource((vtkImageData)gauss.GetOutput()); gauss.GetOutput().SetExtentTranslator((vtkExtentTranslator)translator); clip1 = new vtkImageClip(); clip1.SetOutputWholeExtent((int)7, (int)28, (int)0, (int)15, (int)1, (int)1); clip1.SetInputConnection((vtkAlgorithmOutput)gauss.GetOutputPort()); surf1 = new vtkDataSetSurfaceFilter(); surf1.SetInputConnection((vtkAlgorithmOutput)clip1.GetOutputPort()); tf1 = new vtkTriangleFilter(); tf1.SetInputConnection((vtkAlgorithmOutput)surf1.GetOutputPort()); mapper1 = vtkPolyDataMapper.New(); mapper1.SetInputConnection((vtkAlgorithmOutput)tf1.GetOutputPort()); mapper1.SetScalarRange((double)0, (double)1); mapper1.SetNumberOfPieces((int)4); mapper1.SetPiece((int)1); actor1 = new vtkActor(); actor1.SetMapper((vtkMapper)mapper1); actor1.SetPosition((double)0, (double)0, (double)0); // For coverage, a case where all four sides get clipped by the whole extent.[] clip2 = new vtkImageClip(); clip2.SetOutputWholeExtent((int)16, (int)18, (int)3, (int)10, (int)0, (int)0); clip2.SetInputConnection((vtkAlgorithmOutput)gauss.GetOutputPort()); surf2 = new vtkDataSetSurfaceFilter(); surf2.SetInputConnection((vtkAlgorithmOutput)clip2.GetOutputPort()); tf2 = new vtkTriangleFilter(); tf2.SetInputConnection((vtkAlgorithmOutput)surf2.GetOutputPort()); mapper2 = vtkPolyDataMapper.New(); mapper2.SetInputConnection((vtkAlgorithmOutput)tf2.GetOutputPort()); mapper2.SetScalarRange((double)0, (double)1); mapper2.SetNumberOfPieces((int)4); mapper2.SetPiece((int)1); actor2 = new vtkActor(); actor2.SetMapper((vtkMapper)mapper2); actor2.SetPosition((double)15, (double)0, (double)0); // nothing in intersection (empty case)[] clip3 = new vtkImageClip(); clip3.SetOutputWholeExtent((int)1, (int)10, (int)0, (int)15, (int)0, (int)2); clip3.SetInputConnection((vtkAlgorithmOutput)gauss.GetOutputPort()); surf3 = new vtkDataSetSurfaceFilter(); surf3.SetInputConnection((vtkAlgorithmOutput)clip3.GetOutputPort()); tf3 = new vtkTriangleFilter(); tf3.SetInputConnection((vtkAlgorithmOutput)surf3.GetOutputPort()); mapper3 = vtkPolyDataMapper.New(); mapper3.SetInputConnection((vtkAlgorithmOutput)tf3.GetOutputPort()); mapper3.SetScalarRange((double)0, (double)1); mapper3.SetNumberOfPieces((int)4); mapper3.SetPiece((int)1); actor3 = new vtkActor(); actor3.SetMapper((vtkMapper)mapper3); actor3.SetPosition((double)30, (double)0, (double)0); ren = vtkRenderer.New(); ren.AddActor((vtkProp)actor1); ren.AddActor((vtkProp)actor2); ren.AddActor((vtkProp)actor3); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren); //set cam [ren GetActiveCamera][] //ren ResetCamera[] iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); iren.Initialize(); renWin.Render(); // break loop to avoid a memory leak.[] translator.SetOriginalSource(null); //deleteAllVTKObjects(); }