1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25import itk
26import sys
27
28if len(sys.argv) < 3:
29 print("Usage: " + sys.argv[0] + " inputFile.dcm outputFile.png")
30 sys.exit(1)
31
32
33
34
35
36InputImageType = itk.Image.SS2
37OutputImageType = itk.Image.UC2
38
41
43filter.SetOutputMinimum(0)
44filter.SetOutputMaximum(255)
45
46filter.SetInput(reader.GetOutput())
47writer.SetInput(filter.GetOutput())
48
49reader.SetFileName(sys.argv[1])
50writer.SetFileName(sys.argv[2])
51
52writer.Update()
Data source that reads image data from a single file.
Writes image data to a single file.
Applies a linear transformation to the intensity levels of the input Image.