/// <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(); }
/// <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(); }
///<summary> A Set Method for Static Variables </summary> public static void Setpiw(vtkPImageWriter toSet) { piw = toSet; }