1 from gdcmConfigDemo import *
2 from gdcmPython.vtk import *
3 from vtkpython import *
9 print "%s <fileName>" % sys.argv[0]
10 print " fileName : path to the DICOM file to see"
16 fileName = sys.argv[1]
18 fileName = os.path.join(GDCM_DATA_ROOT, "test.acr")
20 if( not os.path.isfile(fileName) ):
25 reader = vtkGdcmReader()
26 reader.SetFileName(fileName)
30 viewer = vtkImageViewer()
31 viewer.SetInput(reader.GetOutput())
32 rng = reader.GetOutput().GetScalarRange()
33 viewer.SetColorWindow(rng[1] - rng[0])
34 viewer.SetColorLevel(0.5 * (rng[1] + rng[0]))
36 dim = reader.GetOutput().GetDimensions()
37 viewer.SetSize(dim[0],dim[1])
39 # For multifame dicom, take a snapshot of the center slice (+/- 1)
40 viewer.SetZSlice(dim[2] / 2)