23 These examples are used in the I/O documentation page. The IO.rst file
24 pulls the code examples based their line numbers in this file. So any
25 change in the line numbers of the code below will break the I/O page.
32 def example1(inputImageFileName, outputImageFileName):
33 """ A Simple Image Input/Output Example """
35 import SimpleITK
as sitk
38 reader.SetImageIO(
"PNGImageIO")
39 reader.SetFileName(inputImageFileName)
40 image = reader.Execute()
43 writer.SetFileName(outputImageFileName)
49 def example2(inputImageFileName, outputImageFileName):
50 """ A Simple Procedural Image Input/Output Example """
52 import SimpleITK
as sitk
61 """ A Simple Transform Input/Output Example """
63 import SimpleITK
as sitk
66 basic_transform.SetTranslation((2, 3))
74 if __name__ ==
"__main__":
77 print(
"Usage: SimpleIO <input> <output>")
80 example1(sys.argv[1], sys.argv[2])
81 example2(sys.argv[1], sys.argv[2])