import vtk # This script is for testing the 3D Sobel filter. # Displays the 3 components using color. format = 'DICOM' # Image pipeline if format == 'DICOM': reader = vtk.vtkDICOMImageReader() reader.SetFileName("C:/temp/SC.1.3.6.1.4.1.9590.100.1.1.58158724011060928131648073180919160033") win = 400000 lev = 400000 else: reader = vtk.vtkJPEGReader() reader.SetFileName("C:/temp/x.jpg") win = 4000 lev = 0 viewer = vtk.vtkImageViewer() viewer.SetInputConnection( reader.GetOutputPort() ) viewer.SetColorWindow(win) viewer.SetColorLevel(lev) viewer.Render() viewer2 = vtk.vtkImageViewer2() viewer2.SetInputConnection( reader.GetOutputPort() ) viewer2.SetColorWindow(win) viewer2.SetColorLevel(lev) viewer2.Render() iren = vtk.vtkRenderWindowInteractor() viewer2.SetupInteractor(iren) iren.Initialize()